similar to: reshape (was: Comparing rows in a dataframe)

Displaying 20 results from an estimated 8000 matches similar to: "reshape (was: Comparing rows in a dataframe)"

2004 Aug 03
2
attach data from tapply to dataframe
I am working with a longitudinal data set in the long format. This data set has three observations per grade level per year. Here are the first 10 rows of the data frame: >tenn.dat[1:10,] year schid type grade gain se new cohort 6 2001 100005 5 4 33.1 3.5 4 3 7 2002 100005 5 4 33.9 3.9 4 2 8 2003 100005 5 4 32.3 4.2 4 1 10 2001 100005
2004 Aug 06
1
Comparing rows in a dataframe
Hello I have a longitudinal dataframe organized in the long format and would like to make comparison between successive rows if certain conditions apply. Specifically, I have four variables of interest: grade, score, year, and schid, associated with each school with 3 measurements per school per grade, therefore the rows are temporally ordered and each school occupies multiple rows. For example,
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 Jan 24
3
Reshaping a dataframe with conditional summary of columns - apply or reshape?
I need to do a somewhat complex rearrangement of an existing dataframe that involves an "on-the-fly" conditional summary as well. I've tried to make the example as simple as possible. Code to produce the object being acted on is at the end of the message. I hope this isn't too much for a single posting. Any guidance will be much appreciated. The input example looks like
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",
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")
2013 Oct 17
1
Reshape
Hello, I have data frame like the one created below, ##input data Person <- c(1,1,1,1,1,1,2,2) Amount <- c(100,10,100,10,100,10,50,150) Date <- c("12/01/2012", "12/01/2012", "01/01/2013","01/01/2013","02/01/2013","02/01/2013","12/01/2012","12/01/2012") df <- data.frame(Person,Amount,Date) I would
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
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
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
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,
2008 Aug 25
3
Maintaining repeated ID numbers when transposing with reshape
I have a dataset in "long" format that looks something like this: ID TEST RESULT 1 A 17 1 A 12 1 B 15 1 C 12 2 B 8 2 B 9 Now what I would like to do is transpose it like so: ID TEST A TEST B TEST C 1 17 15 12 1 12 . . 2
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
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.
2003 Oct 30
1
Trouble reshaping some data
I would appreciate some advice on the following task. I have some data that currently looks like this: t1 <- data.frame(id=c(1,1,2,2), aspect=c("A","B","A","B"), score=c(10,9,11,12)) I'd like it to look like this: id A B 1 10 9 2 11 12 reshape() looks like a good candidate for this job but I'm not really sure about the roles of
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",
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
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
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
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