search for: olddata

Displaying 20 results from an estimated 47 matches for "olddata".

2024 Dec 01
6
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
...r give! I am trying to write a program that will run through a data frame organized by ID and for the first line of each new group of data lines that has the same ID create a new variable first that will be 1 for the first line of the group and 0 for all other lines. e.g. if my original data is olddata ID date 1 1 1 1 1 2 1 2 1 3 1 3 1 4 1 4 1 5 1 5 2 5 2 5 2 5 2 6 2 6 2 6 3 10 3 10 the new data will be newdata ID date first 1 1 1 1...
2024 Nov 27
7
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: I want to take data (olddata) that looks like this ID Day 1 1 1 1 1 2 1 2 1 3 1 3 1 4 1 4 1 5 1 5 2 5 2 5 2 5 2 6 2 6 2 6 3 10 3 10 and make it look like this: (withing each ID I am copying the first value of Day into a new variable, FirstDay, and propagating the FirstDay value through all rows that have the same ID: ID Day...
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
On 11/27/24 08:30, Sorkin, John wrote: > I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: > > I want to take data (olddata) that looks like this > ID Day > 1 1 > 1 1 > 1 2 > 1 2 > 1 3 > 1 3 > 1 4 > 1 4 > 1 5 > 1 5 > 2 5 > 2 5 > 2 5 > 2 6 > 2 6 > 2 6 > 3 10 > 3 10 > > and make it look like this: > (withing each ID I am copying the first value of Day into...
2024 Dec 01
2
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
...a program that will run through a data frame organized by ID and for the first line of each new group of data lines that has the same ID create a new variable first that will be 1 for the first line of the group and 0 for all other lines. > > > > e.g. if my original data is > > olddata > > ID date > > 1 1 > > 1 1 > > 1 2 > > 1 2 > > 1 3 > > 1 3 > > 1 4 > > 1 4 > > 1 5 > > 1 5 > > 2 5 > > 2 5 &...
2012 Apr 29
1
CForest Error Logical Subscript Too Long
Hi, This is my code (my data is attached): library(languageR) library(rms) library(party) OLDDATA <- read.csv("/Users/Abigail/Documents/OldData250412.csv") OLDDATA$YD <- factor(OLDDATA$YD, label=c("Yes", "No"))? OLDDATA$ND <- factor(OLDDATA$ND, label=c("Yes", "No"))? attach(OLDDATA) defaults <- cbind(YD, ND) set.seed(47) data.control...
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
...de 27/11/2024, Sorkin, John escreveu: > I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: > > I want to take data (olddata) that looks like this > ID Day > 1 1 > 1 1 > 1 2 > 1 2 > 1 3 > 1 3 > 1 4 > 1 4 > 1 5 > 1 5 > 2 5 > 2 5 > 2 5 > 2 6 > 2 6 > 2 6 > 3 10 > 3 10 > > and make it look like this: > (withing each ID I am copying the first value of Day into...
2024 Nov 27
1
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
...24, Sorkin, John escreveu: >> I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: >> >> I want to take data (olddata) that looks like this >> ID Day >> 1 1 >> 1 1 >> 1 2 >> 1 2 >> 1 3 >> 1 3 >> 1 4 >> 1 4 >> 1 5 >> 1 5 >> 2 5 >> 2 5 >> 2 5 >> 2 6 >> 2 6 >> 2 6 >> 3 10 >> 3 10 >> >> and ma...
2024 Nov 27
4
R Processing dataframe by group - equivalent to SAS by group processing with a first. and retain statments
....umaryland.edu> wrote: > > > I am an old, long time SAS programmer. I need to produce R code that processes a dataframe in a manner that is equivalent to that produced by using a by statement in SAS and an if first.day statement and a retain statement: > > I want to take data (olddata) that looks like this > ID Day > 1 1 > 1 1 > 1 2 > 1 2 > 1 3 > 1 3 > 1 4 > 1 4 > 1 5 > 1 5 > 2 5 > 2 5 > 2 5 > 2 6 > 2 6 > 2 6 > 3 10 > 3 10 > > and make it look like this: > (withing each ID I am copying the first value of Day into...
2012 Mar 26
1
assigning vector or matrix sparsely (for use with mclapply)
...ne)) , FUN.ON.ROWS, ... ) ? rv <- do.call("rbind", soln) ?## omits naming. ? if (ncol(rv)==1) rv <- as.vector(rv) ? rv } this works fine, except that what I want to get NA's in the return positions that were not recalculated. then, I can write newdata$y <- ifelse ( is.na(olddata$y), mc.byselectrows( olddata, is.na(olddata$y), fun.calc.y ), olddata$y ) I can do this very inelegantly, of course. I can merge recalclist into data.in and then write a loop that substitutes for the do.call to rbind. yikes. or I could do the recalclist contingency inside the FUN.ON.ROWS, but t...
2010 May 21
3
Concatenation
Hi, I have a dataframe with some 800 rows and 14 columns. Could you please advise how I can concatenate the rows - one after another. Similarly for columns, one below the other. Many thanks. Cheers, Santana [[alternative HTML version deleted]]
2024 Dec 02
0
Identify first row of each ID within a data frame, create a variable first =1 for the first row and first=0 of all other rows
...leagues, I am grateful to all of you for helping me with my question, how to write R code that will identify the first row of each ID within a data frame, create a variable first=1 for the first row and first=0 for all repeats of the ID. WOW!!! I just saw Boris Steipe's answer to my question: olddata$first <- as.numeric(! duplicated(olddata$ID)) The solution is elegant, short, easy to understand, and it uses base R! All important characteristics of a good solution, at least for me. While I want to learn solutions using packages that extend base R, I believe that a good programmer learns how...
2017 Jun 09
2
Extremely slow du
....067s time du -sh /data/aa/bb/cc 3.7G /data/aa/bb/cc real 16m43.735s user 0m1.097s sys 0m5.802s 16m and 7m is too long for a 3.7 G directory. I must mention that the directory contains huge number of files (208736) but running du on same directory on old data gives this result time du -sh /olddata/aa/bb/cc 4.0G /olddata/aa/bb/cc real 3m1.255s user 0m0.755s sys 0m38.099s much better if I run same command again time du -sh /olddata/aa/bb/cc 4.0G /olddata/aa/bb/cc real 0m8.309s user 0m0.313s sys 0m7.755s Is there anything I can do to improve this performance? I would also like hear from some...
2001 Dec 07
2
question
...t: Re: [Rd] question > > > Erich Neuwirth <erich.neuwirth@univie.ac.at> writes: > > > in r 1.3.1, > > i read in data into a dataframe and (erroneously) forgot > to convert text > > into numbers. > > > > the frame was called olddata > > then i could to the following calculation: > > > > vp95<-olddata["vp95"]/olddata["wb95"] > > > > "vp95" and "wb95" are column names. > > > > in r 1.4.0, this does not work any more. > >...
2017 Jun 09
0
Extremely slow du
...ta/aa/bb/cc > real 16m43.735s > user 0m1.097s > sys 0m5.802s > > 16m and 7m is too long for a 3.7 G directory. I must mention that the > directory contains huge number of files (208736) > > but running du on same directory on old data gives this result > > time du -sh /olddata/aa/bb/cc > 4.0G /olddata/aa/bb/cc > real 3m1.255s > user 0m0.755s > sys 0m38.099s > > much better if I run same command again > > time du -sh /olddata/aa/bb/cc > 4.0G /olddata/aa/bb/cc > real 0m8.309s > user 0m0.313s > sys 0m7.755s > > Is there anything I c...
2017 Jun 09
2
Extremely slow du
...;> user 0m1.097s >> sys 0m5.802s >> >> 16m and 7m is too long for a 3.7 G directory. I must mention that the >> directory contains huge number of files (208736) >> >> but running du on same directory on old data gives this result >> >> time du -sh /olddata/aa/bb/cc >> 4.0G /olddata/aa/bb/cc >> real 3m1.255s >> user 0m0.755s >> sys 0m38.099s >> >> much better if I run same command again >> >> time du -sh /olddata/aa/bb/cc >> 4.0G /olddata/aa/bb/cc >> real 0m8.309s >> user 0m0.313s >&...
2014 Aug 13
1
adjust SOA record
...at, I'm getting "The start of authority (SOA) record cannot be updated. The record does not exist." I'm not sure what the correct 4.1.7 samba-tool line should be: > samba-tool dns update <server> <zone> <name> <A|AAAA|PTR|CNAME|NS|MX|SOA|SRV|TXT> <olddata> <newdata> I'm unsure about <olddata> and <netdata>. Here is my current SOA, I should replace <olddata> with this: SOA: serial=3, refresh=900, retry=600, expire=86400, minttl=0, ns=dc1.samba.company.com., email=hostmaster.samba.company.com. (flags=600000f0, seri...
2017 Jun 12
2
Extremely slow du
...t; >>>> 16m and 7m is too long for a 3.7 G directory. I must mention that the >>>> directory contains huge number of files (208736) >>>> >>>> but running du on same directory on old data gives this result >>>> >>>> time du -sh /olddata/aa/bb/cc >>>> 4.0G /olddata/aa/bb/cc >>>> real 3m1.255s >>>> user 0m0.755s >>>> sys 0m38.099s >>>> >>>> much better if I run same command again >>>> >>>> time du -sh /olddata/aa/bb/cc >>>> 4....
2017 Jun 10
0
Extremely slow du
...sys 0m5.802s >>> >>> 16m and 7m is too long for a 3.7 G directory. I must mention that the >>> directory contains huge number of files (208736) >>> >>> but running du on same directory on old data gives this result >>> >>> time du -sh /olddata/aa/bb/cc >>> 4.0G /olddata/aa/bb/cc >>> real 3m1.255s >>> user 0m0.755s >>> sys 0m38.099s >>> >>> much better if I run same command again >>> >>> time du -sh /olddata/aa/bb/cc >>> 4.0G /olddata/aa/bb/cc >>> re...
2017 Jun 16
0
Extremely slow du
...16m and 7m is too long for a 3.7 G directory. I must mention that the >>>>> directory contains huge number of files (208736) >>>>> >>>>> but running du on same directory on old data gives this result >>>>> >>>>> time du -sh /olddata/aa/bb/cc >>>>> 4.0G /olddata/aa/bb/cc >>>>> real 3m1.255s >>>>> user 0m0.755s >>>>> sys 0m38.099s >>>>> >>>>> much better if I run same command again >>>>> >>>>> time du -sh /oldd...
2017 Jun 18
1
Extremely slow du
...ng for a 3.7 G directory. I must mention that the >>>>>> directory contains huge number of files (208736) >>>>>> >>>>>> but running du on same directory on old data gives this result >>>>>> >>>>>> time du -sh /olddata/aa/bb/cc >>>>>> 4.0G /olddata/aa/bb/cc >>>>>> real 3m1.255s >>>>>> user 0m0.755s >>>>>> sys 0m38.099s >>>>>> >>>>>> much better if I run same command again >>>>>> >>&g...