Displaying 20 results from an estimated 3000 matches similar to: "Reshape and column order"
2005 Oct 31
0
Problem using reshape with missing values in idvar
Hello everybody,
I have been recently using reshape to convert "long" data to "wide"
data. Everything was going well until I reached some problematic
datasets. It has taken me a couple of weeks to finally figure out
what might be happening.
The problem is reproducible with test cases, and on two versions of R
(Windows 2.2.0 and x86-64 Fedora Core 3 R 2.2.0).
The data
2006 May 18
1
reshape question
I am a relative R newbie and I am having trouble with reshape() on R
V1.9.1 on Linux. The same code appears to be ok when run on R V2.2.0 on
Windows and a V2.1 on Linux. Any help would be great as I need to stay
on V1.9 for the immediate future... Thanks, Reid Hutchins
df <- data.frame(state= rep(1:2, each=8), school=rep(1:2,each=4),
class=rep(1:2,each=2),Values2Columns=rep(1:2,
2006 Feb 22
1
unused factor levels in reshape
When reshaping a dataframe in which there are unused factor levels in the id variable, I get the following error:
Error in if (!all(really.constant)) warning(gettextf("some constant variables (%s) are really varying", :
missing value where TRUE/FALSE needed
For example,
> df <- data.frame(i = factor(rep(1:5, each = 2)), t = factor(rep(1:2, 5)), x = rep(rbinom(5, 1,
2009 Dec 09
1
reshape() makes R run out of memory (PR#14121)
Full_Name: Alexander L. Belikoff
Version: 2.8.1
OS: Ubuntu 9.04 (x86_64)
Submission from: (NULL) (67.244.71.200)
I'm trying to reshape the following data frame:
ID DATE1 DATE2 VALUE_TYPE VALUE
'abcd1233' 2009-11-12 2009-12-23 'TYPE1' 123.45
...
VALUE_TYPE is a string and is a factor with only 2 values
2004 Feb 19
1
reshape direction=wide
Hello
I am reshaping a data.frame bids --> reshaped as shown below.
I thought this should be possible with a single invocation of
reshape, but the only way I came up with is reshaping subsets for each
keyword and then joining them together. Does anyone have an idea how to
solve this in a more elegant way? Efficiency is a concern as the datasets
are very large.
Is there a way to specify
2008 Nov 18
1
reshape question
Hi,
It's probably a simple issue but I'm struggling with that. I'll use the
example shown in the help page.
head(Indometh)
wide <- reshape(Indometh, v.names="conc", idvar="Subject",
timevar="time", direction="wide")
head(wide)
reshape(wide, idvar="Subject", varying=list(2:12),
v.names="conc",
2008 May 19
1
reshape a wide data frame from wide to a long format with metadata columns
Hello R users and developers,
I have a general question about reshaping a wide data frame using the
"reshape" command. I have a data frame consisting of 108 columns that
I would like to convert to a long table and remove the metadata
(embedded in the column names of the wide table) to new metadata
columns in the long format.
#example data frame. NOTE column names contain metadata::
2009 Sep 14
2
problems with reshape
Hello *
I would like to reshape wide the following dataset:
> rl <- read.dta("intermedi/rapporti_lavoro.dta") [c("id_rl","prog","sil_pi","sil_cf","sil_dat_avv")]
> dim(rl)
[1] 12964 5
> object.size(rl)
1194728 bytes
> head(rl)
id_rl prog sil_pi sil_cf sil_dat_avv
1 638 1 04567XXXXXX
2002 Oct 16
1
documentation: Missing paranthesis in reshape.Rd (PR#2170)
Full_Name: Michale Na Li
Version: 1.6.0
OS: i386-linux
Submission from: (NULL) (140.142.172.141)
In src/library/base/man/reshape.Rd, one paranthesis is missing, here is the
patch.
*** reshape.Rd.old 2002-10-15 23:32:25.000000000 -0700
--- reshape.Rd 2002-10-15 23:32:35.000000000 -0700
***************
*** 12,18 ****
idvar = "id", ids = 1:NROW(data),
times =
2007 Mar 01
0
Reshape data
I have two data frames with a number of common variables that I wish to put into "long format".
The first contains the variables
es(Csales)
[1] "terr" "Dec.02" "Jan.03" "Feb.03" "Mar.03" "Apr.03" "May.03" "Jun.03"
[9] "Jul.03" "Aug.03" "Sep.03" "Oct.03"
2004 Aug 06
1
reshape (was: Comparing rows in a dataframe)
Hi all:
I solved the previous stated problem in something of a brute force way
(but it works). I seem to now be running into one little hiccup using
reshape. Here is a quick snip of the data in long format:
grade stability year schid
6 Grade 4 3 2001 100005
7 Grade 4 3 2002 100005
8 Grade 4 2 2003 100005
10 Grade 5 2 2001 100005
11 Grade 5
2009 Mar 31
2
'sep' argument in reshape()
I wonder if the 'sep' argument in reshape() is being ignored
unintentionally:
## From example(reshape)
df <- data.frame(id=rep(1:4,rep(2,4)),
visit=I(rep(c("Before","After"),4)),
x=rnorm(4), y=runif(4))
reshape(df, timevar="visit", idvar="id", direction="wide", sep = "_")
id x.Before
2010 Jan 28
1
question about reshape
Hello everyone,
I have a bit of a problem with reshape function in R.
I have simulated some normal data, which I have saved in 4 vectors.
y.1,y.2,y.3,y.4 which I combined a dataset:
dataset<cbind(y1,y2,y3,y4). I have also generated some subject id number,
and denoted that by subject.
So, my dataset looks like this:
subject y.1 y.2 y.3 y.4
[1,] 1 20.302707
2008 Feb 08
1
reshape question
I know there are a lot of reshape questions on the mailing list, but I
haven't been able to find an answer to this particular issue.
I am trying to get a datafame structured like this:
> sub <- rep(1:5)
> ta1 <- rep(1,5)
> ta2 <- rep(2,5)
> tb1<- rep(3,5)
> tb2 <- rep(4,5)
> DF <- data.frame(sub,ta1,ta2,tb1,tb2)
> DF
sub ta1 ta2 tb1 tb2
1
2001 Dec 27
3
reshape error in 1.4 (PR#1231)
Full_Name: Kevin Wright
Version: 1.4
OS: Windows 95
Submission from: (NULL) (170.54.59.160)
Note: This was the 1.4 build for Windows that Brian Ripley made available.
The first example in the help for reshape doesn't work for me. When I cut and
paste, this is what happens:
> data(Indometh,package="nls")
> summary(Indometh)
Subject time conc
2012 Oct 17
1
Comparing dcast and reshape
I'm in the middle of my own little intellectual exercise comparing
dcast() and reshape() and have successfully stumped myself. I want to
melt() a data frame, then dcast() it into a new form. After doing so, I
want to duplicate the process using reshape().
So far, I can do the melt and cast
require(reshape2)
Raw <- data.frame(site = c(1, 1, 1, 1, 2, 2, 2, 2),
id =
2009 Dec 04
0
simple reshape of a large data frame (reshape() runs out of memory)
Hello everyone,
I'm having a problem performing reshape() on a large data frame. The
operation is fairly trivial but it makes R run out of memory.
The data frame has the following structure:
ID DATE1 DATE2 VALTYPE
VALUE
'abcd1233' 2009-11-12 2009-12-23 'TYPE1'
123.45
...
VALTYPE is a string and is a factor with
2012 Mar 19
2
Reshape from long to wide
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
data, I have the length of two fish from each family. My data table (called
2005 Jan 26
2
reshape (a better way)
Hi,
I am using the NLSY79 data (longitudinal data from the Bureau of labour
stats in the US). The extractor exctracts this data in a "wide" format and
I need to reshape it into a long format.
What I am doing right now is to do it in chuncks for each and evry
variable that is varying and then I merge the data together. This is
taking a long time. my question is:
How do I specify that
2010 Oct 07
3
reshape from wide to long, ordering of "varying"
Hello,
I have data in the following form
age sex Int.Prev.Est.1 Int.Prev.Est.2 Int.Prev.Est.3
Int.Prev.Est.4 Int.Prev.Est.5
93110 93 0 23.75482 57.86592 9.755003
4.343534 4.280714
93610 93 1 53.36475 39.47247 4.381618
1.622119 1.159044
94110 94 0 23.47514 58.23936 10.789339
3.690415 3.805741
94610 94 1