mitri
> Liakhovitski
> Sent: Thursday, 23 April 2015 23:15
> To: r-help
> Subject: [R] reshape data frame when one column has unequal number of
> entries
>
> Hello!
>
> I have my data frame x with 2 character columns:
>
> x <- data.frame(a = numeric(), b =
f
Maybe you want to remove extra white space form your values. It is mentioned
somewhere in help pages to regular expressions
Cheers
Petr
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri
> Liakhovitski
> Sent: Thursday, April 23,
351
Email: home: mac...@northnet.com.au
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri
Liakhovitski
Sent: Thursday, 23 April 2015 23:15
To: r-help
Subject: [R] reshape data frame when one column has unequal number of
entries
Hello!
I have my
Hello!
I have my data frame x with 2 character columns:
x <- data.frame(a = numeric(), b = I(list()))
x[1:3,"a"] = 1:3
x[[1, "b"]] <- "a, b, c"
x[[2, "b"]] <- "d, e"
x[[3, "b"]] <- "f"
x$a = as.character(x$a)
x$b = as.character(x$b)
x
str(x)
I need to produce this data frame:
1 a
1 b
1 c
2
Thanks, that seems to work.
On Fri, Nov 15, 2013 at 10:26 PM, arun kirshna [via R] <
ml-node+s789695n4680556...@n4.nabble.com> wrote:
> Hi,
>
> Try:
> var1 <- load("reshape_data.frame.RData")
> ##It is better not to name the objects with function names.
> dat1 <- data
> reshape1 <- reshape
> na
Hi,
Try:
var1 <- load("reshape_data.frame.RData")
##It is better not to name the objects with function names.
dat1 <- data
reshape1 <- reshape
names(dat1)[grep("X\\d+",names(dat1))] <-
gsub("[[:alpha:]]","X_",names(dat1)[grep("X\\d+",names(dat1))])
res1 <- reshape(dat1,direction="long",varying=7
Hello,
I implemented two functions reshape_long and reshape_wide (see full working
example below) to reshape data frames.
I created several small examples and the two functions seemed to work
properly. However, using the reshape_wide function
on my real data sets (about 200.000 to 300.000 rows) fa
7 matches
Mail list logo