search for: pcum

Displaying 6 results from an estimated 6 matches for "pcum".

Did you mean: pcm
2017 Jun 07
3
An R question
Hi all, In checking my R codes, I encountered the following problem. Is there a way to fix this? I tried to specify options(digits=). I did not fix the problem. Thanks so much for your help! Hanna > cdf(pmass)[2,2]==pcum[2,2][1] FALSE> cdf(pmass)[2,2][1] 0.9999758> pcum[2,2][1] 0.9999758 [[alternative HTML version deleted]]
2010 Oct 12
5
aggregate with cumsum
Hello everybody, Data is myd <- data.frame(id1=rep(c("a","b","c"),each=3),id2=rep(1:3,3),val=rnorm(9)) I want to get a cumulative sum over each of id1. trying aggregate does not work myd$pcum <- aggregate(myd[,c("val")],list(orig=myd$id1),cumsum) Please suggest a solution. In real the dataframe is huge so looping with for and subsetting is not a great idea (still doable, though). Thank you Stephen B [[alternative HTML version deleted]]
2017 Jun 07
0
An R question
...6/2017 16:32, li li wrote: > Hi all, > In checking my R codes, I encountered the following problem. Is there a > way to fix this? > I tried to specify options(digits=). I did not fix the problem. > Thanks so much for your help! > Hanna > > >> cdf(pmass)[2,2]==pcum[2,2][1] FALSE> cdf(pmass)[2,2][1] 0.9999758> pcum[2,2][1] 0.9999758 > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help &...
2001 Oct 28
0
Summary: A speed improvement challenge
...be quick. As for 3, sample() does multinomial sampling for a single set of p values (as you stated), but it's not hard to implement sample() using runif, and it should be straightforward to vectorize. Something like p <- list(c(1,2,3)/6,c(3,1)/4,c(1,1,1,1)/4) n <- max(sapply(p,length)) pcum <- sapply(p,function(x,n)c(cumsum(x)/sum(x),rep(1,n))[1:n],n=n) # make pcum's all same length apply(sweep(pcum,2,runif(2),">"),2,function(x,n)(1:n)[x][1],n=n) Nick Ellis CSIRO Marine Research mailto:Nick.Ellis at csiro.au ------------------------------------------------------...
2024 Jan 30
1
R interpreting numeric field as a boolean field
...` [1] "POSIXct" "POSIXt" $`Market Segment` [1] "character" $`N?mero de Tr?nsitos` [1] "numeric" $`Tar No` [1] "character" $`Beam Range (Operations)` [1] "character" $`Operational Vessel Ranges Group` [1] "character" $`Rcnst PCUMS` [1] "numeric" $`Toll Amount` [1] "numeric" $Beam [1] "numeric" $Length [1] "numeric" $`Trn Draft (FT)` [1] "numeric" $`Other Income Amt` [1] "numeric" $`Total Other Income Amount` [1] "logical" $`Booking Charges` [1] &qu...
2024 Jan 30
1
R interpreting numeric field as a boolean field
Incidentally, "didn't work" is not very useful information. Please tell us exactly what error message or apparently aberrant result you received. Also, what do you get from: sapply(your_dataframe, "class") nrow(your_dataframe) (as I suspect what you think it is, isn't). Cheers, Bert On Tue, Jan 30, 2024 at 11:01?AM Bert Gunter <bgunter.4567 at gmail.com>