Hi Amelie,
Could it be ok as it is?
If the only values are 0 & 1, it should similar to coding for a binary qualitative variable (e.g. presence/absence, male/female). I believe qualitative variables are "dummy-coded" with 0-1 anyway in order to calculate almost any statistics on them.
Try this for example:
##### R CODE
# variables
y <- rnorm(100)
xchar <- rep(c("a","b"), 50)
xnum <- rep(c(0,1), 50)
# both linear models give the same result
lm(y~xchar)
lm(y~xnum)
#####
Hope that helps...
Mick
On 2010-11-27, at 3:00 AM, <r-sig-ecology-request at r-project.org> <r-sig-ecology-request at r-project.org> wrote:
Send R-sig-ecology mailing list submissions to r-sig-ecology at r-project.org To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology or, via email, send a message with subject or body 'help' to r-sig-ecology-request at r-project.org You can reach the person managing the list at r-sig-ecology-owner at r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of R-sig-ecology digest..." Today's Topics: 1. keeping a variable as qualitative even if it is coded with numbers (amelie_can) 2. Re: keeping a variable as qualitative even if it is coded with numbers (Chris Howden) ---------------------------------------------------------------------- Message: 1 Date: Fri, 26 Nov 2010 09:40:38 -0800 (PST) From: amelie_can <amelie_qcan at hotmail.com> To: r-sig-ecology at r-project.org Subject: [R-sig-eco] keeping a variable as qualitative even if it is coded with numbers Message-ID: <1290793238498-5778025.post at n2.nabble.com> Content-Type: text/plain; charset=us-ascii Hello, I am running a fourthcorner analysis which links species abundance, functionnal traits and environmental variable. One of my trait is about seed dispersal (qualitative variable) in which I have four classes: wind, water, short and long distance. One species can have many types of dispersal. So in my original table, I created four different column. ex: wind water short long sp1 1 1 0 0 sp2 0 0 1 0 sp3 0 1 1 1 and so forth. My problem is that those variable are considered as quantitative but they are qualitative. I tried to transform them using the function as.factor but then it includes the 0 in my analysis and I am not interest in that. Any ideas to make those variable "qualitative"? Thank you all, Amelie -- View this message in context: http://r-sig-ecology.471788.n2.nabble.com/keeping-a-variable-as-qualitative-even-if-it-is-coded-with-numbers-tp5778025p5778025.html Sent from the r-sig-ecology mailing list archive at Nabble.com. ------------------------------ Message: 2 Date: Sat, 27 Nov 2010 10:17:00 +0930 From: Chris Howden <chris at trickysolutions.com.au> To: amelie_can <amelie_qcan at hotmail.com>, r-sig-ecology at r-project.org Subject: Re: [R-sig-eco] keeping a variable as qualitative even if it is coded with numbers Message-ID: <e833f192445f93f8b8ad310753153925 at mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 What do u mean it includes the 0's in your analysis? Are u sure as.factor is converting them to factors (have a look using str(data)) And if as.factor isn't working maybe try creating them as factors using factor() Chris Howden Founding Partner Tricky Solutions Tricky Solutions 4 Tricky Problems Evidence Based Strategic Development, IP Commercialisation and Innovation, Data Analysis, Modelling, and Training (mobile) 0410 689 945 (fax / office) (+618) 8952 7878 chris at trickysolutions.com.au -----Original Message----- From: r-sig-ecology-bounces at r-project.org [mailto:r-sig-ecology-bounces at r-project.org] On Behalf Of amelie_can Sent: Saturday, 27 November 2010 3:11 AM To: r-sig-ecology at r-project.org Subject: [R-sig-eco] keeping a variable as qualitative even if it is coded with numbers Hello, I am running a fourthcorner analysis which links species abundance, functionnal traits and environmental variable. One of my trait is about seed dispersal (qualitative variable) in which I have four classes: wind, water, short and long distance. One species can have many types of dispersal. So in my original table, I created four different column. ex: wind water short long sp1 1 1 0 0 sp2 0 0 1 0 sp3 0 1 1 1 and so forth. My problem is that those variable are considered as quantitative but they are qualitative. I tried to transform them using the function as.factor but then it includes the 0 in my analysis and I am not interest in that. Any ideas to make those variable "qualitative"? Thank you all, Amelie -- View this message in context: http://r-sig-ecology.471788.n2.nabble.com/keeping-a-variable-as-qualitativ e-even-if-it-is-coded-with-numbers-tp5778025p5778025.html Sent from the r-sig-ecology mailing list archive at Nabble.com. _______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology ------------------------------ _______________________________________________ R-sig-ecology mailing list R-sig-ecology at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-ecology End of R-sig-ecology Digest, Vol 32, Issue 25 *********************************************