Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread siddu479
Hi Jeff Newmiller, The script given by you is perfect for my requirement. The rest of the scripts given by other authors are failing to format the file header which are giving like eachdatacolumn.1 or eachdatacolumn.2 etc, whereas I need them as eachdatacolumn_firstactualstepnumber, eachdata

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread David L Carlson
- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of arun > Sent: Sunday, October 14, 2012 1

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread arun
    A   2 #2    B   3   1   3    B   2   2   2    B   1  # Data3_2 Data3_3 #1   4   3 #2       3   0 A.K. - Original Message ----- From: siddu479 To: r-help@r-project.org Cc: Sent: Sunday, October 14, 2012 12:13 PM Subject: [R] transforming a .csv

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread arun
: num  1 2  #$ Data2.3: num  1 2  #$ Data2.4: num  1 2 # $ Tool   : Factor w/ 2 levels "A","B": 1 2 # $ Data3.2: num  2 1 # $ Data3.3: num  4 3 # $ Data3.4: num  3 0 A.K. - Original Message - From: siddu479 To: r-help@r-project.org Cc: Sent: Sunday, October 14, 2

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread Rui Barradas
Hello, Try the following. dta1 <- read.csv( text= "Tool,Step_Number,Data1,Data2 A,1,0,1 A,2,3,2 A,3,2,3 B,1,3,2 B,2,1,2 B,3,3,2 ") sp <- split(dta1[-2], dta1$Tool) dta2 <- do.call(rbind, lapply(sp, function(x) as.vector(unlist(t(x) dta2 <- data.frame(dta2, stringsAsFactors = FALSE) idx <- r

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread arun
October 14, 2012 12:13 PM Subject: [R] transforming a .csv file column names as per a particular column rows using R code Hello all, I have a .csv file like below. Tool,Step_Number,Data1,Data2... etc up to 100 columns. A,1,0,1 A,2,3,1 A,3,2,1 . . B,1,3,2 B,2,1,2 B,3,3,2 . . .. so on upto

Re: [R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread Jeff Newmiller
Not clear to me what your successive rows indicate in your output. However, you may get something similar to what you want using the reshape2 library: library(reshape2) dta1 <- read.csv( text= "Tool,Step_Number,Data1,Data2 A,1,0,1 A,2,3,2 A,3,2,3 B,1,3,2 B,2,1,2 B,3,3,2 ") # put into long fo

[R] transforming a .csv file column names as per a particular column rows using R code

2012-10-14 Thread siddu479
Hello all, I have a .csv file like below. Tool,Step_Number,Data1,Data2... etc up to 100 columns. A,1,0,1 A,2,3,1 A,3,2,1 . . B,1,3,2 B,2,1,2 B,3,3,2 . . .. so on upto 50 rows where the column "*Tool*" has distinct steps in second column "*Step_Number*",but both have same entries in Step_Numbe