similar to: Grouping and/or splitting

Displaying 20 results from an estimated 100 matches similar to: "Grouping and/or splitting"

2012 Apr 03
1
Compare by row and insert previous row value (Or non Time Series Lag)
I have the following sample dataset (CSV input here:http://goo.gl/YR8LP. CSV output here: http://goo.gl/EFCC8) which I want to transform as follows. For each person in a household I want to create two new variables OrigTAZ and DestTAZ. It should take the value in TripendTAZ and put that in DestTAZ. For OrigTAZ it should put value of TripendTAZ from the previous row. For the first trip of every
2012 Mar 06
1
How to eliminate for next loops in this script
I needed to compute a complicated cross tabulation to show weighted means and standard deviations and the only method I could get that worked uses a series of nested for next loops. I know that there must be a better way to do so, but could use some assistance pointing the way. Here is my working, but inefficient script: library(Hmisc) rm(list=ls()) load('NHTS.Rdata') day.wt <-
2006 Feb 21
3
HABTM :insert_sql help
Hi all, I''m working with a legacy sqlserver db and I''m trying to override the insert sql in as defined in the HABTM method below(becasue the join has three primary keys), but I''m getting the error: ''undefined local variable or method `record'' for Project:Class'' has_and_belongs_to_many :people, :class => ''Person'',
2012 Apr 17
1
random effects using lmer
Hi, I am trying to run a logistic regression to look at the risk of malaria infection in individuals. I want to account for intra household correlation and so want to include a household level random effect. I have been using the lmer command in lme4 package but am getting some strange results that are completely different to those I get using STATA. Can I just check that this is the correct
2006 May 10
3
Unique?
Hello, I have sample data set that looks like: YEAR MONTH DAY CONTINUE SPL TIMEFISH TIMEUNIT AREA COUNTY DEPTH DEPUNIT GEAR TRIPID CONVUNIT 1992 1 26 1 SP0073928 8 H 7 25 4 NA 1000000 02163399054 161 1992 1 26 1 SP0073928 8 H 7 25 4 NA 1000000 02163399054 8 1992 1 26 2 SP0004228 8 H 7 25 4 NA 1000000 02163399054 161 1992 1 26 2 SP0004228 8 H 7 25 4 NA 1000000 02163399054 8 1992
2009 Dec 22
3
vector indexing problem in multilevel data: assigning a specific value to all group members
Dear List, I work with multilevel data from psychological group experiments and have frequently encountered a situation for which I haven't found an elegant solution: I need to assign the value of a specific group member to all members of the group. For example, I have a group leader (identified by a binary vector) and some attribute for all group members. I want to create a new
2006 May 03
4
Aggregate?
Hello, I have a data set with a grouping variable (TRIPID) and several other variables. TRIPID is repeated in some areas and I would like to use a function like aggregate to sum the variable UNITS according to TRIPID. However I would also like to retain the other variables as they are in the data set with the new summed TRIPID. So what I have is something like this: YEAR MONTH DAY
2006 May 03
4
Aggregate?
Hello, I have a data set with a grouping variable (TRIPID) and several other variables. TRIPID is repeated in some areas and I would like to use a function like aggregate to sum the variable UNITS according to TRIPID. However I would also like to retain the other variables as they are in the data set with the new summed TRIPID. So what I have is something like this: YEAR MONTH DAY
2012 Jun 08
1
noob requesting help
I'm fairly new to R and still learning how to use it. I could really use some help with the following problem. I have a huge .csv file containing thousands of measurements on 34 different birds. Measurements include longitude, latitude, altitude, speed, time, etc. All birds have a different number (ranging from 121 to 542). All measurements have a tripID (1 for the first trip of every bird, 2
2012 Jul 13
1
R combining many vectors of predictable name into one date frame
G'day R (power) users, I have a many vectors, called: ib1 ib2 ib3 ... ib100 and I would like them in one data frame (df) such that: > df ib1 ib2 ib3 ib4 ..... ib100 x x x x x x x x x x x x x x x I have attempted: hold.list <- list(objects(pattern="ib")) df <- data.frame(hold.list) but that
2011 Apr 06
5
Need a more efficient way to implement this type of logic in R
I have cobbled together the following logic. It works but is very slow. I'm sure that there must be a better r-specific way to implement this kind of thing, but have been unable to find/understand one. Any help would be appreciated. hh.sub <- households[c("HOUSEID","HHFAMINC")] for (indx in 1:length(hh.sub$HOUSEID)) { if ((hh.sub$HHFAMINC[indx] == '01')
2008 Oct 30
1
Trying to "expand" some data - Newbie needs help
I want to calculate "expansion factors" for elements in my dataframe based on a 2-d cross classification. Since I'll have "missing values" (many combinations will have no record) I'll need a second "expansion factor" for each "row". I've included my "work to date" below, but I'm not very close to getting this right. My
2007 Dec 24
3
Affy Package
Dear R Users, In the expresso function, which combination of these methods for data pre-processing (when using affymetrix oligo arrays) is the best: bgcorrect.metod = rma rma2 mas normalize.method = qspline quantiles loess pmcorrect.method = pmonly subtractmm mas summary.method = liwong avgdiff medianpolish mas There are many options within each method. I would appreciate a hint on the best
2013 Mar 04
3
urgent: question concerning data manipulation
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130304/62581e97/attachment.pl>
2009 Jun 30
1
beadarray package
Dear R users, I am using the beadarray package. I am trying to upload raw bead-level data using these commands: ######################################################## library(beadarray) datadir <- ("C:/Computer_programs/R/beadarray/cecilia") targets = read.table("targets.txt", sep = "\t", header = TRUE, as.is = TRUE) BLData = readIllumina(arrayNames =NULL,
2007 Dec 26
1
nlme package
In using the NLME package (R 2.6.1 for Windows), I am having a problem in running an R script that used to run with no problems using a Linux OS in 2004. So I am wondering if during these last ~3 yrs we had major changes in the syntax of the NLME package that I am not aware. This is the R script: library(nlme) treat=as.factor(c(1,2,1,2,1,2,1,2)) mouse=as.factor(c(1,1,2,2,3,3,4,4))
2006 Feb 23
6
prototype ajax + xml response
Hi, I am looking for a solution to use ajax.request object. Return response text will be in xml format and I like to know how to parse that xml information, so that I can put those info into the "span" or "div" tags of my html page. Is there any easy way to parse that xml info using prototype library? Thanks, kevin. -- Posted via http://www.ruby-forum.com/.
2013 Mar 13
3
Assign the number to each group of multiple rows
Dear R users, My data have repeating "beh" parameter : 1 or 2 - type of animal behavior in subsequent locations. I need to assign unique number to each sequence of locations. My data is: >data=data.frame(row=seq(1:10),beh=c(1,1,1,2,2,2,1,1,2,2)) >attach(data) >data row beh 1 1 1 2 2 1 3 3 1 4 4 2 5 5 2 6 6 2 7 7 1 8
2008 Jun 10
2
How to join data.frames and vectors of different length, in an inteligent way?
I have a data set something like this: "YYYY", "Value" 1972 , 117 1984 , 73 1969 , 92 1976 , 113 1999 , 80 1996 , 78 1976 , 98 1984 , 106 1976 , 99 it could be created with: > dafSamp <- data.frame(cbind(c(1972,1984,1969,1976,1999,1996,1976,1984,1976),c(117,73,92,113,80,78,98,106,99))) The real dataset is of cause much larger, app. 100.000 samples
2006 May 16
3
subset
Hello everyone, I have a large dataset (x) with some rows that have duplicate variables that I would like to remove. I find which rows are the duplicates with X1<-which(duplicated(x)). That gives me the rows with duplicated variables. Now, how can I remove just those rose from the original data frame. I think I can create a new data frame without the duplicates using subset. I have tried: