Re: [R] Help with reshape/reshape2 needed

2017-07-05 Thread Jim Lemon
Oops, that should have been: stretch_df(tadf,"V1","V2") Jim On Thu, Jul 6, 2017 at 8:38 AM, Jim Lemon wrote: > Hi Tom, > Or perhaps: > > #assume the data frame is named "tadf" > library(prettyR) > stretch_df(tadf,1,2) > > Jim > > > On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn wrote: >> The reason

Re: [R] Help with reshape/reshape2 needed

2017-07-05 Thread Jim Lemon
Hi Tom, Or perhaps: #assume the data frame is named "tadf" library(prettyR) stretch_df(tadf,1,2) Jim On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn wrote: > The reason it doesn't work easily with reshape/reshape2 is that the > order of the rows is not determined. Your answer could be > > 1957

Re: [R] Help with reshape/reshape2 needed

2017-07-05 Thread Ista Zahn
The reason it doesn't work easily with reshape/reshape2 is that the order of the rows is not determined. Your answer could be 1957 1958 ... 1985 1986 0.8625000 0.750 ... 0.7307692 0.2375 0.0733945 0.6435644 ...NA 0.05769231 0.5096154NA ...NA 0.6

Re: [R] Help with reshape/reshape2 needed

2017-07-05 Thread Thomas Adams
NANA > > - > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas &

Re: [R] Help with reshape/reshape2 needed

2017-07-05 Thread David L Carlson
:17 PM To: r-help@r-project.org Subject: [R] Help with reshape/reshape2 needed Hi all: I'm struggling with getting my data re-formatted using functions in reshape/reshape2 to get from: 1957 0.86250 1958 0.75000 1959 0.3 1960 0.28750 1963 0.67500 1964 0.93750 19

[R] Help with reshape/reshape2 needed

2017-07-05 Thread Thomas Adams
Hi all: I'm struggling with getting my data re-formatted using functions in reshape/reshape2 to get from: 1957 0.86250 1958 0.75000 1959 0.3 1960 0.28750 1963 0.67500 1964 0.93750 1965 0.02500 1966 0.38750 1969 0.08750 1970 0.27500 1973 0.5 1974

Re: [R] help with reshape

2015-09-09 Thread Ivan Calandra
ra; R list Subject: Re: [R] help with reshape I don't think it is platform or version specific. The purpose of the missing value, NA (i.e. Not Available), is to flag the value for special handling in some way, often by deletion. You cannot assume that NA will be treated as any other value since

Re: [R] help with reshape

2015-09-08 Thread PIKAL Petr
Of David L > Carlson > Sent: Tuesday, September 08, 2015 5:03 PM > To: Ivan Calandra; R list > Subject: Re: [R] help with reshape > > I don't think it is platform or version specific. The purpose of the > missing value, NA (i.e. Not Available), is to flag the value for >

Re: [R] help with reshape

2015-09-08 Thread David L Carlson
2015 9:33 AM To: R list Subject: Re: [R] help with reshape David, It seems that your solution works, but why would that be? And why would this NA behavior be platform or version specific? I really need to check with a newer version of R... Ivan -- Ivan Calandra, PhD University of Reims Cham

Re: [R] help with reshape

2015-09-08 Thread Ivan Calandra
, TX 77840-4352 Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra Sent: Tuesday, September 8, 2015 7:56 AM To: PIKAL Petr; R list Subject: Re: [R] help with reshape Thanks Petr, It looks good, but I have to check in more details. Can anyone he

Re: [R] help with reshape

2015-09-08 Thread David L Carlson
pe(). - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra Sent: Tuesday, September 8, 2015 7:56 AM To: PIKAL

Re: [R] help with reshape

2015-09-08 Thread Ivan Calandra
08, 2015 3:25 PM To: PIKAL Petr; R list Subject: Re: [R] help with reshape I do get only 2 lines: mydata <- structure(list(ID = c(543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 11574, 11575, 11576, 11577, 11578, 11579, 11580, 11581, 11

Re: [R] help with reshape

2015-09-08 Thread PIKAL Petr
result, though. Cheers Petr > -Original Message- > From: Ivan Calandra [mailto:ivan.calan...@univ-reims.fr] > Sent: Tuesday, September 08, 2015 3:25 PM > To: PIKAL Petr; R list > Subject: Re: [R] help with reshape > > I do get only 2 lines: > > mydata <-

Re: [R] help with reshape

2015-09-08 Thread Ivan Calandra
1667, 291.93333333, NA), Moyenne.Ca3158 = c(578.2, 278.8333, NA), Moyenne.Cd2288 = c(0.1514, 0.819, NA), Moyenne.Co2286 = c(NA_real_, NA_real_, NA_real_), Moyenne.Co2378 = c(1.87225, 3.946, NA ), Moyenne.Cr2055 = c(NA_real_, NA_real_, NA_real_), Moyenn

Re: [R] help with reshape

2015-09-08 Thread PIKAL Petr
890 = c(NA, NA, NA, 3.9615), As1937 = c(3.7455, NA, 2.2755, 3.488333), Ca1840 = c(596.1667, NA, 291.9333, 337.4333), Ca3158 = c(578.2, NA, 278.8333, 323.5333), Cd2288 = c(0.1514, NA, 0.819, 0.87716666667), Co2286 = c(NA, NA, NA, 0.2924667),

Re: [R] help with reshape

2015-09-08 Thread Ivan Calandra
ur solution as I use reshape only sparsely. Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra Sent: Tuesday, September 08, 2015 2:18 PM To: R list Subject: Re: [R] help with reshape Thank you Petr, It kinda works, but not comple

Re: [R] help with reshape

2015-09-08 Thread PIKAL Petr
m: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan > Calandra > Sent: Tuesday, September 08, 2015 2:18 PM > To: R list > Subject: Re: [R] help with reshape > > Thank you Petr, > > It kinda works, but not completely. The problem is that it produces a > column

Re: [R] help with reshape

2015-09-08 Thread Ivan Calandra
--Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan Calandra Sent: Tuesday, September 08, 2015 12:33 PM To: R list Subject: [R] help with reshape Dear users, I'm having troubles with reshaping a data.frame from long to wide format. I copy the output of d

Re: [R] help with reshape

2015-09-08 Thread PIKAL Petr
-(1:5)], "_"), "[", 1)), sep=".") names(test)[-(1:5)]<-nn Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ivan > Calandra > Sent: Tuesday, September 08, 2015 12:33 PM > To: R list > Subje

