Hello,
I would like to get an advice on how the notorious eval(parse()) construct 
could possibly 
be avoided in the following example. I have an array x, which can have 
different number of dimensions,
but I am only interested in extracting, say, the first element of the first 
dimension. Currently I achieve this
in this way:

eval(parse(text=paste0("x[1", paste(rep(", ", length(dim(x)) - 1), 
collapse=""), "]")))

Is it possible to avoid the eval parse here? How?

Best regards,

Martin

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to