[R] Language element manipulation
dmurdoch at pair.com
Fri Jul 28 05:03:50 CEST 2000
It's hard to do with $. I think you need something like
It's easier to use subscripting if themeas is a dataframe:
On Thu, 27 Jul 2000 21:43:31 -0500 (CDT), you wrote:
>I am very confused about this. I want to convert a string to a name so I can
>use it to extract an element of a data frame using `$'. Here is my
>do.graph <- function (meas)
> fn <- paste("a", meas, ".dat", sep='')
> themeas <- read.table(fn, header=F)
> ameas <- as.name(paste("a", meas, sep=''))
> names(themeas) <- c("xpos", paste("a", meas, sep=''))
> meassum <- summary(themeas$ameas[themeas$xpos==1])
>So, when this function is called with the argument ``infl'' the second column
>will be named ``ainfl''. In the last line I want to extract the column called
>``ainfl'' from the data frame ``themeas''. But this is what happens:
>Just grabbing at straws here:
>Error: attempt to apply non-function
>Can someone wise me up about this?
>Stuart Luppescu -=-=- University of Chicago
>ºÍÊ¸ ¤ÈÃÒÆàÈþ¤ÎÉã(EUC) -=-=- s-luppescu at uchicago.edu
>PGP public key: www.consortium-chicago.org/people/sl/pubkey.asc
> ICQ #21172047 AIM: psycho7070
> "She's about as smart as bait."
>>> Sent on 27-Jul-2000 at
>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
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