similar to: reshape() to wide with varying number of responses to fields

Displaying 20 results from an estimated 10000 matches similar to: "reshape() to wide with varying number of responses to fields"

2009 Apr 07
2
Using as.formula() with the reshape package cast
I am trying to use the "cast" function from the reshape package, where the formula is not passed in directly, but as the result of the as.formula() function. Using reshape v. 0.7.2 I am able to properly melt() by data with: > molten <- melt(x, id=1:2) then I can properly cast with this: > cast(molten, days ~ variable) but if I try > cast(molten,
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
2009 Aug 17
3
Reshape package: Casting data to form a grid
Dear R Users, I'm trying to use the 'cast' function in the 'reshape' package to convert column-format data to gridded-format data. A sample of my dataset is as follows: head(finalframe) Latitude Longitude Temperature OrigLat p-value Blaney 1 -90 -38.75 NA -87.75 17.10167 NA 2 -90 135.75 NA -87.75 17.10167 NA 3 -90 80.25
2008 Feb 15
2
For Subset or Reshaping the Table
Hi R users I am a new user in the field of R. I want to subset or reshape a data.frame. For example I have a matrix like A B C D E F G a 1 2 3 4 5 6 7 b 4 6 8 9 5 5 6 c 3 4 4 4 3 3 6 d 1 2 4 6 8 8 9 e 5 6 7 8 9 2 3 I want to reshape the matrix in this format Row Col Value a D 4 a E 5 a F 6 . . ..
2010 Apr 19
1
Formatting data, adding column names, use reshape, a newbie question
Hi all, I'm an R novice. I have data that's already formatted as "molten" that reshape should be able to work with. For example, the following was read in with read.csv(filename,sep=" ", header=FALSE) V1 V2 V3 V4 V5 1 original book book.source1.txt 328900494 3039.525 2 original book book.source1.txt
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::
2011 May 31
1
reshape::cast: invalid 'yinds' argument
Hi, I'm using reshape to cast molten data. When I use the following command, R either crashes (when I use Notepad++) or gives an error (when I use Rgui or source()), BUT the error occurs not always, maybe only on half the attempts: w <- cast(v, id + code + productname + year + begin + end + specificDesc + specificDesc2 ~ type) Error in merge.data.frame(data, all.combinations, by =
2004 Nov 28
1
Could anyone help me reshape this "wide" data into "longitudinal" one? Thanks
Dear R people, I have a matrix like this: var1 var2 var3 var4 a1 7.1 7.2 8.1 8.2 a2 10.5 10.6 ... ... a3 b1 b2 b3 b4 c1 c2 ... The matrix row names are "a1", "a2", ...... and the matrix column names are "var1", "var2", "var3" and "var4". Now I want to reshape this data into a
2009 Jan 26
1
reshape problem: id and variable names not being recognized
Hi everyone. Long time listener, first-time caller here. I have a data set that's been melted with the excellent reshape package, but I can't seem to cast it the way I need to. Here's the melted data's structure: > str(mdat) 'data.frame': 6978 obs. of 4 variables: $ VehType : Factor w/ 2 levels "Car","Truck": 1 1 2 1 1 2 1 1 1 1 ... $ Year :
2009 Nov 23
1
recognizing variable-names of cast() (package: reshape)
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091123/3b4cbdd5/attachment-0001.pl>
2009 Mar 31
1
Reshape: 'melt' numerous objects
Dear R Users, I'm trying to use the reshape package to 'melt' my gridded data into column format. I've done this before on individual files, but this time I'm trying to do it on a directory of files (with variable file names) - therefore I have to also use the 'assign' command. I have come up against a couple of problems however and am therefore seeking advice... >
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
2008 Feb 07
1
Help with package reshape, wide to long
Hello, I am having difficulty figuring out how to use functions in the reshape package to perform a wide to long transformation I have a "wide" dataframe whose columns are like this example: id1 id2 subject treat height weight age id1 and id2 are unique for each row subject and treat are not unique for each row height, weight, and age are different types of measurements made on
2009 Feb 25
2
reshape from wide to long
Hi,I would like to reshape the following "wide" data set to "long" form. I would appreciate help with the correct code for "reshape". I tried a few unsuccessfully. Thanks. Chetty __________________________________________________ dat.1 Grp X0 X3 X6 X12 X25 X501 C 0.5326517 0.6930942 0.9403883 1.157571
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
2011 Jul 06
3
Reshape from long to wide format with date variable
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",
2006 Nov 06
7
Colour-coded Editor for R Code
Do any of you know any simple programming editors for R scripts which offer basic colour-coding and bracket-matching facilities? Dregging through scripts to find a missing comma or parentheses is something I'd rather do less of... Jon Minton [[alternative HTML version deleted]]
2011 Mar 15
3
how to reshape the data.frame from long to wide in a specific order
Hi, For example, the data.frame like: origdata.long <- read.table(header=T, con <- textConnection(' subject sex condition measurement 1 M control 7.9 1 M first 12.3 1 M second 10.7 2 F control 6.3 2 F first 10.6 2 F second 11.1 3 F control 9.5 3
2011 Nov 29
2
Help with recast() syntax
Dear Help-Rs,   I have data similar to the following:   DF <- structure(list(X = 1:22, RESULT = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("NEG", "POS"), class = "factor"), YR_MO = c(201011L, 201012L, 201101L, 201102L, 201103L, 201104L, 201105L, 201106L, 201107L, 201108L, 201109L, 201011L,
2008 Nov 25
2
Reshape matrix from wide to long format
I forgot the reshape equivalent for converting from wide to long format. Can someone help as my matrix is very big. The followin is just an example. > m <- matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) > m a b c d e A 1 5 9 13 17 B 2 6 10 14 18 C 3 7 11 15 19 D 4 8 12 16 20 > as.data.frame(cbind(rep(rownames(m), ncol(m)), rep(colnames(m), each=nrow(m)),