[R] help with reshape

2015-09-08 Thread Ivan Calandra
Dear users, I'm having troubles with reshaping a data.frame from long to wide format. I copy the output of dput() at the end of the mail because it is quite long. Each row of the column "Elem" should be transposed to a new column. All variables "Etape", "Ech", "repet", "dilution", "Rincage" def

Re: [R] help with reshape is needed again!

2010-06-19 Thread xin wei
thank you very much for such a thorough solution! -- View this message in context: http://r.789695.n4.nabble.com/help-with-reshape-is-needed-again-tp2260640p2260943.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] help with reshape is needed again!

2010-06-18 Thread Dennis Murphy
Hi: # Method 1: Transposition and name corrections > dd <- read.table(textConnection(" + gene1 breast 10100 1 + gene2 breast 20200 4 + gene3 breast 3050 5 + gene4 breast 40400 9")) > cl

[R] help with reshape is needed again!

2010-06-18 Thread xin wei
hi, folks: i need to transpose the following data: genetissuepatient1 patient2 patient3. - gene1 breast 10100 1 gene2 breast 20200 4 gene3 breast 3050

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Dana Sevak
To all of you who answered me: Thank you so much! Each approach taught me something new and I really appreciate your help! Best regards, Dana Sevak __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

[R] Help with reshape/reShape and indexing

2009-05-13 Thread Ista Zahn
Hi Dana, > -- Forwarded message -- > From: Dana Sevak > To: r-help@r-project.org > Date: Tue, 12 May 2009 23:02:00 -0700 (PDT) > Subject: [R] Help with reshape/reShape and indexing > > Dear R Helpers, > > I have trouble applying reShape and

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread hadley wickham
> This does it more or less your way: > > ds <- split(df, df$Name) > ds <- lapply(ds, function(x){x$Index <- seq_along(x[,1]); x}) > df2 <- unsplit(ds, df$Name) > tapply(df2$X1, df2[,c("Name", "Index")], function(x) x) > > athough there may exist much easier ways ... Here's one way with the plyr a

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Gabor Grothendieck
Try this: DF$Index <- ave(1:nrow(DF), DF$Name, FUN = seq_along) reshape(DF[-3], dir = "wide", idvar = "Name", timevar = "Index") Also see the reshape package for another similar facility. On Wed, May 13, 2009 at 2:02 AM, Dana Sevak wrote: > > Dear R Helpers, > > I have trouble applying reShap

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Dimitris Rizopoulos
one way is the following: df.index <- df df.index$Index <- ave(seq_along(df$Name), df$Name, FUN = seq_along) df.index df2 <- reshape(df.index[c("Name", "Index", "X1")], timevar = "Index", idvar = "Name", direction = "wide") df2 I hope it helps. Best, Dimitris Dana Sevak wrote: Dear R Hel

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Uwe Ligges
Dana Sevak wrote: Dear R Helpers, I have trouble applying reShape and reshape although I read the documentation and several posts, so I would very much appreciate your help on the two points below. I have a dataframe df = data.frame(Name=c("a", "a", "a", "b", "b", "c"), X1=c("12", "13", "1

[R] Help with reshape/reShape and indexing

2009-05-12 Thread Dana Sevak
Dear R Helpers, I have trouble applying reShape and reshape although I read the documentation and several posts, so I would very much appreciate your help on the two points below. I have a dataframe df = data.frame(Name=c("a", "a", "a", "b", "b", "c"), X1=c("12", "13", "14", "20", "25", "30"

[R] Help with reshape data into long format

2008-01-15 Thread Tom Cohen
Dear list, I have the following data set id 1 2 3 4 5 6 7 8 9 10 disease a b c d e f g h i j age 23 40 32 34 25 32 22 35 29 21 cityNY LD NY SG NY LD VG SA LD SG sex 1 1 2 2 2 2 1 1 1 2 treat_a y y yy treat_b n n