Quantcast

'x' must be numeric..

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

'x' must be numeric..

Wobbe Gong
Hi,

I have a problem that appears to be quite common - warnings that 'x' must
be numeric. How can I get rid of that problem?

specifically, I am trying to run an mrpp with a species-site data set plus
a second file containing factors. Both files are saved as .csv and comma
separated. I have tried  to remove the column titles in a number of ways to
not cause the problem to begin with, but r wasn't really impressed.

what I've done so far is:
#reading my species-site data set
mzbtaxa<-read.csv("MZBTaxa.csv", header=TRUE, dec=",", sep=";")
mzbtaxa
names(mzbtaxa)

#reading my factors file
mzbsites<-read.csv("MZBSites.csv", header=TRUE, dec=",", sep=";")
mzbsites
names(mzbsites)

#loading package
library(vegan)

##trying to run mrpp
mzbtaxa.mrpp <- mrpp(mzbtaxa, mzbsites$Site, distance = "bray")

##which is where I get my warning 'x' must be numeric. Any ideas how to
deal with that?

Many thanks in advance,

Claudia Pogoreutz

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 'x' must be numeric..

Adams, Jean
What do you get when you type in these commands?

lapply(mzbtaxa, class)
lapply(mzbsites, class)

Do you get the same error if you use the as.is=TRUE argument in the
read.csv() function?

mzbtaxa<-read.csv("MZBTaxa.csv", header=TRUE, dec=",", sep=";", as.is=TRUE)
mzbsites<-read.csv("MZBSites.csv", header=TRUE, dec=",", sep=";", as.is=TRUE
)

Jean



On Wed, May 29, 2013 at 11:16 AM, Wobbe Gong <[hidden email]> wrote:

> Hi,
>
> I have a problem that appears to be quite common - warnings that 'x' must
> be numeric. How can I get rid of that problem?
>
> specifically, I am trying to run an mrpp with a species-site data set plus
> a second file containing factors. Both files are saved as .csv and comma
> separated. I have tried  to remove the column titles in a number of ways to
> not cause the problem to begin with, but r wasn't really impressed.
>
> what I've done so far is:
> #reading my species-site data set
> mzbtaxa<-read.csv("MZBTaxa.csv", header=TRUE, dec=",", sep=";")
> mzbtaxa
> names(mzbtaxa)
>
> #reading my factors file
> mzbsites<-read.csv("MZBSites.csv", header=TRUE, dec=",", sep=";")
> mzbsites
> names(mzbsites)
>
> #loading package
> library(vegan)
>
> ##trying to run mrpp
> mzbtaxa.mrpp <- mrpp(mzbtaxa, mzbsites$Site, distance = "bray")
>
> ##which is where I get my warning 'x' must be numeric. Any ideas how to
> deal with that?
>
> Many thanks in advance,
>
> Claudia Pogoreutz
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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]]

______________________________________________
[hidden email] 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.
Loading...