[R] Vegan dataframe not acting nicely

Gavin Simpson gavin.simpson at ucl.ac.uk
Fri Apr 11 09:10:55 CEST 2008


On Thu, 2008-04-10 at 20:59 -0400, stephen sefick wrote:
> This is what my data looks like
> 
>                                 DOC  TOC  TKN
> RM119mFeb-06  1         2        3
> RM61mFeb-06     2        4        6
> 
> I have this both in a .csv and .txt  I have read this in with

Your data can't possibly look like that if you "get" the print out you
paste below. I presume you want column that has ended up being labeled
as 'X' as the rownames for your read-in object? It looks like R is
reading this as a variable, probably because you don't have the
delimiters in the header row right? But because you didn't paste the
first 2-3 lines of the actual file (as a minimum), we are not able to
diagnose the problem for you.

Also, what does this have to do with 'vegan'? This is a basic R import
issue.

Feel free to send the file to me off list (or the first few lines of the
file) and I'll see why it isn't being read in as you want. I promise to
do nothing with the data (other than show you how to read them in to R)
and delete them immediately thereafter.

HTH

G

> 
> read.csv("chemodr.csv", header=T)
> 
> and this is what I get
> 
>               X dAmon   DN.N Nitrite.N  DOC    OP       P   TKN  TOC
> 1   RM215mFeb-06 0.000 0.1300    0.0000  2.5 0.057  0.0420 0.420  2.2
> 2      SCmFeb-06 0.000 0.1200    0.0000 13.0 0.130  0.0960 0.950 12.0
> 3   RM202mFeb-06 0.000 0.1300    0.0000  4.6 0.035  0.0760 0.610  4.3
> 4   RM198mFeb-06 0.000 0.1300    0.0044  5.4 0.032  0.0330 0.910  5.0
> 5      HCmFeb-06 0.000 0.2800    0.0000  3.0 0.016  0.0220 0.800  3.1
> 6   RM190mFeb-06 0.000 0.1600    0.0130  3.3 0.068  0.0480 0.780  3.4
> 
> I can not do any ordination analysis because of the X column which is
> the Site column of my data set.  How do I get this read in with dAmon
> ... TOC as the "species" and the X column as the "site" column. I am
> sure that I am missing something simple.
> thanks
> 
> Stephen
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list