Thank you arun !
I don't know the library reshape2
Michel
Le 20/06/2013 19:55, arun a écrit :
Hi,
Not sure if you wanted the entries with "0".
library(reshape2)
dfMelt<-melt(df,id.var=c("Country","Iso"))
#subset those with "1"
dfNew<- subset(dfMelt,value==1,select=-4) row.names(dfNew)<- 1:
Hi,
Not sure if you wanted the entries with "0".
library(reshape2)
dfMelt<-melt(df,id.var=c("Country","Iso"))
#subset those with "1"
dfNew<- subset(dfMelt,value==1,select=-4) row.names(dfNew)<- 1:nrow(dfNew)
dfNew
# Country Iso variable
#1 Zimbabwe ZW Abaco
#2 South Afri
Hello
I have the following dataframe :
df <- data.frame(
Country=c("Zimbabwe","Burkina Faso","South Africa","Madagascar","Tanzania",
"Mali","Mozambique","Madagascar","Ghana","Nigeria","Kenya","Burkina Faso",
"South Africa","Tanzania","Kenya","Ethiopia" ) ,
Iso=c("ZW","BF","ZA","MG","TZ","ML","M
3 matches
Mail list logo