[R] bind data.frames seperately

Carmen Meier carmei3 at web.de
Tue Dec 5 21:48:20 CET 2006


Hi to all,

I would like to bind data1 and data2 (both are coming from an Excel 
sheet) but only the data rows
using rbind will cause double names and value.
but I need only add the data.rows and the rest of the names and values 
should be NA

value.1=c("a","b","c","d",5:54)          # building similar data frame 
like from excel
for (i in 5:54) value.1[i] <- NA            #only to simulate the NAs 
for the example
value.2=c(1:54)
for (i in 5:54) value.2[i] <- NA

data1<-data.frame(names=value.1, value=value.2, 
data.row.1=c(1:54),data.row.2=c(1:54))

value.1=c("a","b","c","d",5:69)
for (i in 5:69) value.1[i] <- NA
value.2=c(1:69)
for (i in 5:69) value.2[i] <- NA

data2<-data.frame(names=value.1, value.2, 
data.row.1=c(1:69),data.row.2=c(1:69))

By the way: Why are the NAs from name are changing from NA to <NA> after 
the data.frame command?

Thank you for your help

Carmen




More information about the R-help mailing list