?get names <- c('c', 'cc') for (i in names){ print(nrow(get(i))) }
On Sat, Nov 22, 2008 at 4:06 PM, Georg Ehret <[EMAIL PROTECTED]> wrote: > Dear R community, > I am trying to apply a simple operation to several dataframes (e.g. > nrow) and cannot get the looping to work. My objective is to get an output > that indicates me the number of rows for every dataframe. > >> c > V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 > 1 1 11 21 31 41 51 61 71 81 91 > 2 2 12 22 32 42 52 62 72 82 92 > 3 3 13 23 33 43 53 63 73 83 93 > 4 4 14 24 34 44 54 64 74 84 94 > 5 5 15 25 35 45 55 65 75 85 95 >> cc > V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 > 1 1 11 21 31 41 51 61 71 81 91 > 2 2 12 22 32 42 52 62 72 82 92 > 3 3 13 23 33 43 53 63 73 83 93 > 4 4 14 24 34 44 54 64 74 84 94 > 5 5 15 25 35 45 55 65 75 85 95 > 6 6 16 26 36 46 56 66 76 86 96 > 7 7 17 27 37 47 57 67 77 87 97 > 8 8 18 28 38 48 58 68 78 88 98 > 9 9 19 29 39 49 59 69 79 89 99 > 10 10 20 30 40 50 60 70 80 90 100 >> names<-c("c","cc") >> for(i in names){nrow(i)} > > Thank you! > Georg. > ***************************** > Georg Ehret > [EMAIL PROTECTED] > Geneva University Hospital > Switzerland > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.