[R] Create rows for columns in dataframe

Dark info at software-solutions.nl
Tue Aug 13 18:16:23 CEST 2013


Hi,

My desired output for my sample!! using dput():
structure(list(ID = c("1", "2", "3", "4", "5", "6", "7", "8", 
"9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", 
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", 
"31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", 
"42", "43", "44", "45", "46", "47", "48"), DSYSRTKY = c("100000005", 
"100000005", "100000005", "100000005", "100000203", "100000203", 
"100000203", "100000203", "100000315", "100000315", "100000315", 
"100000315", "100000315", "100000315", "100000315", "100000315", 
"100000315", "100000315", "100000315", "100000315", "100000315", 
"100000315", "100000315", "100000315", "100000315", "100000315", 
"100000315", "100000315", "100000327", "100000327", "100000327", 
"100000327", "100000327", "100000327", "100000327", "100000327", 
"100000327", "100000327", "100000327", "100000327", "100000327", 
"100000327", "100000327", "100000327", "100000327", "100000327", 
"100000327", "100000327"), CODE = c("71535", "78900", "V1251", 
"V454", "45341", "4019", "72400", "V1011", "42831", "5990", "8052", 
"4241", "4019", "311", "2724", "71680", "4168", "7804", "V066", 
"6930", "41400", "V4581", "40291", "4280", "5990", "V4986", "5939", 
"3109", "41401", "6826", "7850", "4019", "2720", "49390", "2859", 
"79029", "V1582", "486", "51881", "5119", "42789", "7823", "41400", 
"V4581", "40390", "5859", "49390", "2724"), PRIMAIRY = c("TRUE", 
"FALSE", "FALSE", "FALSE", "TRUE", "FALSE", "FALSE", "FALSE", 
"TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", 
"FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", 
"FALSE", "FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "TRUE", 
"FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", 
"FALSE", "TRUE", "FALSE", "FALSE", "FALSE", "FALSE", "FALSE", 
"FALSE", "FALSE", "FALSE", "FALSE", "FALSE")), .Names = c("ID", 
"DSYSRTKY", "CODE", "PRIMAIRY"), row.names = c(NA, 48L), class =
"data.frame")

So the 'DSYSRTKY' (100000005) has 4 code fields filled so you get 4 rows.
The next one also 4, the third one 16. Anyway, just take a look at the
sample.

I think this will help trying to make clear what my desired result is!

Regards Derk





--
View this message in context: http://r.789695.n4.nabble.com/Create-rows-for-columns-in-dataframe-tp4673607p4673646.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list