Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

error with rda test in vegan r package. Variable not being read correctly

$
0
0

I am trying to perform a simple RDA using the vegan package to test the effects of depth, basin and sector on genetic population structure using the following data frame.

datafile.

The "ALL" variable is the genetic population assignment (structure).

In case the link to my data doesn't work well, I'll paste a snippet of my data frame here.

enter image description here

I read in the data this way:

RDAmorph_Oct6 <- read.csv("RDAmorph_Oct6.csv")

My problems are two-fold: 1) I can't seem to get my genetic variable to read correctly. I have tried three things to fix this.

gen=rda(ALL ~ Depth + Basin + Sector, data=RDAmorph_Oct6, na.action="na.exclude")
Error in eval(specdata, environment(formula), enclos = globalenv()) : 
  object 'ALL' not found
In addition: There were 12 warnings (use warnings() to see them)

so, I tried things like:

> gen=rda("ALL ~ Depth + Basin + Sector", data=RDAmorph_Oct6, na.action="na.exclude")
Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric

so I specified numeric

> RDAmorph_Oct6$ALL = as.numeric(RDAmorph_Oct6$ALL)
> gen=rda("ALL ~ Depth + Basin + Sector", data=RDAmorph_Oct6, na.action="na.exclude")
Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric

I am really baffled. I've also tried specifying each variable with dataset$variable, but this doesn't work either.

The strange thing is, I can get an rda to work if I look the effects of the environmental variables on a different, composite, variable

MC = RDAmorph_Oct6[,5:6]
H_morph_var=rda(MC ~ Depth + Basin + Sector, data=RDAmorph_Oct6, na.action="na.exclude")

Note that I did try to just extract the ALL column for the genetic rda above. This didn't work either. Regardless, this leads to my second problem.

When I try to plot the rda I get a super weird plot. Note the five dots in three places. I have no idea where these come from.

enter image description here

I will have to graph the genetic rda, and I figure I'll come up with the same issue, so I thought I'd ask now.

I've been though several tutorials and tried many iterations of each issue. What I have provided here is I think the best summary. If anyone can give me some clues, I would much appreciate it.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>