Hi, I am using the command>sample(c(0,1,2),1,prob=c(0.2,0.3,0.5))and I have this error notification "Error in sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)): unused argument(s)(1,prob=c(0.2,0.3,0.5)) I don't know what is going wrong. Please give me some suggestions. Thank you Best, Jing
Works for me:> sample(c(0,1,2),1,prob=c(0.2,0.3,0.5))[1] 2 On Thu, Feb 18, 2010 at 7:48 AM, <jxia@math.ucdavis.edu> wrote:> Hi, > > I am using the command > > >sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)) > > and I have this error notification > > "Error in sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)): > unused argument(s)(1,prob=c(0.2,0.3,0.5)) > > I don't know what is going wrong. Please give me some suggestions. > > Thank you > > > Best, > Jing > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
On 2010-02-18 8:48, jxia at math.ucdavis.edu wrote:> Hi, > > I am using the command > >> sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)) > > and I have this error notification > > "Error in sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)): > unused argument(s)(1,prob=c(0.2,0.3,0.5)) > > I don't know what is going wrong. Please give me some suggestions.Try this: rm(sample) sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)) -Peter Ehlers> > Thank you > > > Best, > Jing > > ______________________________________________ > 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. > >-- Peter Ehlers University of Calgary