similar to: Applying a function to categorized data?

Displaying 20 results from an estimated 4000 matches similar to: "Applying a function to categorized data?"

2011 Mar 12
1
Column order in stacking/unstacking
Dear R users, I'm having some problems with the stack() and unstack() functions, and wondered if you could help. I have a large data frame (400 rows x 2000 columns), which I need to reduce to a single column of values (and therefore 800000 rows), so that I can use it in other operations (e.g., generating predictions from a GLM object). However, the problem I'm having can be reproduced
2009 Nov 15
1
Help with unstack() function
Hi Everyone, I am trying to understand the unstack() function but after struggling for two days, I have given up. More specifically, I am trying the exercises at the end of Chapter 1 of Data Analysis and Graphics Using R by Maindonald and Braun, 2nd ed. Exercise 18 (p. 41) asks to unstack the Rabbit data frame from the MASS package to get a certain data frame that is shown in the exercise.
2004 Mar 19
2
using "unstack" inside my function: that old scope problem again
I've been reading the R mail archives and I've found a lot of messages with this same kind of problem, but I can't understand the answers. 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
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)
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
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
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
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
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"
2007 Mar 05
2
[PATCH] Make save/restore of multiple VCPU contexts arch dependent
We need to look at how to support this on ia64, so how about making this an architecture dependent feature for now? Not sure what powerpc needs here, so I''m just lumping it into the old way bucket. Thanks, Alex Signed-off-by: Alex Williamson <alex.williamson@hp.com> --- diff -r 3ac19fda0bc2 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py
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
2008 Oct 03
2
Ragged time series data
Hi and thanks in advance, I am fairly new with R so I hope this problem isn't too amateur. I have a vector of count data which correspond to vectors of date (%m/%d/%Y) and time of day (%H:%M:%S). I am trying to compute various statistics (e.g. daily max) by lumping the data together by day. I have been able to utilize tapply() and group the counts together, but with the method I use I end
2009 May 09
1
Strip labels: use xyplot() to plot columns in parallel with outer=TRUE
The following tinkers with the strip labels, where the different panels are for different levelf of a conditioning factor. tau <- (0:5)/2.5; m <- length(tau); n <- 200; SD <- 2 x0 <- rnorm(n, mean=12.5, sd=SD) matdf <- data.frame( x = as.vector(sapply((0:5)/2.5, function(s)x0+rnorm(n, sd=2*s))), y <- rep(15+2.5*x0, m), taugp = factor(rep(tau, rep(n,m)))) names(matdf)
2012 Jan 19
1
[LLVMdev] AliasSetTracker
In the implementation of the AliasSetTracker, I see LoadInst, StoreInst, and VAArgInst are treated specially. Why aren't AtomicCmpXchgInst and AtomicRMWInst treated with similar care? Lumping together with other unknown instructions seems unnecessarily expensive in compile time. Preston -------------- next part -------------- An HTML attachment was scrubbed... URL:
2009 May 14
1
Supplying NA or Zeros in dataframe for missing factor combinations
Hi there, I am not getting anywhere near a solution, so here is my question. I have searched the archives and didn't find a solution, but maybe my search didn't use the right words. So here it is: I have a dataframe with the following structure factor1 factor2 value In the (rather large) dataset I have to work on, there are some factor combinations missing, e.g. factor1 <-
2018 Mar 02
0
RADIUS
On 03/01/2018 03:06 AM, hw wrote: > >> It is illogical to lump all network access together into a single >> category. > ... >> If your device can communicate with a switch, even for the purpose of >> authenticating, then it has network access. > > The device has access to the switch which, depending on what answer to an > authentication request it gets from
2008 Jun 10
1
Frame from long to wide format
I have this frame in the long format which I want to convert to wide format. There are three columns in the frame, the id for the rows in the wide format, the name of the column where the final value (the third column) is to be placed. The complicating factor is that the long format is not complete in at least two ways, (a) there may be more than one reference to one cell in the wide
2011 Oct 18
1
Function to "lump" factors together?
Sorry about the odd terminology, but I suspect that my intent might be completely missed had I used "aggregate" or "classify" (each of which appears to have some rather special meanings in statistical analysis and modeling). I have some data about software builds; one of the characteristics of each is the name of the branch. A colleague has generated some fairly interesting
2011 Aug 09
1
"Denormalize" data
Hello R users, My problem is that the data I've got is in the minimum number of columns with each ward (geographic area) appearing multiple times. The first 30 terms look like this > HHum02 CASW Btype Yr CO2Group NumVeh 170597 00CCFA CARS 2002 C 2 170598 00CCFA CARS 2002 D 2 170599 00CCFA CARS 2002 E 22 170600 00CCFA CARS 2002