Dear R helpers
 
After executing the R code, where the last few lines of the code are something 
like given below.
 
 
## Part of my R code
 
 
n = 20
 
........
.........
 
final_output = data.frame(Numbers = numbers, ABC = data1, XYZ = data2, PQR = 
data3)
          
write.csv(data.frame(Scenario = paste("Sc_", 1:n, sep = ""), final_output'), 
'result.csv', row.names = FALSE)          

## End of code
 
 
When I open the 'result.csv' file, my output is like
 
Scenario     Numbers         ABC                 XYZ                 PQR
Sc_1                1                  22                  18                    
 6
Sc_2                2                  24                  16.5                 
11
SC_3               3                  38                    
41                  38 
 
................................................................
 
Sc_20            20                  15                 27.5                  74
 
 
## MY REQUIEMENT
 
I wish to have output like given below.
 
Scenario             Numbers       Names      Values                  
 
Sc_1                        1             ABC         22
Sc_1                        1             XYZ          18
Sc_1                        1             PQR           6   
Sc_2                        2             ABC          24
Sc_2                        2             XYZ          16.5
Sc_2                        2             PQR           11
 
.................................................................
 
 
Sc_20                     20           ABC           15
Sc_20                     20           XYZ            27.5
Sc_20                     20           PQR           74     
 
 
Please guide how this can be achieved?
 
Regards and thanks in advance
 
Amelia
 
 
 
 
          


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to