[R] names of data.frame variables?

Henrique Dallazuanna wwwhsd at gmail.com
Mon Mar 3 12:12:47 CET 2008


One option is:

> head(f)
            A           B          C          D          E
1  0.75135094 -0.06779700 -0.2617316 -0.3701998  0.7332249
2 -0.85657366  0.27442139 -0.4291410  0.1107827  0.6942490
3  1.16125212 -0.18631979 -0.3918744  0.4804644  0.9374566
4  0.32100928  0.03773391 -0.8712896 -0.5236532  0.9064957
5 -0.24852361 -1.24139700 -0.4990958 -1.6720261 -0.8791833
6  0.00582175 -0.28361208 -0.4450383 -0.4248984 -0.7066752
> head(e)
           A            B          C          D           E
1 -2.4420422 -0.380338676  0.2330927 -1.2107826 -1.90697224
2 -0.6070602 -0.304334094  1.0082733  2.0308774 -0.30244449
3  0.8933633  1.883316570 -0.4431651  0.5203559 -2.57122258
4 -0.5415851  0.370019811 -1.7851152  0.4373462 -0.92199391
5 -0.7092424  0.003823628 -0.4314738  0.5156975 -0.19511293
6 -1.4816483  0.187447079 -1.0240595  0.1666378 -0.06966855

lapply(names(e), function(x)eval(bquote(t.test(e[.(x)], f[.(x)]))))

On 03/03/2008, Martin Kaffanke <technik at roomandspace.com> wrote:
> Hi there!
>
>  I'd like to make many tests and plots, for each variables.
>
>  i.E.
>
>  i <- 1
>  repeat {
>    print (t.test(e[i], f[i]))
>    i <- i + 1
>    if (i == 21) break
>  }
>
>  but the output is:
>         Welch Two Sample t-test
>
>  data:  e[i] and f[i]
>  ...
>
>  so I don't know which data was calculated.
>
>  Is there a way to tell the t.test or I'll make the same with plotmeans
>  (from the gplots library) but I'd like to have it like
>
>  t.text(e$angststoer, f$angststoer)
>
>  so I know what was calculated or plotted...
>
>  Any ideas?
>
>  Thanks,
>  Martin
>
>
>
>  --
>  Ihr Partner für Webdesign, Webapplikationen und Webspace.
>  http://www.roomandspace.com/
>  Martin Kaffanke +43 650 4514224
>
> ______________________________________________
>  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.
>
>
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list