Thanks a lot - I should have seen that
Best wishes
Troels
Den 04-12-2015 kl. 17:09 skrev PIKAL Petr:
Hi
Maybe little bit of studying how functions work can be useful
rbind uses to bind two objects together, however you give it only one.
Use
DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),
On 04 Dec 2015, at 17:03 , Troels Ring wrote:
> Dear friends - I have a very simple question -
> I generate a number of dataframes with identical names and want to combine
> them into one large dataframe with the same names -
> here is an example
>
> DF <- data.frame(a=rnorm(10),b=runif(10),ID
Try reading and following the Help file, ?rbind.data.frame.
You are inventing your own syntax, not using R's.
Incidentally, growing the frames as you do is generally a bad idea.
Search r-help archives for why.
Cheers,
Bert
Bert Gunter
"Data is not information. Information is not knowledge. And
This will work, although depending on what you are trying to do, there may be a
better way:
> DF <- data.frame(a=rnorm(10),b=runif(10),ID=0)
> for (i in 1:10){
+ DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),ID=i))}
> str(DF)
'data.frame': 110 obs. of 3 variables:
$ a : num 0.792 0.141
Hi
Maybe little bit of studying how functions work can be useful
rbind uses to bind two objects together, however you give it only one.
Use
DF <- rbind(DF, data.frame(a=rnorm(10),b=runif(10),ID=i))
instead.
Cheers
Petr
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-pro
5 matches
Mail list logo