[R] Error message in as.brob Usage

Joshua Wiley jwiley.psych at gmail.com
Fri Oct 8 08:27:50 CEST 2010


On Thu, Oct 7, 2010 at 11:01 PM, HC <hcatbr at yahoo.co.in> wrote:
>
> I am getting the following error message while using the as.brob function in
> some computations:
>
> Error in out.x[ss] <- pmax(x1[ss], x2[ss]) + log1p(+exp(-abs(x1[ss] -  :
>  NAs are not allowed in subscripted assignments
>
> Is there any obvious mistake I am making here that can resolve the above
> error message?

Yes, 'ss' contains at least 1 NA, which is not allowed.  Prior to
using ss to select elements of variables to be assigned, ensure there
are no NAs.  One way would be with is.na().  For instance:

> ss <- c(1, 2, NA)
> ss[!is.na(ss)]
[1] 1 2

so you could use replace 'ss' with 'ss[!is.na(ss)]'.

Josh
>
> Thanks for your help.
> Chow
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-message-in-as-brob-Usage-tp2967885p2967885.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list