search for: reshaping

Displaying 20 results from an estimated 1251 matches for "reshaping".

Did you mean: escaping
2009 Dec 13
2
Reshape a data set
I am trying to reshape a data set. Could someone please help me with the reshape, cast, and melt functions? I am new to R and I have tried reading up on how to use the reshape package, but I am very confused. Here is an example of what I am trying to do: subject coder score time [1,] 1 1 20 5 [2,] 1 2 30 4 [3,] 2 3 10 10 [4,] 2 2
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? Efficienc...
2009 Jul 10
2
ReShape/cast question - sum of value in table
Hi, I've tried to capture the basics of this problem I'm having. Been working on this for a couple of days and just cannot get past it. As a test of this list software I've attached is a small text file zipped up. I hope it gets through but if it doesn't I'll post the actual text which is only 26 lines. Put it somewhere sensible and change the first line in the code to point
2010 Mar 29
2
Reshaping a data frame with a series of factors and 23 repeated measures
....trt are factors------ Date, Days, Wt are data that are repeated 23 times (wide format). I want to reshape the data such that I have the correct Steer.ID, stocker.trt, Finish.trt identifying all of the repeated measures data in a long format. I am a newbie at R and need to develop the skill in reshaping data, so that I can handle routine problems like described above. Thanks so much in advance for help or advice. Bill -- View this message in context: http://n4.nabble.com/Reshaping-a-data-frame-with-a-series-of-factors-and-23-repeated-measures-tp1695500p1695500.html Sent from the R help mailing...
2012 Dec 13
2
More efficient use of reshape?
...(3:7) specifies the columns in the dataframe that corresponded to the sources (GISS, etc.), though then in the resulting #reshaped dataframe the sources are numbered 1-5, so I have to reassigned their names. In addition, the original dataframe has #additional data columns I do not want and so after reshaping I create another! dataframe with just the columns I need, and #then I have to rename them so that I can keep track of what everything is. Whew! Not the most elegant of code. d<-reshape(clim.data, varying=list(3:7),idvar="date", v.names="anomaly",direction="long")...
2010 Jul 21
2
Issues reshaping data
Hello All, I'm having some trouble reshaping my data from wide to long format. I have tried using both the reshape function and package. Although I haven't worked much with the reshape function, I have found the reshape package useful and intuitive for reshaping data from long to wide format. However, going the other way has me stumped wi...
2008 Dec 29
1
Trouble installing plyr
I want to learn how to use the reshape package. The reshape package is not included in the Ubuntu repositories, so I attempted to install reshape with: install.packages("reshape") This is what I got for output: Warning in install.packages("reshape") : argument 'lib' is missing: using '/home/andy/R/i486-pc-linux-gnu-library/2.7'
2009 May 13
5
Help with reshape/reShape and indexing
Dear R Helpers, I have trouble applying reShape and reshape although I read the documentation and several posts, so I would very much appreciate your help on the two points below. I have a dataframe df = data.frame(Name=c("a", "a", "a", "b", "b", "c"), X1=c("12", "13", "14", "20", "25",
2008 Feb 08
1
reshape question
...2 3 4 into a form like this: sub time x1 x2 1.1 1 1 1 3 1.2 1 2 2 4 2.1 2 1 1 3 2.2 2 2 2 4 3.1 3 1 1 3 3.2 3 2 2 4 4.1 4 1 1 3 4.2 4 2 2 4 5.1 5 1 1 3 5.2 5 2 2 4 using the "reshape" command. But when I try reshaping I don't get the desired structure: > DF.L <- reshape(DF, varying = 2:5, idvar="sub", v.names = c("x1", "x2"), times=c(1,2), direction="long") > library(doBy) > orderBy(~sub, data=DF.L) sub time x1 x2 1.1 1 1 1 2 1.2 1...
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 =
2008 Feb 20
3
reshaping data frame
Dear all, I'm having a few problems trying to reshape a data frame. I tried with reshape{stats} and melt{reshape} but I was missing something. Any help is very welcome. Please find details below: ################################# # data in its original shape: indiv <- rep(c("A","B"),c(10,10)) level.1 <- rpois(20, lambda=3) covar.1 <- rlnorm(20, 3, 1) level.2
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...
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
2007 Nov 24
2
unexpected result from reshape
...ames(d) <- varying d1 <- reshape(d, varying=varying, direction="long") d[,'b.2'] == d1[d1$time==2,'b'] #This is TRUE, as expected ##Try to compare d and d1 now: they look right Any hint on what's wrong here? By now, my workarond is changing variable names before reshaping, than re-assign old variable names back after reshape. Best regards, Antonio, Fabio Di Narzo. > R.version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 6.0 year 2007...
2009 Jan 14
1
reshape, direction=long: "multiple row names not allowed"
Hi all, for some reason I always get stuck spending hours when trying to use reshape or the Reshape package. Heaven knows why. My latest frustration (in 2.7.1, so ignore if this has been fixed): test<-data.frame(matrix(rnorm(42*4),ncol=4),rep(1:21,2),rep(c("a","b"),each=21)) reshape(test,varying=list(colnames(test)[1:4]),direction="long")
2009 Dec 04
0
simple reshape of a large data frame (reshape() runs out of memory)
...a production data frame, I eventually get: Error: cannot allocate vector of size 4.8 Gb The machine is an Intel-based Linux workstation with 4Gb of RAM. Loading the data (from a compressed Rdata file) into a fresh R process makes it grow to about 250Mb which clearly leaves a lot of space for reshaping. So far, I managed to deal with the issue by performing a manual transpose by splitting/merging on VALTYPE: sp <- by(tbl[c(1,2,3,5)], tbl$VALTYPE, function(x) x); tbl <- merge(sp[["TYPE1"]], sp[["TYPE2"]], by = c("ID", "DATE1", "DATE2&quo...
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.f...
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
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") "id" is the student identification number, and "WAVE" takes va...
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