Using read.table creates a data frame that you store in dataen, rbinom wants a vector not a data frame, so try:
> rbinom(4857,1,dataen$pd) Or > rbinom(4857,1,dataen[[1]]) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Geisler Sent: Monday, October 02, 2006 4:01 PM To: [email protected] Subject: [R] Problem with rbinom Hello! I have the following problem: I calculate a variable called pd in Excel, save it as pd.txt, so that it looks like the following: pd 0.070568471 0.011275136 0.006892258 0.028592432 0.028489582 0.01881913 0.035426606 0.011517305 There were 4857 cases in pd.txt. After that I start R and load the data through the following command: daten <- read.table("pd.txt", header=T) Then I want to execute the function rbinom: rbinom(4857,1,daten) I get the following error message: Fehler in rbinom(n, size, prob) : ungültige Argumente (error in rbinom(n, size, prob) : bad arguments The problem is daten, because if I excecute rbinom(4857,1,0.5), then it works. So, I have no idea, what the problem could be. Alex -- Alexander Geisler * Moserhofgasse 36/1 * A-8010 Graz StV Technische Mathematik | FakV TMTP email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 ______________________________________________ [email protected] 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. ______________________________________________ [email protected] 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.
