search for: unstacked

Displaying 20 results from an estimated 57 matches for "unstacked".

Did you mean: stacked
2009 Nov 15
1
Help with unstack() function
...o R that I have absolutely no clue as to what is to be done each of those times. Sadly for me, the help page for unstack() does not give much help either. For example, the statement in the help page regarding the argument form, "a two-sided formula whose left side evaluates to the vector to be unstacked and whose right side evaluates to the indicator of the groups to create" is very cryptic to me. Basically, I have tried things like: unstack(Rabbit, Dose ~ Animal) but notice that what I get is a data frame in which other columns of the Rabbit data frame disappear. I would appreciate if som...
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
.... Can one of you try to explain this to me? Here's my example. Given a regression model and a variable, I want to use unstack() on the vector of residuals and make some magic with the result. But unstack hates me. PCSE <- function (tmodel,groupVar) { myres1 <- resid(tmodel) resUnstacked <- unstack(myres1, form = myres1 ~ groupVar)); E <- as.matrix(resUnstacked) SIGMA <- (1/nrow(E))*(t(E) %*% E) OMEGA <- diag(x=1, nrow=nrow(E), ncol=nrow(E)) %x% SIGMA X <- model.matrix(tmodel) XPRIMEXINV <- solve(t(X) %*% X) PCSECOVB <- XPRIMEXINV %*% (t(X) %*% OM...
2011 Mar 12
1
Column order in stacking/unstacking
...2 X2 8 3 X2 9 4 X2 10 5 X2 11 1 X10 12 2 X10 13 3 X10 14 4 X10 15 5 X10 But the problem I have comes in unstacking, when the order of the columns is changed from the original, to something alphabetical (i.e. X10 goes before X2): > unstacked <- unstack(stacked) > unstacked X1 X10 X2 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 Maintaining the order of columns is very important for me, as I'm dealing with spatial data. Is there a way of modifying the 'form' argument in unstack to maintain n...
2010 Oct 18
1
questions on unstack()
Folks, I have the following dataframe: > x <- structure(list(name = c("EU B", "EU B", "EU B", "EU B", "EU B", "EU B", "AU A", "AU A", "AU A", "AU A", "AU A", "AU A"), date = c("2010-10-11", "2010-10-12", "2010-10-13",
2016 Jun 27
1
stack problem
One would normally want the original order that so that one can stack a list, operate on the result and then unstack it back with the unstacked result having the same ordering as the original. LL <- list(z = 1:3, a = list()) # since we can't do s <- stack(LL,. drop = FALSE) do this instead: s <- transform(stack(LL), ind = factor(as.character(ind), levels = names(LL))) unstack(s) On Mon, Jun 27, 2016 at 2:55 PM, Michael La...
2011 Sep 26
1
Restructuring data - unstack, reshape?
Hi all, I'm having a problem restructuring my data the way I'd like it. I have data that look like this: Candidate.ID Specialty Office Score 110002 C London 47 110002 C East 48 110003 RM West 45 110003 RM
2005 Oct 22
0
Getting univariate information from a multivariate data set
A quick question that I've had only partial success in answering. I have a multivariate dataset, and would like to extract some simple univariate information from it grouped by treatments, etc. I am encountering two problems however Note: I am importing my data with my_data <- read.csv("/path/data.csv") 1) Scoping of unstack If I attempt sorted_data <- unstack(response,
2007 Jul 15
1
Restructuring data
Hi folks, I am new to the list and relatively new to R. I am trying to unstack data "arraywise" and could not find a convenient solution yet. I tried to find a solution for the problem on help archives. I also tried to use the reshape command in R and the reshape package but could not get result. I will illustrate the case below, but the real dataset is quite large so that I would
2006 Dec 30
1
Crosstab from sql dump
Hello all,, Im looking for a simple function to produce a crosstab from a dumped sql query result. Its very hard to produce crosstabs with most databases (Access being the exception), so with the vast array of R packages, Im sure this has to have already been implemented somewhere. Examples are always good: Take a csv dump like name code user1 100 user2 100 user1 200 user2 210 user1 300 user2
2016 Jun 27
2
stack problem
stack() seems to drop empty levels. Perhaps there could be a drop=FALSE argument if one wanted all the original levels. In the example below, we may wish to retain level "b" in s$ind even though component LL$b has length 0. > LL <- list(a = 1:3, b = list()) > s <- stack(LL) > str(s) 'data.frame': 3 obs. of 2 variables: $ values: int 1 2 3 $ ind : Factor
2012 Mar 20
2
Reshaping data from long to wide without a "timevar"
Hello All, I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order. My data have a variable called "RowNo" that functions almost like a
2010 Jun 07
2
Computing day-over-day log return for a matrix containing multiple time series
Hi all, Thanks a lot for anyone's help in advance. I am trying to find a way to compute the day-to-day return (log return) from a n x r matrix containing, n different stocks and price quotes over r days. The time series of prices are already split by using unstack function. For the result, I would like to see a n x (r-1) matrix, where by each entry is the day-over-day return of
2009 May 18
1
error in importing text files
...y moving a slider on a 100 point scale. The palms recorded the date, time, palm pilot ID number, response to the beep (non-response = -32767), question number, response latency in milliseconds, response to each question, and three addtiional data points of no interest. The data are arranged in an unstacked (long) text file such that each line contains all of the above information and there are 34 (32 responses plus 2 extra lines of meaningless data) lines per measurement occasion (upto 850 lines of data if all 34 lines are present for all 25 measurment occasions). Below is an example of how the data...
2005 Dec 09
3
R-how to group the data
Hello R - users, This may sound simple to may people: I have a list of data as follows type value y 7 y 7 y 8 y 8 y 8 y 9 y 9 y 9 y 9 y 10 y 10 y 10 y 10 y 11 y 11 y 12 y 12 y 14 y 14 y 14 y 15 y 17 y 20 y 20 y 20 y 20 y 25
2006 Jun 26
2
reshaping data.frame question
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear R-helpers, my data.frame is of the form x <- data.frame( f=gl(4,3), X=rep(0:2,4), p=c(.1,.2,.3)) x f X p 1 1 0 0.1 2 1 1 0.2 3 1 2 0.3 4 2 0 0.1 5 2 1 0.2 6 2 2 0.3 7 3 0 0.1 8 3 1 0.2 9 3 2 0.3 10 4 0 0.1 11 4 1 0.2 12 4 2 0.3 which tabulates some values p(X) for several factors f. Now I want to put it in "wide"
2013 Apr 30
3
Line similarity
...So of the input is something like this: Name Year_1_value Year_2_value Year_3_value A 1 2 3 B 2 7 19 C 3 4 2 D 10 7 6 E 4 4 5 F NA 3 6 Then the desired output is as follows: A Growing B Growing C Stable D Declining E Stable F Growing (or NA is also fine) The data can also be unstacked, i.e. the three years could be separate rows if necessary. Is there a package for R that implements something like the above? I can obviously try do a set of simple regressions to classify the rows, but I want to gain from the thoughts and learnings of others who may have taken the...
2006 Aug 08
0
(Fwd) Re: paired t-test. Need to rearrange data?
------- Forwarded message follows ------- From: Petr Pikal <petr.pikal at precheza.cz> To: Henrik Parn <henrik.parn at bio.ntnu.no> Subject: Re: [R] paired t-test. Need to rearrange data? Date sent: Tue, 08 Aug 2006 16:13:47 +0200 Hi Uff, it takes me a bit headache but this shall do it ?unstack ?table ?t new.list<-unstack(test.data,y~id)
2006 Oct 27
0
problem with applying regul function (pastecs)
Hi, I'm trying to analyse some time series data on dissolved organic nitrogen. Because it has gaps in it, I try to interpolate (linear) with the regul method from the pastecs package. I have a number of stations with measurement series in a matrix constructed from a data frame with the unstack method (temp) I also used the unstack method to make a similar matrix for the time points
2007 May 18
0
Is formula(data.frame) documented?
The Examples section of 'unstack' includes: formula(PlantGrowth) # check the default formula I wanted to add a formula to my own data.frame (for unstacking), so I start looking: ?formula # Nothing here about adding a formula to data attr(PlantGrowth, "formula") # Nothing here--c.f. groupedData objects dput(PlantGrowth) # Hmm, no formula here either ?formula.data.frame
2008 Aug 12
1
which(df$name=="A") takes ~1 second! (df is very large), but can it be speeded up?
Dear All, I have a large data frame ( 2700000 lines and 14 columns), and I would like to extract the information in a particular way illustrated below: Given a data frame "df": > col1=sample(c(0,1),10, rep=T) > names = factor(c(rep("A",5),rep("B",5))) > df = data.frame(names,col1) > df names col1 1 A 1 2 A 0 3 A 1 4 A