[R] Assistance would be appreciated

MyCalendar rentar18 at gmail.com
Mon Mar 27 12:09:44 CEST 2017


Hey Berend and Jim:
Yes, it's me, Bruce. 
I will try your inputs, and let you know. 
Thanks.
Bruce

PS: I goal is to create:  mean_decc_0, mean_decc_1, ..., mean_decc_9
And then stack them. Also, Aren't these dataframe?
-------

> On Mar 27, 2017, at 5:30 AM, Berend Hasselman <bhh at xs4all.nl> wrote:
> 
> 
>> On 27 Mar 2017, at 01:13, MyCalendar <rentar18 at gmail.com> wrote:
>> 
>> Hi R'ers:
>> Newbie to R, but I guarantee that I don't ask for help until, in this case, I spent
>> Over ten hours today ( Sunday, wife loves it!! )
>> I can't find the bug, trying to remove column cum_wt.
>> Assistance would be appreciated. 
> 
> mean_decc_0 is a matrix? No it isn't.
> Use str(mean_decc_0) to see what it actually is.
> Then try setting the required element to NULL. And ponder your goal.
> 
> Berend Hasselman
> 
>> Bruce 
>> --- Code ---
>> 
>> yhat     <- seq(1, 0.05, length.out = 20)
>> Response <-c(1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0)
>> cum_R    <- cumsum(Response)
>> sam_size <- length(Response)
>> cum_wt   <- seq(1:1,length=20)
>> wt       <- seq(1:1,by=0, length=20)
>> dec      <- (cum_wt/sam_size)
>> decc     <- floor((cum_wt*10)/(sam_size+1))
>> dec_mean <- aggregate(Response, by=list(decc), mean)
>> d        <- data.frame(yhat, Response, cum_R, sam_size, cum_wt,wt, decc, dec_mean)
>> d
>> 
>> #decc=0
>> decc_0           <- subset(d, decc ==0)
>> mean_decc_0      <- colMeans(decc_0, 2)
>> mean_decc_0[1,5] <- NULL
>> mean_decc_0
>> ______________
>> 
>> 
>> 
>> 
>> 
>> -------
>>    [[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
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 



More information about the R-help mailing list