Displaying 20 results from an estimated 10000 matches similar to: "reshape2 issue continued"
2013 Jun 05
1
reshape2 issue solved Tnx!
Hi again all,
As the original code lines I had dated back to 2007 that may have
predated reshape2?
In any case the use of *dcast *rather than /*cast*/ solved the issue.
Then with 3 steps:
Stop
read
Think
I saw I just needed to change the line
input.cast <- cast(input.melt, Species ~ *Date*, fun.aggregate = sum)
to
input.cast <- cast(input.melt, Species ~ *Time*, fun.aggregate = sum)
2012 Dec 28
3
Merging data tables
Hi all,
I am trying to merge several data sets and end up with a long data
format by date & time so I can run correlations and plots. I am using
Deducer as an R GUI but can just use the R console if easier.
The data sets are weather with wind speed, relative humidity and
temperatures by date and minute and bat activity with date, time, label,
and an activity index number. The bat
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
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 Dec 23
2
cast in reshape and reshape2
> library(reshape2)
> x = melt(airquality, id=c('month', 'day'))
With reshape I can cast with multiple functions:
> library(reshape)
> cast(x, month+variable~., c(mean,sd))
month variable mean sd
1 5 ozone 23.615385 22.224449
2 5 solar.r 181.296296 115.075499
3 5 wind 11.622581 3.531450
4 5 temp 65.548387
2010 Oct 04
3
can't find and install reshape2??
Hi everyone,
I’m trying to install reshape2.
But when I click on “install package” it’s not coming up!?!?! I’m getting
reshape, but no reshape2?
I’ve also tried download.packages(reshape2, destdir="c:\\") &
download.packages(Reshape2, destdir="c:\\")…but no luck!!!
Does anyone have any ideas what could be going on?
Chris Howden
Founding Partner
Tricky
2017 Jul 05
4
Help with reshape/reshape2 needed
Hi all:
I'm struggling with getting my data re-formatted using functions in
reshape/reshape2 to get from:
1957 0.862500000
1958 0.750000000
1959 0.300000000
1960 0.287500000
1963 0.675000000
1964 0.937500000
1965 0.025000000
1966 0.387500000
1969 0.087500000
1970 0.275000000
1973 0.500000000
1974 0.362500000
1976 0.925000000
1978 0.712500000
1979 0.337500000
1980 0.700000000
1981 0.425000000
2018 Apr 17
2
iterative read - write
Hi all,
I would like to set up an iterative read & write sequence to avoid
reading and writing each file one at a time.
Hundreds of data sets to re-calculate.? The code I have works well
individually, but would like to set up an iterative read, calculate and
write changing the input and output file names each iteration.
I? think I have read that there is an R? feature using
2017 Jul 05
0
Help with reshape/reshape2 needed
This does not use reshape/reshape2, but it is pretty straightforward. Assuming X is your example data:
> Y <- split(X[, 2], X[, 1])
> vals <- sapply(Y, length)
> pad <- max(vals) - vals
> Y2 <- lapply(seq_along(Y), function(x) c(Y[[x]], rep(NA, pad[x])))
> names(Y2) <- names(Y)
> X2 <- do.call(cbind, Y2)
> X2[, 1:6]
1957 1958 1959
2013 Jan 22
4
Simple use of dcast (reshape2 package)
Suppose I have a small dataframe
> aa
Target Eaten ID
50 TPP 0 1
51 TPP 1 2
52 TPP 3 3
53 TPP 1 4
54 TPP 2 5
50.1 GPA 9 1
51.1 GPA 11 2
52.1 GPA 8 3
53.1 GPA 8 4
54.1 GPA 10 5
And I want to reshape it into
ID TPP GPA
1 1 0 9
2 2 1 11
3 3 3 8
4 4 1 8
5 5 2 10
I realise that
2017 Jul 05
0
Help with reshape/reshape2 needed
The reason it doesn't work easily with reshape/reshape2 is that the
order of the rows is not determined. Your answer could be
1957 1958 ... 1985 1986
0.8625000 0.7500000 ... 0.7307692 0.23750000
0.0733945 0.6435644 ... NA 0.05769231
0.5096154 NA ... NA 0.65137615
or
1957 1958 ... 1985 1986
0.0733945 0.6435644 ... NA
2010 Sep 13
1
Problems with reshape2 on Mac
Hi!
I updated to reshape2 yesterday and tried to make it work. Unfortunately, it mainly throws error messages at me (good thing it's reshape2 1.0 and not reshape 2.0). The most recent is:
Error in match.fun(FUN) : object 'id' not found
When I manually create an object 'id', it says:
Error in get(as.character(FUN), mode = "function", envir = envir) :
object
2009 Apr 26
6
Memory issues in R
How do people deal with R and memory issues?
I have tried using gc() to see how much memory is used at each step.
Scanned Crawley R-Book and all other R books I have available and the FAQ
on-line but no help really found.
Running WinXP Pro (32 bit) with 4 GB RAM.
One SATA drive pair is in RAID 0 configuration with 10000 MB allocated as
virtual memory.
I do have another machine
2013 Apr 20
7
Reshape or Plyr?
H all,
I have relative abundance data from >100 sites. This is from acoustic
monitoring and usually the data is for 2-3 nights but in some cases my
be longer like months or years for each location..
The data output from my management data base is proved by species by
night for each location so data frame would look like this below. What I
need to do is sum the Survey_time by Spec_Code for
2017 Jul 05
1
Help with reshape/reshape2 needed
Hi Tom,
Or perhaps:
#assume the data frame is named "tadf"
library(prettyR)
stretch_df(tadf,1,2)
Jim
On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn <istazahn at gmail.com> wrote:
> The reason it doesn't work easily with reshape/reshape2 is that the
> order of the rows is not determined. Your answer could be
>
> 1957 1958 ... 1985 1986
>
2013 Jun 26
1
Margins in dcast (reshape2)
Hi,
I'd like to get mean values for the margins of my casted data.frame.
For the casting I am using dcast() from reshape2. However, when I set
the margins parameter (margins=c("grand\_row")) I get following error
concerning
an unrecognized escape character '\_'. So what is the correct command
to get the outermost margins only in reshape2?
/johannes
[[alternative HTML
2011 Feb 26
1
Transform a dataset from long to wide using reshape2
I seem to be running into the same problem reported in
https://stat.ethz.ch/pipermail/r-help/2010-November/258265.html
I cannot seem to transform a dataset from long to wide using reshape2.
Clearly I am missing something very simple but a look at the manual and the reshape paper in JSS does not suggest anything.
Any advice would be welcome
===========================load
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
2011 Aug 08
1
Help on reshape2 data frame rearrangement
Dear help list: I am trying to reshape a data frame from long to wide format and with a reduced variable list using reshape2. The original data frame format is: Site Obs_no LengthSite 1 Obs 1 10Site 1 Obs 2 13Site 1 Obs 3 14.........Site 2 Obs 1 5Site 2 Obs 2 7Site 2 Obs 3 9 Site and Obs_no are factors and Length is a numeric variable. There are 15
2013 Jan 04
3
help "reshaping" dataframe
List,
I want to reshape my data, but I'm not sure how to do it... it might be a
simple task, but don't know which package does this.
"occ.data" (see below) is how my original data are arranged, and I know
that with melt() I can reshape it like "y" (see below). However, I just
want to build a matrix like the "y" matrix, but with only 2 dimensions.
Something