Displaying 20 results from an estimated 3000 matches similar to: "reshape speed improvement?"
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,
2005 Feb 26
1
reshape without timevar argument?
Hi
I have a data.frame with 2 columns. The first column is an ID column.
The other columns are description of the ids. There is more than one
description for each Id.
Want I want to get as a value is a data.frame where each row
corresponds to one ID and has as many columns as different
descriptions.
I have used a very convoluted step, but I'm very convinced there is
an easier way to do
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,
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 Sep 27
2
reshape "Error in data[, timevar] : incorrect number of dimensions"
I have two waves of a survey given to students at various middle
schools and high schools, with student id numbers for each student. I
am having difficulty reshaping the file from long to wide.
My code is below:
library(foreign)
svy <- read.spss("studsur4.SAV")
svy.wide <- reshape(svy, timevar="WAVE", idvar="id", direction="wide")
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
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
2008 Feb 10
2
reshape
Dear colleagues,
I'd like to reshape a datafame in a long format to a wide format, but
I do not quite get what I want. Here is an example of the data I've
have (dat):
sp <- c("a", "a", "a", "a", "b", "b", "b", "c", "d", "d", "d", "d")
tr <- c("A",
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 Jun 17
2
help for reshape function
hi, everyone:
i have a question on the reshape function. i have the following dataset :
gene tissue patient1 patient2 patient3.............
_________________________________________________
gene1 breast 10 20 50
gene2 breast 20 40 60
gene3 breast 100 200 300
which i hope to convert to the following format:
gene patientID
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All,
I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order.
My data have a variable called "RowNo" that functions almost like a
2002 Oct 25
1
reshape: duplicate rows to multiple cols
I have a dataframe that I'm trying to reshape, and need advice. My data:
> klam.merge[200:225,]
stream lulc x sumlength pct.lgth
200 1223030419685 92 0.25000000 9.89 2.52780586
201 1223030419686 23 0.00274154 4.73 0.05796068
202 1223030419686 41 0.75009917 4.73 15.85833341
203 1223030419686 42 2.65000000 4.73 56.02536998
204
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 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",
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 06
1
Reshape question
I have a data frame in wide format. There are six variables that represent two factors in long format 3x2, Valence and Temperature:
> head(dpts)
File Subj Time Group PainNeg.hot PainNeg.warm SociNeg.hot SociNeg.warm Positiv.hot Positiv.warm Errors
1 WB101_1_1_dp.txt 101 1 MNP 30.700000 13.75000 16.319048 35.166667 30.18333 14.383333 1
2
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
2006 Nov 29
2
reshape command is (stats) dropping instances
I would really appreciate it if anyone could determine what is going
on with the following command. It is only half-working and is losing
lots of data. For the life of me I cannot even see the pattern of what
it is losing and what it is not.
I am attaching the R data set which you can use with the Load
Workspace menu function.