Nordlund, Dan (DSHS/RDA) wrote:
-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of whitaker m. (mw1006)
Sent: Wednesday, December 16, 2009 2:14 PM
To: Nikhil Kaza; Petr PIKAL
Cc: r-help@r-project.org
Subject: Re: [R] Odp: Creating Dummy Variables in R
I have a much larger dataset than in my original email (attached - price
dependent
upon weight, Clarity (different levels IF-SI2), colour(levels D-L) and Cut
(ideal-fair),
and tried the regression command:
diamond.lm<-
lm(price~weight+IF+VVS1+VVS2+VS1+VS2+SI1+SI2+I1+I2+D+E+F+G+H+I+J+K
+L+ideal+excellent+very.good+good+fair, data="Diamonds2.txt")
Error in eval(predvars, data, env) : invalid 'envir' argument
Which lead to the error message below the command. I have tried searching for
this, and assumed this was down to having categrocial variables within the
data, is
this a correct assumption or am i doing something else wrong? Apologies if this
is a
bit of a basic question!
Thanks again,
Matthew
You need to read your data from Diamonds2.txt into a dataframe first before running the lm() function. What does your file Diamonds2.txt look like?
And, to put it more bluntly, he needs to study some introductory R text
rather more carefully to learn how the pieces fit together.
(Although I can see that the error may be cryptic to a beginner, I am at
a loss to explain what kind of leap of logic led him to believe that
dummy variables had _anything_ to do with it. For Heaven's sake, he must
be getting the same error if he leaves out the dummy variables!)
--
O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalga...@biostat.ku.dk) FAX: (+45) 35327907
______________________________________________
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.