Skip to content
Prev 152989 / 398500 Next

dynamically extract data from a list

Hi,

Thanks for your reply. However, this didn't work exactly as I needed  
it to since the expression is dynamically built as a character vector

i.e. not executed as
e <- expression(Sepal.Width > 4)

but as
e <- expression("Sepal.Width > 4")

in which case subset() throws an error (must evaluate to logical).

Fortunately, a good night of sleep resulted in this workaround:

s <- "iris[Sepal.Width > 4,]"
execute.string <- function(string) {
   write(string, 'tmp.txt')
   out <- source('tmp.txt')
   unlink('tmp.txt')
   return(out$value)
}
execute.string(s)
On 12 Aug 2008, at 04:08, Gabor Grothendieck wrote: