[R] Replace columns in a data.frame randomly splitted

agent dunham crosspide at hotmail.com
Wed Nov 30 14:15:29 CET 2011

Dear community, 

 I'm working with the data.frame attached (
http://r.789695.n4.nabble.com/file/n4122926/df1.xls df1.xls ), let's call it
 I typed:  df1<- read.xls("C:/... dir .../df1.xls",colNames= TRUE, rowNames=

 Then I splited randomly df1 using splitdf function
 So now, I have df1 divided in another 2 dataframes: trainset  and testset.
(They both have the same row  names and column names as df1)

 I'd like to change df1$v1 and df1$v2 values in the trainset  and testset by
the ones in df2 ( http://r.789695.n4.nabble.com/file/n4122926/df2.xls
df2.xls )

 How can I explain R to identify in trainset/testset$v1 and $v2 the rownames 
and replace the values by the corresponding ones in df2?

Thanks in advance, 

user at host.com

View this message in context: http://r.789695.n4.nabble.com/Replace-columns-in-a-data-frame-randomly-splitted-tp4122926p4122926.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list