Thanks a lot,
I tried one of the ways you guys showed me and it totally work. Just for
fun, I tried all the others and with some modifications here and there they
work fine too. It was time consuming but definitely worth as a good learning
experience. Thanks again
--
View this message in context
])
Cheers,Tyler
> From: jorgeivanve...@gmail.com
> Date: Tue, 20 Mar 2012 00:29:08 -0400
> To: alyaba...@gmail.com
> CC: r-help@r-project.org
> Subject: Re: [R] Reshape from long to wide
>
> Hi aly,
>
> Try
>
> # your data
> x <- structure(list(family = c(14L, 1
On Mon, Mar 19, 2012 at 7:01 PM, aly wrote:
>
> Hi,
>
> I'm a total beginner in R and this question is probably very simple but I've
> spent hours reading about it and can't find the answer. I'm trying to
> reshape a data table from long to wide format. I've tried reshape() and
> cast() but I get
Hi aly,
Try
# your data
x <- structure(list(family = c(14L, 14L, 15L, 15L, 17L, 17L, 18L,
18L, 20L, 20L, 24L, 24L, 25L, 25L, 27L, 27L, 28L, 28L, 29L, 29L
), length = c(18L, 7L, 7L, 21L, 50L, 21L, 36L, 21L, 36L, 42L,
56L, 42L, 43L, 56L, 15L, 42L, 7L, 42L, 56L, 49L)), .Names = c("family",
"length")
Hi,
I'm a total beginner in R and this question is probably very simple but I've
spent hours reading about it and can't find the answer. I'm trying to
reshape a data table from long to wide format. I've tried reshape() and
cast() but I get error messages every time and I can't figure why. In my
da
Thanks, Josh!
The index variable (time) was my problem. My R skills are too low! :)
Problem solved!
--
View this message in context:
http://r.789695.n4.nabble.com/Reshape-from-long-to-wide-format-with-date-variable-tp3648833p3650995.html
Sent from the R help mailing list archive at Nabble.com.
Hi:
Here's one way with the reshape package. I converted ref to numeric
and date to character string first. Sometimes these little things
matter...
library(plyr)
library(reshape)
# Modified original data; note the option in the data.frame() statement
id=c("034","034","016","016","016","340","340
Hi Pete,
Try the reshape function (see ?reshape for documentation). It can be
a bit confusing, but its worth learning if you deal with multiple
observations per unit much. Code inline does what you want (though
you might need a bit of tweaking to get pretty names, etc.
HTH,
Josh
On Wed, Jul 6
Hi,
I need to reshape my dataframe from a long format to a wide format.
Unfortunately, I have a continuous date variable which gives me headaches.
Consider the following example:
> id=c("034","034","016","016","016","340","340")
> date=as.Date(c("1997-09-28", "1997-10-06", "1997-11-04", "2000-09-
9 matches
Mail list logo