Skip to content
Prev 1570 / 7420 Next

NMDS vegan

On Tue, 2010-10-26 at 14:30 -0400, Soumi Ray wrote:
I really, really doubt that. A blank is the same as an NA as far as
read.csv() and read.table are concerned. With this in a csv file named
"foo.csv":

"Site","Var1","Var2","Var3"
"A",1,2,1
"B",2,3,2
"C",3,"NA",3
"D",4,3,4
"E",5,4,5
"F",,4,6
"G",6,5,7
"H",7,67,
"I",8,7,"NA"
"J",9,8,3
"K",10,1,4
"L",11,9,5

When read into R, the two blanks *and* the two "NA" strings are all
converted to NA (missing) within R:
Site Var1 Var2 Var3
1     A    1    2    1
2     B    2    3    2
3     C    3   NA    3
4     D    4    3    4
5     E    5    4    5
6     F   NA    4    6
7     G    6    5    7
8     H    7   67   NA
9     I    8    7   NA
10    J    9    8    3
11    K   10    1    4
12    L   11    9    5
'data.frame':	12 obs. of  4 variables:
 $ Site: Factor w/ 12 levels "A","B","C","D",..: 1 2 3 4 5 6 7 8 9
10 ...
 $ Var1: int  1 2 3 4 5 NA 6 7 8 9 ...
 $ Var2: int  2 3 NA 3 4 4 5 67 7 8 ...
 $ Var3: int  1 2 3 4 5 6 7 NA NA 3 ...
You don't need to. Blank is fine. As Jari pointed out, your problems
were due to other things. That these sorted themselves out whilst you
fiddled with your data, does not mean the fiddling worked ;-)

HTH

G