[R] avoiding eval parse with indexing
Martin Ivanov
tramni at abv.bg
Sun May 26 15:56:07 CEST 2013
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
More information about the R-help
mailing list