similar to: assign sequence numbers by group of value

Displaying 20 results from an estimated 30000 matches similar to: "assign sequence numbers by group of value"

2006 Jun 12
2
select the last row by id group
Dear R users: I have a small test dataframe as the follows : math = c(80,75,70,65,65,70) reading = c(65,70,88,NA,90,NA) id = c('001','001','001','002','003','003') score = data.frame(id, reading, math) > score id reading math 1 001 65 80 2 001 70 75 3 001 88 70 4 002 NA 65 5 003 90 65 6 003 NA 70
2010 Apr 26
2
Finding First of a Type in a Sequence
Hi there, I am working on a project that requires me to find the point at which values become negative in a sequence about the max. For example, say I have some sequence: x=c(-12, -2,-19, 0, -14, -2, 9,10,20,35,56,89,60,39,12,8,-5,-2,0,10) In this sequence, the max is 89, and I need to identify that -2 and -5 are the points at which the values* first *become negative about the max and retrieve
2010 Nov 16
26
Balloon driver for Linux/HVM
Hi, I have noticed that, in the code of linux/drivers/xen/balloon.c, there exists the snippet as this: static int __init balloon_init(void) { unsigned long pfn; struct page *page; if (!xen_pv_domain()) return -ENODEV; ..... } Does it means the driver will not work in HVM? If so, where is the HVN-enabled code for that? 2010-11-16 Rui Chu _______________________________________________
2005 Jun 25
1
group means: split and unsplit
Took me a while but I figured out how to put in common values of group means/counts, etc. to do the same thing as egen. lapply with split and then unsplit. Thomas Davidoff Assistant Professor Haas School of Business UC Berkeley Berkeley, CA 94720 phone: (510) 643-1425 fax: (510) 643-7357 davidoff@haas.berkeley.edu http://faculty.haas.berkeley.edu/davidoff [[alternative HTML
2020 Nov 21
3
Error in unsplit() with tibbles
Hello, using the `unsplit()` function with tibbles currently leads to the following error: > mtcars_tb <- as_tibble(mtcars, rownames = NULL) > s <- split(mtcars_tb, mtcars_tb$gear) > unsplit(s, mtcars_tb$gear) Error: Must subset rows with a valid subscript vector. ? Logical subscripts must match the size of the indexed input. x Input has size 15 but subscript `rep(NA, len)` has
2005 Sep 27
2
Using unsplit - unsplit does not seem to reverse the effect of split
In data OME in MASS I would like to extract the first 5 observations per subject (=ID). So I do library(MASS) OMEsub <- split(OME, OME$ID) OMEsub <- lapply(OMEsub,function(x)x[1:5,]) unsplit(OMEsub, OME$ID) - which results in [[1]] [1] 1 1 1 1 1 [[2]] [1] 30 30 30 30 30 [[3]] [1] low low low low low Levels: N/A high low [[4]] [1] 35 35 40 40 45 [[5]] [1] coherent incoherent coherent
2020 Nov 21
2
Error in unsplit() with tibbles
I get the sentiment, but this is really just bad coding (on my own part, I suspect), so we might as well just fix it... -pd > On 21 Nov 2020, at 17:42 , Marc Schwartz via R-devel <r-devel at r-project.org> wrote: > > >> On Nov 21, 2020, at 10:55 AM, Mario Annau <mario.annau at gmail.com> wrote: >> >> Hello, >> >> using the `unsplit()`
2006 Jun 08
1
NAs in unsplit factor
R-devel, Below is a simple example calling split and unsplit on a numeric vector of length 2 where 'f' is c(1,NA). > unsplit(split(c(1,2), c(1,NA)), c(1,NA)) [1] 1 0 I noticed that the call to vector in unsplit gives us 0 as the 2nd element of the result. Is this the intended result, as opposed to NA? Thanks for your help, Jeff -- Jeff Enos Kane Capital Management jeff at
2007 Dec 09
4
adding group totals to a table
I have a table with two columns: A 1 A 1 A 2 B 2 C 0 I would like to produce a third column that contains the counts of each unique combination of col1 and col2: A 1 2 A 1 2 A 2 1 B 2 1 C 0 1 How can I do this in R? Thanks in advance ... -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
2010 Apr 19
2
Using split and then unsplit
Hello everyone, I use the split function splitting with the f function on a 3 columns and more than 100 000 rows data frame. Once it's split I have a list of data frames still with 3 columns and n rows. I manipulate those list elements and get a list of data frames still with 3 columns but less rows. So when I unsplit it, I get an error as I use the same factor function I used to split ( f in
2002 Jul 28
1
[R] bug in unsplit()? (PR#1843)
Hedderik van Rijn <hedderik@cmu.edu> writes: > If the second argument to unsplit is not a simple vector (but a "list > containing multiple lists"), the function seems to have some problems. > > Given a slight modification of the examples in help(split): > > > xg <- split(x,list(g1=g,g2=g)) > > unsplit(xg,list(g1=g,g2=g)) > [1] -0.7877109
2012 Aug 15
5
Extract lines from text file
Hi, I'm looking for a command to extract lines from a large text file, a password file. A typical user has a username made from a letter followed by their id-number. m9718508:pw:9301:840: Lynch :/home/pgstud/m9718508:/bin/bash So for instance if I need to extract lines where; the 1st field, the username begins with an m and the 4th field, the group contains exactly 850 cat passwdfile |
2006 Mar 06
3
Problem Accessing Samba Server from Windows
Hi, I'm having a problem accessing my samba server from Windows. The problem occurs every time I try to browse to it on either XP or 2003 Server. The error message I get is: "\\Zeus is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions. The account is not authorized to log in
2009 May 08
1
unsplit list of data.frames with one column
Perhaps this is the intended behavior, but I discovered that unsplit throws an error when it tries to set rownames of a variable that has no dimension. This occurs when unsplit is passed a list of data.frames that have only a single column. An example: df <- data.frame(letters[seq(25)]) fac <- rep(seq(5), 5) unsplit(split(df, fac), fac) For reference, I'm using R version 2.9.0
2011 Mar 10
1
getting percentiles by factor
Hello, I'm trying to get percentiles (PERCENTRANK for excel users) by factor in the following data.frame: myExample <- data.frame(Ret=seq(-2, 2.5, by=0.5),PE=seq(10,19),Sectors=rep(c("Financial","Industrial"),5)) myExample <- na.omit(myExample) Thanks to Patrick I I managed to put together the following lines which does it for the "Ret" column: myecdf
2011 May 19
1
Problems with unsplit()
Hi everyone, I have already used split() and unsplit() in data frames without problems, but now I’m applying these functions to other data and when using unsplit() I have received the following message: Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "2", "3", "4", : duplicate ''row.names'' are not allowed In
2010 Mar 05
2
How to assign week numbers to a time-series
Hello everyone, My progress has stalled on finding a way of creating a somewhat complicated variable to add to my existing dataframe and I am hoping one of you could help me out. The dataframe below contains only a fraction of the data of my complete dataframe, but all of the variables. What I want to do is add another variable named 'WEEK' to this dataframe that is assigned 1 for row 1
2010 Apr 13
2
efficiently picking one row from a data frame per unique key
Hello all, I'm trying to transform data frames by grouping the rows by the values in a particular column, ordered by another column, then picking the first row in each group. I'd like to convert a data frame like this: x y z 1 10 20 1 11 19 2 12 18 4 13 17 into one with three rows, like this, where i've discarded one row: x y z 1 1 11 19 2 2 12 18 4 4 13 17 I've got a
2010 Oct 01
2
function which can apply a function by a grouping variable and also hand over an additional variable, e.g. a weight
Hi, I was wondering if there is an easy way to accomplish the following in R: Often I want to apply a function, e.g. weighted.quantile from the Hmisc package to grouped subsets of a data.frame (grouping variable) but then I also need to hand over the weights which seems not possible with summaryBy or aggregate or the like. Is there a function to do this? Currently I do this with loops but it
2008 Nov 14
2
Preserving DID numbers on PRI pass through
Hello all, I have the following working (somewhat) setup: TELCO | | E1 (30 Chan -- TE210 SPAN 2) | | Asterisk box 1.6 with DAHDI drivers loaded Digium TE210p | | E1 (30 Chan -- TE210 SPAN 1) | | NEC PBX