Skip to content
Back to formatted view

Raw Message

Message-ID: <1428300355.24552.YahooMailAndroidMobile@web162103.mail.bf1.yahoo.com>
Date: 2015-04-06T06:05:55Z
From: Mohammad Tanvir Ahamed
Subject: Combine list element by column name to make a dataframe
In-Reply-To: <339423473.194948.1428265952510.JavaMail.yahoo@mail.yahoo.com>

Hi ,?

I have a example list like follow?


############################################

lst<-list(setNames(c(1,10,50,60,70,80),c("id","id1","math","phy","che","bio")),setNames(c(2,20,45),c("id","id1","phy")),setNames(c(3,30,75),c("id","id1","bio")))


My expected outcome :?

---------------------------------------------------------------------

df<-rbind(c(1,10,50,60,70,80),c(2,20,NA,45,NA,NA),c(3,30,NA,NA,NA,75))

colnames(df)<-c("id","id1","math","phy","che","bio")

row.names(df) <- NULL

df

############################################


Any suggestion will be appreciated .?

Thanks in advance.

?

Best regards


...........................?

Tanvir Ahamed

G?teborg, Sweden




	[[alternative HTML version deleted]]