search for: acast

Displaying 20 results from an estimated 22 matches for "acast".

Did you mean: cast
2011 Feb 26
1
Transform a dataset from long to wide using reshape2
...ot;Item 1" 1 "Subject 1" "Item 2" 0 "Subject 1" "Item 3" 1 "Subject 2" "Item 1" 1 "Subject 2" "Item 2" 1 "Subject 2" "Item 3" 0'), header=TRUE) closeAllConnections() acast(dat, Subject~Item) # Seems fine =====================My attemp=========================== # set.seed(1) mydata <- data.frame( x=sample(LETTERS[23:26],100, replace=TRUE), y=rnorm(100, mean=2), id=sample(letters[1:4], 100, replace=TRUE)) acast(mydata , id ~ x) # not so fine =========...
2010 Nov 01
2
transforming a dataset for association analysis RESHAPE2
I get the following message when using the reshape2 package line > tDat.m<- melt(Dataset) Using Item, Subject as id variables > tDatCast<- acast(tDat.m,Subject~Item) Aggregation function missing: defaulting to length Note Problem Statement- convert dataframe Subject Item Score 1 Subject 1 Item 1 1 2 Subject 1 Item 2 0 3 Subject 1 Item 3 1 4 Subject 2 Item 1 1 5 Subject 2 Item 2 1 6 Subject 2 Item 3 0 to S...
2017 Jul 03
3
reshaping the data
Dear all, I would appreciate please a piece of help regarding the use of acast/dcast functions in reshape2 package. Specifically, I'm working with a data frame, that has information about SAMPLE, GENE, and TYPE of MUTATION (as shown below): Sample Gene Type 22M AEBP1 SNV 17M AEBP1 SNV 22M ATR INDEL 22M ATR SNV 11M BTK SN...
2011 Aug 02
2
Data frame to matrix - revisited
Hi, I've tried to look through all the previous related Threads/posts but can't find a solution to what's probably a simple question. ? I have a data frame comprised of three columns e.g.: ? ID1?ID2?Value a?b?1 b?d?1 c?a?2 c?e?1 d?a?1 e?d?2 ? I'd like to convert the data to a matrix i.e.: ? ?a b c d e a n/a 1 2 1 n/a b 1 n/a n/a 1 n/a? c 2 n/a n/a n/a 1 d 1 1 n/a n/a 2 e n/a n/a 1
2011 Oct 18
9
readRDS and saveRDS
Hi all, Is there any chance that readRDS and saveRDS might one day become read.rds and write.rds? That would make them more consistent with the other reading and writing functions. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
2012 Jul 24
3
Simple reshape problem I am completely missing
...us but what? I have a simple three column data.frame that I would like to reshape to wide preferably using reshape2. An example from http://stackoverflow.com/questions/9617348/reshape-three-column-data-frame-to-matrix looked perfect except I wanted a data frame but it seemed okay. I just changed acast to dcast and it seems fine. Stackoverflow example: tmp <- data.frame(x=gl(2,3, labels=letters[24:25]), y=gl(3,1,6, labels=letters[1:3]), z=c(1,2,3,3,3,2)) dd <- dcast(tmp, x~y, value.var="z") My Example: Does NOT work md2 <- structure(l...
2010 Oct 01
3
scoping goes wrong when some functions are used within others.
...d-functions-in-r-2-11-1-whats-going-wrong Links to different reports, all having that same pattern but with different functions : http://stackoverflow.com/questions/3742415/r-statistical-scoping-error-using-transformby-part-of-the-doby-package http://stackoverflow.com/questions/3768417/how-to-use-acast-reshape2-within-a-function-in-r http://stackoverflow.com/questions/3661500/why-cant-i-pass-a-dataset-to-a-function http://stackoverflow.com/questions/3574858/values-not-being-copied-to-the-next-local-environment http://stackoverflow.com/questions/2646402/using-functions-and-environments -- Joris...
2011 Apr 09
5
Yearly aggregates and matrices
Hi, I need to perform calculations on subsets of a data frame: DF = data.frame(read.table(textConnection(" A B C D E F 1 a 1995 0 4 1 2 a 1997 1 1 3 3 b 1995 3 7 0 4 b 1996 1 2 3 5 b 1997 1 2 3 6 b 1998 6 0 0 7 b 1999 3 7 0 8 c 1997 1 2 3 9 c 1998 1 2 3 10 c 1999 6 0 0 11 d 1999 3 7 0 12 e 1995 1 2 3 13 e 1998 1 2 3 14 e 1999 6
2017 Jul 03
0
reshaping the data
...: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Bogdan > Tanasa > Sent: Monday, July 3, 2017 9:22 AM > To: r-help <r-help at r-project.org> > Subject: [R] reshaping the data > > Dear all, > > I would appreciate please a piece of help regarding the use of acast/dcast > functions in reshape2 package. > > Specifically, I'm working with a data frame, that has information about > SAMPLE, GENE, and TYPE of MUTATION (as shown below): > > Sample Gene Type > 22M AEBP1 SNV > 17M AEBP1 SNV > 22M ATR INDEL...
2011 Aug 08
1
Reshape2 sytax
Hi Hadley et all, I am struggling with reshape2 and melt works and melt_check (filtered151) seems fine My cast command was acast (filtered151, Time ~ Species ~ Number) > melt_check (filtered151) Using time, Species as id variables $id [1] "time" "Species" $measure [1] "Number" When I execute cast the data matrix is in the correct order but the data values are not included. Clearly I a...
2010 Oct 30
2
transforming a dataset for association analysis
Hi I would like to transform a data frame like Subject Item Score Subject 1 Item 1 1 Subject 1 Item 2 0 Subject 1 Item 3 1 Subject 2 Item 1 1 Subject 2 Item 2 1 Subject 2 Item 3 0 .... *to * Subject Item1 Item2 Item3 .....Item N Subject1 1 0 1 Subject2 1 1 0 ........ SubjectP.. Apologize for the simple nature of my query but I am stuck.
2010 Sep 10
0
reshape2: a reboot of the reshape package
...more memory efficient thanks to a much better underlying algorithm that uses the power and speed of subsetting to the fullest extent, in most cases only making a single copy of the data. * cast is replaced by two functions depending on the output type: `dcast` produces data frames, and `acast` produces matrices/arrays. * multidimensional margins are now possible: `grand_row` and `grand_col` have been dropped: now the name of the margin refers to the variable that has its value set to (all). * some features have been removed such as the `|` cast operator, and the ability to...
2011 Jan 04
0
reshape2 1.1
...more memory efficient thanks to a much better underlying algorithm that uses the power and speed of subsetting to the fullest extent, in most cases only making a single copy of the data. * cast is replaced by two functions depending on the output type: `dcast` produces data frames, and `acast` produces matrices/arrays. * multidimensional margins are now possible: `grand_row` and `grand_col` have been dropped: now the name of the margin refers to the variable that has its value set to (all). * some features have been removed such as the `|` cast operator, and the ability to...
2010 Sep 10
0
reshape2: a reboot of the reshape package
...more memory efficient thanks to a much better underlying algorithm that uses the power and speed of subsetting to the fullest extent, in most cases only making a single copy of the data. * cast is replaced by two functions depending on the output type: `dcast` produces data frames, and `acast` produces matrices/arrays. * multidimensional margins are now possible: `grand_row` and `grand_col` have been dropped: now the name of the margin refers to the variable that has its value set to (all). * some features have been removed such as the `|` cast operator, and the ability to...
2011 Jan 04
0
reshape2 1.1
...more memory efficient thanks to a much better underlying algorithm that uses the power and speed of subsetting to the fullest extent, in most cases only making a single copy of the data. * cast is replaced by two functions depending on the output type: `dcast` produces data frames, and `acast` produces matrices/arrays. * multidimensional margins are now possible: `grand_row` and `grand_col` have been dropped: now the name of the margin refers to the variable that has its value set to (all). * some features have been removed such as the `|` cast operator, and the ability to...
2010 Oct 10
2
Help reading table rows into lists
Hi all, I have a large table mapping thousands of COGs(groups of genes) to pathways. # Ex COG0001 patha pathb pathc COG0002 pathd pathe COG0003 pathe pathf pathg pathh ## I would like to combine this information into a big list such as below COG2PATHWAY<- list (COG0001 = c ("patha ","pathb ","pathc
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi, I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before. What I did/want to do: 1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far: dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE) 2) Recast the
2011 Nov 19
3
reshape data.frame
A late friday afternoon coding question. I'm having a hard time thinking of the correct search terms for what I want to do. If I have a df like this: a <- data.frame(name=c(rep('a',10),rep('b',15)),year=c(1971:1980,1971:1985),amount=1:25) name year amount 1 a 1971 1 2 a 1972 2 3 a 1973 3 4 a 1974 4 5 a 1975 5 6 a 1976
2011 Jan 13
0
Help with Data Transformation - RESOLVED
...nce. Executed your toy script (stepwise so as not to include the output as input) Received the following result at the end: > cast(df, idnum ~ lab, value = 'y') Error: could not find function "cast" The Package 'reshape2' documentation indicates that either acast() or dcast() are used, not giving an example of cast() itself. I resolved this by trying both acast() and dcast(). Both yielded the same screen results. Turning to my own data I was able to successfully execute the operation on one of my subsets AFTER, cleaning up some results with duplicates &qu...
2013 Jun 05
2
reshape2 issue continued
Hi again all, Several replied ASAP that I also needed reshape loaded and not just reshape2. Hmmm tried that and I had some output but not the correct format. What I need is to run simulations of time overlap between species as per the simulation program data input constraints: The basis for the simulations is a species by _time-use matrix in which species are arranged in rows, and time