Re: [R] unit attribute to list elements

2007-12-28 Thread baptiste AuguiƩ
On 28 Dec 2007, at 20:06, Gabor Grothendieck wrote: > Is this what you want? > Perfect! Thanks a lot! >> Lines <- "cel 3.0 m/s > + Z0 367 ohm > + eps0 8.9e-12 F/m > + " >> Constants.DF <- read.table(textConnection(Lines), as.is = TRUE) >> Constants <- as.list(Constants.DF[[2]]) >> names(Constan

Re: [R] unit attribute to list elements

2007-12-28 Thread Gabor Grothendieck
Is this what you want? > Lines <- "cel 3.0 m/s + Z0 367 ohm + eps0 8.9e-12 F/m + " > Constants.DF <- read.table(textConnection(Lines), as.is = TRUE) > Constants <- as.list(Constants.DF[[2]]) > names(Constants) <- Constants.DF[[1]] > for(i in seq_along(Constants)) comment(Constants[[i]]) <- Constan

[R] unit attribute to list elements

2007-12-28 Thread baptiste AuguiƩ
Hi, I've started my own (first) package, part of which consists in listing common physical constants (Planck's constant, the speed of light in vacuum, etc). I'm wondering what would be a good way of dealing with pairs of value/unit. > constants <- list( cel = 2.99792458e8 , #m/s > Z0 = 376