[R] Odp: Creating Dummy Variables in R
Petr PIKAL
petr.pikal at precheza.cz
Wed Dec 16 16:12:02 CET 2009
Hi
r-help-bounces at r-project.org napsal dne 16.12.2009 15:58:56:
> Hi,
> I am trying to create a set of dummy variables to use within a multiple
linear
> regression and am unable to find the codes within the manuals.
>
> For example i have:
> Price Weight Clarity
> IF VVS1 VVS2
> 500 8 1 0 0
> 1000 5.2 0 0 1
> 864 3 0 1 0
> 340 2.6 0 0 1
> 90 0.5 1 0 0
> 450 2.3 0 1 0
>
> Where price is dependent upon weight (single value in each observation)
and
> clarity (split into three levels, IF, VVS1, VVS2).
> I am having trouble telling the program that clarity is a set of 3 dummy
> variables and keep getting error messages, what is the correct way?
Well, try to bribe it. Or ask what please it to break its resistance.
Seriously. What is a structure of your data in R.
?str
what commands did you use for regression
I suppose
lm(Price~Weight+IF+VVS1+VVS2, data=your.data)
shall not complain if your.data is a data frame.
Regards
Petr
>
> Any helps is greatly appreciated.
> Matthew
>
> ______________________________________________
> 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.
More information about the R-help
mailing list