Hi Arun,
The second method is indeed working much faster. It worked fast for my
600.000 row record.
Still I have 2 bigger files where processing becomes an issue even though I
have lots of memory (32 gig) for the second statement:
res2<-reshape(dat2,idvar="newCol",varying=list(2:26),direction="lon
peed things up would be
good. How would I do it?
I think splitting the dataframe before merging it might also be an option and
after that combining them, any ideas on that?
Regards Dirk
- Original Message -
From: arun
To: R help
Cc:
Sent: Wednesday, August 14, 2013 10:39 AM
Subj
ctors=FALSE)
}))
res1$ID<- row.names(res1)
res2<-res1[,c(4,1:3)]
})
# user system elapsed
#166.452 15.752 182.643
nrow(dat2)-nrow(dat2New)
#[1] 33
You might also try library(data.table). Should be faster..
A.K.
----- Original Message -
From: Dark
To: r-help@r-project
Hi A.K,
Thanks for your great help.
I'm now running your first suggestion on a 600.000 row sample after
verifying it works on a smaller sample.
It's now been running for 40 minutes.
Which method do you think will be faster?
Regards Derk
--
View this message in context:
http://r.789695.n4.nab
haracter)
res5<-res4[,c(5,1,3,4)]
colnames(res5)[3]<-"CODE"
identical(res5,Out1)
#[1] TRUE
A.K.
A.K.
- Original Message -
From: arun
To: R help
Cc:
Sent: Tuesday, August 13, 2013 2:45 PM
Subject: Re: [R] Create rows for columns in dataframe
According to your first
2 10005 78900 FALSE
#3 3 10005 V1251 FALSE
#4 4 10005 V454 FALSE
#5 5 10203 45341 TRUE
#6 6 10203 4019 FALSE
head(Out1)
# ID DSYSRTKY CODE PRIMAIRY
#1 1 100000005 71535 TRUE
#2 2 10005 78900 FALSE
#3 3 10005 V1251 FALSE
#4 4 10005
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", "3
TRUE
A.K.
- Original Message -
From: Dark
To: r-help@r-project.org
Cc:
Sent: Tuesday, August 13, 2013 5:46 AM
Subject: [R] Create rows for columns in dataframe
Hi experts,
I have a dataframe with 100k+ records. it has a key/id column and 25 code
columns. I would like to restructure it ha
Hi experts,
I have a dataframe with 100k+ records. it has a key/id column and 25 code
columns. I would like to restructure it having a row for each code column.
I have a structure like this (used dput):
structure(list(DSYSRTKY = structure(c(1L, 2L, 3L, 3L, 4L, 4L), .Names =
c("1",
"2", "3", "4",
9 matches
Mail list logo