Skip to content
Prev 359792 / 398503 Next

Evaluating an expression

I think you need to spend some time with an R tutorial or two to learn
how to handle such basics yourself.

However, if I understand correctly, probably the easiest way to do it
is by converting a matrix of 0's to a data frame -- which you
shouldn't do at all if you can do your analysis directly with the
matrix (it's almost always faster, sometimes considerably so). e.g.

adf <- data.frame(matrix(0, nrow=10,ncol=20))

Of course, you may then wish to provide more informative names for
your columns via the names() function.

Also, I would question whether you need to do any of this in the first
place. It is rarely necessary in R to initialize a data frame or
matrix.

Finally, you should almost never need the eval(parse()) construction,
which treats R as a macro language instead of taking advantage of its
functional programming paradigm. Again, the of sort thing that good R
tutorials can help you with. There are many on the web. Some good
recommendations can be found here:

https://www.rstudio.com/online-learning/#R

HTH,

Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Apr 4, 2016 at 9:22 AM, Janszen, Derek
<derek.janszen at precisionformedicine.com> wrote: