[R] coercion of LHS to a list

Pete Phillips pete at crusher.smtl.co.uk
Tue Nov 7 17:12:00 CET 2000


I'm using R to manipulate some data for testing nebulisers.

I have a data frame as follows:

            Volt
       ABal 0.4208
       A1   0.3982
       AF   0.4353
       B1   0.3954
       BF   0.4355
       C1   0.3975
       CF   0.4345

I also have a calibration curve loaded 

     Voltage NaF  LogNaF
  1  0.3588  20 1.30103
  2  0.3990 100 2.00000
  3  0.4391 500 2.69897


If I try to create a new column at the R command line, as follows:

nebdata$logconc<-nebdata$Volt*nebcal.fm$coefficients[2]+nebcal.fm$coefficients[1]

I get this (as I expected):

> nebdata
            Volt   logconc
       ABal 0.4208 2.380112
       A1   0.3982 1.986653
       AF   0.4353 2.632553
       B1   0.3954 1.937905
       BF   0.4355 2.636035
       C1   0.3975 1.974466
       CF   0.4345 2.618625

However, if I do it from a batch file, I get this:

[1] 2.380096 1.986653 2.632525 1.937908 2.636007 1.974467 2.618598

What has happened ?

Also, is it possible for me to reference a single figure in the data
frame eg: the intersect of Volt and ABal (0.4208) without having to
resort to this:
	 nebdata[1:1, c(2)]

Any help appreciated,
Pete

--
Pete Phillips, Deputy Director,     | Visit  http://www.smtl.co.uk/ 
Surgical Materials Testing Lab,     | A web site dedicated to medical
Princess of Wales Hospital, S. Wales| disposables, dressings, wound care
Fax: +44 1656-752830 pete at smtl.co.uk| and biosurgery (maggot therapy).
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list