[R] How to assign text string as object?

jim holtman jholtman at gmail.com
Sun Mar 16 23:44:11 CET 2008


Take a look at 'matplot'.  If you want to loop, try

for (i in 1:16) plot(df[[paste("V", i, sep="")]] ~ df$AGE)

On 3/16/08, Ing. Michal Kneifl, Ph.D. <xkneifl at mendelu.cz> wrote:
> I have a problem I cannot get over for a long time. Imagine I have a
> data frame with 17 colums. 16 of them are craniometric variables of
> Cervus elaphus and one contains age.
> The data frame has 83 rows.
> I want to write a loop which plots the values of each craniometric
> variable against the age. The names of columns are V1, V2, V3, etc...
> What I have done till now was writing this:
>
> layout(matrix(1:16,4,4))
> plot(V1~AGE)
> plot(V2~AGE)
> .
> .
> .
> .
> etc.
> How to assign a string in the loop so that the program understands it
> is an object?
> Thank for your help in advance.
>
> Michael
>
> ______________________________________________
> R-help at 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list