Hello Tara,

To answer your question, I believe the simpler way you are looking for is
specifying the na.string argument in read.table().  Using na.string
specifies characters (or numbers) as missing data.  For instance...

I saved the first five lines of your data in a tab delimitted text file
called "helper.txt".  First I read it in without using the na.string
argument.

habitat <- read.table(file="helper.txt", header=TRUE, sep="\t")

##Notice the results of str()

> str(habitat)
'data.frame': 5 obs. of  13 variables:
 $ X     : int  1 2 3 4 5
 $ gdist : int  20 4 30 40 40
 $ gair  : num  8 13 12.6 12.6 2
 $ gsub  : num  14 15 16.4 17.9 1.8
 $ m6dist: num  -0.5 -0.1 -3 1 1
 $ m6air : Factor w/ 4 levels "24","24.5","25",..: 1 2 3 4 4          ##
particularly notice that where there were n/a
 $ m6sub : Factor w/ 4 levels "19","24.5","26",..: 1 2 3 4 4        ## it
was interpreted as a Factor
 $ m7dist: num  7 0.1 2.5 0.1 0.7
 $ m7air : num  12.1 11.4 9.7 8.1 10.2
 $ m7sub : num  16.1 15.1 12.8 15.2 24.1
 $ m8dist: num  2.5 2 0.1 2 2
 $ m8air : num  12 14 11.5 16 16
 $ m8sub : int  12 16 14 20 19

## Now telling R that n/a are missing data

habitat.na <- read.table(file="helper.txt", header=TRUE, sep="\t",
na.string="n/a")
> str(habitat.na)
'data.frame': 5 obs. of  13 variables:
 $ X     : int  1 2 3 4 5
 $ gdist : int  20 4 30 40 40
 $ gair  : num  8 13 12.6 12.6 2
 $ gsub  : num  14 15 16.4 17.9 1.8
 $ m6dist: num  -0.5 -0.1 -3 1 1
 $ m6air : num  24 24.5 25 NA NA         ## now the n/a's were replaced
 $ m6sub : num  19 24.5 26 NA NA       ## and it is interpreted as numeric
 $ m7dist: num  7 0.1 2.5 0.1 0.7
 $ m7air : num  12.1 11.4 9.7 8.1 10.2
 $ m7sub : num  16.1 15.1 12.8 15.2 24.1
 $ m8dist: num  2.5 2 0.1 2 2
 $ m8air : num  12 14 11.5 16 16
 $ m8sub : int  12 16 14 20 19


Once R knows that the data is missing, it should work the with linear
model.


Some other advice:
When you're providing data, it is often convenient to just give a few lines
(or representative sample).  Another really helpful way of providing data is
via dput().  The results of dput() can be read directly (e.g., pasting into
the console).  A helpful feature of dput() is that it preserves the object
class, this helps other people see exactly what you are working with.  Here
is the results of dput() from the habitat.na object above.

> dput(habitat.na)
structure(list(X = 1:5, gdist = c(20L, 4L, 30L, 40L, 40L), gair = c(8,
13, 12.6, 12.6, 2), gsub = c(14, 15, 16.4, 17.9, 1.8), m6dist = c(-0.5,
-0.1, -3, 1, 1), m6air = c(24, 24.5, 25, NA, NA), m6sub = c(19,
24.5, 26, NA, NA), m7dist = c(7, 0.1, 2.5, 0.1, 0.7), m7air = c(12.1,
11.4, 9.7, 8.1, 10.2), m7sub = c(16.1, 15.1, 12.8, 15.2, 24.1
), m8dist = c(2.5, 2, 0.1, 2, 2), m8air = c(12, 14, 11.5, 16,
16), m8sub = c(12L, 16L, 14L, 20L, 19L)), .Names = c("X", "gdist",
"gair", "gsub", "m6dist", "m6air", "m6sub", "m7dist", "m7air",
"m7sub", "m8dist", "m8air", "m8sub"), class = "data.frame", row.names =
c(NA,
-5L))


I hope this was understandable and helps.  I think you will really enjoy R
as you get to know it.


HTH,


Joshua


On Fri, Apr 16, 2010 at 1:08 PM, Tara Imlay <tara.leah@gmail.com> wrote:

> Hi,
>
> I am very new to R and I've been trying to work through the R book to gain
> a
> better idea of the code (which is also completely new to me).
>
> Initially I imputed my data from a text file and that seemed to work ok,
> but
> I'm trying to examine linear relationships between gdist and gair, gdist
> and
> gsub, m6dist and m6air, etc.
>
> This didn't work and I think it might have something to do with the n/a's
> in
> my dataset.
> > habitat
>    gdist gair gsub m6dist m6air m6sub m7dist m7air m7sub m8dist m8air m8sub
> 1      20    8   14   -0.5    24    19      7  12.1  16.1    2.5    12
>  12
> 2       4   13   15   -0.1  24.5  24.5    0.1  11.4  15.1      2    14
>  16
> 3      30 12.6 16.4     -3    25    26    2.5   9.7  12.8    0.1  11.5
>  14
> 4      40 12.6 17.9      1   n/a   n/a    0.1   8.1  15.2      2    16
>  20
> 5      40    2  1.8      1   n/a   n/a    0.7  10.2  24.1      2    16
>  19
> 6      10   13   31    1.5   n/a   n/a    n/a    20   n/a      2    17
>  20
> 7     0.1 19.1 27.9      1  24.5    26    0.1  20.6  22.4      6    17
>  21.5
> 8       1 23.4 33.1   0.25    25  24.5      2  22.4  24.1    1.5    17
>  18
> 9       7 23.5 30.5     -1  29.7    29    0.1  27.8  24.2      3    11
>  12
> 10      9 23.5 25.4      2   n/a   n/a      4  29.3  24.2      6    13
>  14
> 11      2 23.5   23   0.05  28.5    26      1  29.7  26.6      2    15
>  15
> 12      1 23.6 23.4    0.3  22.2  24.8    0.1  20.6  22.6      2    15
>  21
> 13    1.5   24 26.2    0.1  23.7  23.2    0.1  20.9  26.6      4  17.5
>  17
> 14      6 19.4 23.4   0.05  24.5  27.6      1  21.1  25.5      5    18
>  22
> 15    0.5 19.6 32.7    2.5  26.4   n/a      2  12.1  16.4      2    19
>  26
> 16      5 20.2 23.4    -12  22.4  26.1      2  14.4  16.6      1   n/a
> n/a
> 17     10 23.1 24.1    0.2  23.6  24.3    0.1  14.4  17.7      4     9
>  12
> 18      6   17   19    -10  23.6  21.5      1  16.2  16.9    0.1    10
>  12
> 19      6   17   19     60   n/a   n/a     10  13.3  24.3      3     8
>  12
> 20      2   19   21     60   n/a   n/a      7  19.5  23.9      3     9
>  13
> 21      2   19   21      2  17.3  17.3      2  21.1  25.5      2    10
>  15
> 22      2   20   23      2  17.3  17.3      3  21.5  21.4      4    11
>  16.5
> 23      3   20   23      2  22.5  24.1    1.5  17.6  21.7    0.1    12
>  15
> 24      1  8.1  8.6      2  22.5  24.5     10  17.7    23      8    15
>  21
> 25    2.5  8.4  9.6      3   n/a   n/a      1  22.3  26.8      2     8
>  14
> 26     15 11.5 12.1     20   n/a   n/a     -1  27.3  26.6      1    15
>  14
> 27   -0.5 13.6  9.3      5   n/a   n/a      1  27.4  31.3      3    15
>  12
> 28      4 13.9 16.6      7   n/a   n/a      1  23.2  30.1    0.1    13
>  16
> 29      1 14.7 17.7    1.5   n/a   n/a      3  18.9  31.4      3    16
>  21
> 30      5 14.9 23.3    0.2  23.3  25.3      3  18.9  29.7    0.1    16
>  18
> 31      6 14.9 19.1    2.5   n/a   n/a      5    19  24.8      8  13.5
>  16
> 32    2.5 14.9 21.6      3   n/a   n/a      4    19  20.5      3    20
>  23
> 33      8 15.4 14.6      4  13.3  12.8    0.3  20.5  25.8      1    20
>  18
> 34    0.2 16.3 16.2    3.5  14.5  15.7      8  20.6    28      1    21
>  23
> 35      7 17.4 19.4      2    16  15.7      8  22.3    23      1    21
>  25
> 36     12 18.7 21.1    0.5  14.5  13.5      8  22.3  21.6      2    12
>  14
> 37      1 18.8 18.9    n/a   n/a   n/a      7  22.3  23.4      3  13.5
>  24
> 38    1.5   19 21.7    n/a   n/a   n/a      7  14.5  18.6      3    14
>  27
> 39    1.5   19 19.3    n/a   n/a   n/a      7    15  18.6    0.3    14
>  21
> 40      1 19.4   21    n/a   n/a   n/a    0.1  17.3    21   0.01    15
>  16
> 41    0.3   19 17.9    n/a   n/a   n/a     10    18  26.3   0.01    16
>  14
> 42    0.2   19 17.9    n/a   n/a   n/a     10  18.1  24.9   0.25    16
>  25
> 43    0.2 21.5 18.4    n/a   n/a   n/a    2.5    19  21.1      2    15
>  18
> 44      1 22.1 22.3    n/a   n/a   n/a      2  19.5  21.1      2    18
>  18
> 45      2 22.5 20.6    n/a   n/a   n/a      1  24.1  27.7     -1    22
>  25
> 46     10  n/a  n/a    n/a   n/a   n/a    0.5  14.7  18.1     -1    23
>  22
> 47     10 21.1 25.8    n/a   n/a   n/a     15  16.4  20.3      3    23
>  30
> 48     30  n/a  n/a    n/a   n/a   n/a     15  16.4  20.3   0.15    30
>  24
> 49     10  n/a  n/a    n/a   n/a   n/a     16  16.4  23.2      4    23
>  23
> 50     10  n/a  n/a    n/a   n/a   n/a      8  18.2  22.5      3    23
>  24
> 51     15 14.4 20.2    n/a   n/a   n/a     10  18.2  24.5    0.1    26
>  29
> 52      3 12.7 19.7    n/a   n/a   n/a      8  18.7  22.5    0.2    20
>  21
> 53      5   14 14.7    n/a   n/a   n/a      3    19  24.1    1.5    21
>  21
> 54      1 16.9 17.9    n/a   n/a   n/a      4  20.7  26.2    1.5    23
>  23
> 55      2   17 17.9    n/a   n/a   n/a    3.5    17  18.8   0.05    24
>  24
> 56    0.5 11.2 11.7    n/a   n/a   n/a      3  17.4  20.4      2    26
>  26
> 57      0 12.7 14.7    n/a   n/a   n/a    1.5  19.4  21.2    n/a   n/a
> n/a
> 58      0 14.2   20    n/a   n/a   n/a      5   n/a   n/a     10    22
>  23
> 59    1.5 14.2 16.8    n/a   n/a   n/a      5  20.8  22.3      3    25
>  25
> 60     10 16.1    2    n/a   n/a   n/a      7  20.9  27.2      2    25
>  25
> 61    3.5 14.8   17    n/a   n/a   n/a      4    21  20.5      4    21
>  23
> 62    0.1 16.6 14.8    n/a   n/a   n/a      4  22.3  21.7     15    28
>  26
> 63   -0.1 17.1 26.9    n/a   n/a   n/a      8  22.3  27.3      2    23
>  22
> 64     -2 17.7 27.1    n/a   n/a   n/a      2  22.8  23.2      3    22
>  25
> 65    1.5 18.9 20.3    n/a   n/a   n/a      6  25.5  24.3      2    25
>  27
> 66      3 19.7 23.3    n/a   n/a   n/a      5   n/a   n/a    0.1    26
>  27
> 67   -0.3 20.4 23.4    n/a   n/a   n/a      7   n/a   n/a    0.5    28
>  36
> 68    0.3 23.3 33.6    n/a   n/a   n/a      7   n/a   n/a      3    27
>  29
> 69      0 20.8 25.4    n/a   n/a   n/a      6   n/a   n/a    1.5    23
>  23
> 70    0.7   22 26.6    n/a   n/a   n/a      4   n/a   n/a      2    23
>  23
> 71      2 22.4 25.8    n/a   n/a   n/a      4  23.1  21.8      2    24
>  25
> 72      0 23.4 26.6    n/a   n/a   n/a   0.05  23.2  24.4      2    24
>  25
> 73      5 19.4 24.1    n/a   n/a   n/a    0.1  25.3  28.4    0.2    24
>  24
> 74      8 19.6 27.1    n/a   n/a   n/a    0.5  25.4  25.4   -0.1    24
> n/a
> 75      5 19.6   27    n/a   n/a   n/a     10   n/a   n/a      2    18
>  19
> 76      1 19.7 29.8    n/a   n/a   n/a     -3  22.4  22.4     15    19
>  20
> 77      8 20.6 37.6    n/a   n/a   n/a     -2  22.8  21.6      4    17
>  19
> 78     15   21 23.7    n/a   n/a   n/a     -1  23.1  23.4      4    30
>  24
> 79      2 24.6 25.3    n/a   n/a   n/a     -3  23.1  24.1    n/a    26
> n/a
> 80    3.5 25.2 26.9    n/a   n/a   n/a   -3.5  24.5  20.5      1    28
> n/a
> 81      5 17.8 22.8    n/a   n/a   n/a    2.5  25.4  31.9    n/a    28
> n/a
> 82     15   20 24.6    n/a   n/a   n/a      7  19.6  20.4      2    29
> n/a
> 83      3 21.1 24.3    n/a   n/a   n/a     -3  23.1  27.1      1    24
> n/a
> 84      5 17.2 19.5    n/a   n/a   n/a      3  23.8  28.4      1    25
> n/a
> 85      7 17.2   18    n/a   n/a   n/a    0.5  24.4  25.2   0.75    25
> n/a
> 86   -0.3 23.8 24.5    n/a   n/a   n/a   -1.5  25.2  23.9      2    25
> n/a
> 87    0.2 25.9 26.5    n/a   n/a   n/a     -2  29.5  25.2      1    24
>  28
> 88     -3 20.4   24    n/a   n/a   n/a      6  29.8  33.6      5    18
>  21
> 89     -5 24.9 23.7    n/a   n/a   n/a      8  25.2  26.4     15    23
>  24
> 90    0.5 26.6   27    n/a   n/a   n/a   0.05    26  29.7      3    24
>  27
> 91   -0.8 27.3 25.4    n/a   n/a   n/a     20  23.4  26.3    1.5    25
> n/a
> 92      2   24 25.8    n/a   n/a   n/a      1  23.7  22.7      1    18
>  22
> 93   -0.1   26   28    n/a   n/a   n/a  -0.01  24.8  27.2     10    21
>  23
> 94      1   26   35    n/a   n/a   n/a      1    25  25.8     15    21
>  23
> 95      0   25 21.5    n/a   n/a   n/a    1.5  25.1  25.9      4    22
>  20
> 96     -3 26.9 25.9    n/a   n/a   n/a      2  25.3  26.6    n/a   n/a
> n/a
> 97    1.5 24.1 30.4    n/a   n/a   n/a      2  25.6  25.5    n/a   n/a
> n/a
> 98      1 24.1 24.8    n/a   n/a   n/a    1.5  25.8  28.5    n/a   n/a
> n/a
> 99     10 26.5 28.9    n/a   n/a   n/a      2  25.9    28    n/a   n/a
> n/a
> 100  -0.7 27.5 27.6    n/a   n/a   n/a      5  29.2  24.2    n/a   n/a
> n/a
> 101    -3 28.1 17.6    n/a   n/a   n/a    1.5   n/a   n/a    n/a   n/a
> n/a
> 102     1 29.7 28.3    n/a   n/a   n/a      2   n/a   n/a    n/a   n/a
> n/a
> 103     2   24 25.8    n/a   n/a   n/a      2   n/a   n/a    n/a   n/a
> n/a
> 104    30   28   29    n/a   n/a   n/a      2   n/a   n/a    n/a   n/a
> n/a
> 105    17   32   36    n/a   n/a   n/a      1   n/a   n/a    n/a   n/a
> n/a
> 106     8 19.1 23.2    n/a   n/a   n/a   0.01  30.2  30.4    n/a   n/a
> n/a
> 107     5 19.1 23.1    n/a   n/a   n/a     -3  31.6  35.7    n/a   n/a
> n/a
> 108    -3 23.7 25.4    n/a   n/a   n/a   0.01  27.5  25.1    n/a   n/a
> n/a
> 109  -2.5 24.1 25.1    n/a   n/a   n/a  -0.02  28.6  31.5    n/a   n/a
> n/a
> 110    -2 24.4 26.9    n/a   n/a   n/a      1  28.6  30.9    n/a   n/a
> n/a
> 111    -4 24.6 26.3    n/a   n/a   n/a      8  30.3  29.7    n/a   n/a
> n/a
> 112   0.7 21.3 24.7    n/a   n/a   n/a     -3  26.7  28.4    n/a   n/a
> n/a
> 113    -3 21.6 27.6    n/a   n/a   n/a      4  28.8  28.7    n/a   n/a
> n/a
> 114    -2   21   23    n/a   n/a   n/a    0.5  31.2  31.8    n/a   n/a
> n/a
> 115  -0.1   24   20    n/a   n/a   n/a      8  32.3  38.7    n/a   n/a
> n/a
> 116     3   26   21    n/a   n/a   n/a    0.1  26.4    27    n/a   n/a
> n/a
> 117  -0.2   27   24    n/a   n/a   n/a     -2  21.4  25.8    n/a   n/a
> n/a
> 118     1   28   28    n/a   n/a   n/a      3  22.3  25.8    n/a   n/a
> n/a
> 119   0.1 24.1 23.1    n/a   n/a   n/a      7    23  24.1    n/a   n/a
> n/a
> 120   3.5 24.5   25    n/a   n/a   n/a    0.2  24.5  27.1    n/a   n/a
> n/a
> 121   0.1 24.6 25.7    n/a   n/a   n/a      3  25.2  24.1    n/a   n/a
> n/a
> 122     3   28   24    n/a   n/a   n/a   -0.5  25.8  28.3    n/a   n/a
> n/a
> 123     5   29   28    n/a   n/a   n/a    0.2  25.8  27.8    n/a   n/a
> n/a
> 124    -2  n/a  n/a    n/a   n/a   n/a     10  26.3  23.3    n/a   n/a
> n/a
> 125   1.5  n/a  n/a    n/a   n/a   n/a     20  26.5    24    n/a   n/a
> n/a
> 126     3  n/a  n/a    n/a   n/a   n/a      3  26.5  24.3    n/a   n/a
> n/a
> 127  -0.2   26   24    n/a   n/a   n/a      3   n/a  27.7    n/a   n/a
> n/a
> 128  -0.1   26   22    n/a   n/a   n/a      2  23.3   n/a    n/a   n/a
> n/a
> 129     3   19   22    n/a   n/a   n/a      8  23.9  25.9    n/a   n/a
> n/a
> 130     2   21   25    n/a   n/a   n/a  -0.05  24.4  26.7    n/a   n/a
> n/a
> 131     1   15   15    n/a   n/a   n/a   -0.1  24.8  25.1    n/a   n/a
> n/a
> 132     6   16   18    n/a   n/a   n/a  -0.01  26.2  26.2    n/a   n/a
> n/a
> 133     6   18   19    n/a   n/a   n/a   0.01  26.2  27.6    n/a   n/a
> n/a
> 134  -0.2   16   19    n/a   n/a   n/a     12    27  26.4    n/a   n/a
> n/a
> 135     2   17 18.5    n/a   n/a   n/a    0.1  27.6  28.8    n/a   n/a
> n/a
> 136   0.1 17.5 16.5    n/a   n/a   n/a   -1.2  21.1  22.2    n/a   n/a
> n/a
> 137   1.5   18   17    n/a   n/a   n/a     -2  21.1  22.4    n/a   n/a
> n/a
> 138    -1   18   17    n/a   n/a   n/a    0.5  21.4  25.4    n/a   n/a
> n/a
> 139     8   18 18.5    n/a   n/a   n/a      1  22.6  24.4    n/a   n/a
> n/a
> 140   1.5   19 18.5    n/a   n/a   n/a      1  25.1  31.4    n/a   n/a
> n/a
> 141     5   19   21    n/a   n/a   n/a      2  25.2    25    n/a   n/a
> n/a
> 142    10   19   20    n/a   n/a   n/a    0.5  25.2  30.2    n/a   n/a
> n/a
> 143     8   19   21    n/a   n/a   n/a      5  22.3  23.5    n/a   n/a
> n/a
> 144     6   19   18    n/a   n/a   n/a    0.1  24.1  23.4    n/a   n/a
> n/a
> 145     0   20   20    n/a   n/a   n/a    1.5  24.1    24    n/a   n/a
> n/a
> 146   0.3   12   13    n/a   n/a   n/a      1  25.2  27.9    n/a   n/a
> n/a
> 147   2.5   13 12.5    n/a   n/a   n/a      5  25.2  27.6    n/a   n/a
> n/a
> 148     2   14   16    n/a   n/a   n/a      1  25.2  29.1    n/a   n/a
> n/a
> 149    40   14   12    n/a   n/a   n/a   -1.5  26.5    27    n/a   n/a
> n/a
> 150    30   15   16    n/a   n/a   n/a    n/a   n/a   n/a    n/a   n/a
> n/a
> 151    40 15.5   16    n/a   n/a   n/a   0.01   n/a   n/a    n/a   n/a
> n/a
> 152    50   18 12.5    n/a   n/a   n/a  -0.02   n/a   n/a    n/a   n/a
> n/a
> 153   n/a  n/a  n/a    n/a   n/a   n/a   0.05   n/a   n/a    n/a   n/a
> n/a
> 154    40   14   21    n/a   n/a   n/a     -1   n/a   n/a    n/a   n/a
> n/a
> 155   n/a  n/a  n/a    n/a   n/a   n/a   0.05   n/a   n/a    n/a   n/a
> n/a
> 156   n/a  n/a  n/a    n/a   n/a   n/a    -10   n/a   n/a    n/a   n/a
> n/a
> 157   n/a  n/a  n/a    n/a   n/a   n/a    0.1  19.3  19.8    n/a   n/a
> n/a
> 158   n/a  n/a  n/a    n/a   n/a   n/a    0.5    21  26.2    n/a   n/a
> n/a
> 159   n/a  n/a  n/a    n/a   n/a   n/a      1   n/a   n/a    n/a   n/a
> n/a
> 160   n/a  n/a  n/a    n/a   n/a   n/a    n/a   n/a   n/a    n/a   n/a
> n/a
> 161   n/a  n/a  n/a    n/a   n/a   n/a   0.15  22.8  23.3    n/a   n/a
> n/a
> 162   n/a  n/a  n/a    n/a   n/a   n/a      1  24.3  26.5    n/a   n/a
> n/a
> 163   n/a  n/a  n/a    n/a   n/a   n/a      2  24.4  24.6    n/a   n/a
> n/a
> 164   n/a  n/a  n/a    n/a   n/a   n/a      3    15  18.5    n/a   n/a
> n/a
> 165   n/a  n/a  n/a    n/a   n/a   n/a      4   n/a   n/a    n/a   n/a
> n/a
> 166   n/a  n/a  n/a    n/a   n/a   n/a     15   n/a   n/a    n/a   n/a
> n/a
> 167   n/a  n/a  n/a    n/a   n/a   n/a      4   n/a   n/a    n/a   n/a
> n/a
> 168   n/a  n/a  n/a    n/a   n/a   n/a    0.3   n/a   n/a    n/a   n/a
> n/a
> 169   n/a  n/a  n/a    n/a   n/a   n/a    1.5   n/a   n/a    n/a   n/a
> n/a
> 170   n/a  n/a  n/a    n/a   n/a   n/a      0   n/a   n/a    n/a   n/a
> n/a
> 171   n/a  n/a  n/a    n/a   n/a   n/a      3   n/a   n/a    n/a   n/a
> n/a
> 172   n/a  n/a  n/a    n/a   n/a   n/a    0.1    17    18    n/a   n/a
> n/a
> 173   n/a  n/a  n/a    n/a   n/a   n/a    0.2  17.5    18    n/a   n/a
> n/a
> 174   n/a  n/a  n/a    n/a   n/a   n/a      5    20    21    n/a   n/a
> n/a
> 175   n/a  n/a  n/a    n/a   n/a   n/a      1    10    12    n/a   n/a
> n/a
> 176   n/a  n/a  n/a    n/a   n/a   n/a      2  13.5    12    n/a   n/a
> n/a
> 177   n/a  n/a  n/a    n/a   n/a   n/a      2    12    12    n/a   n/a
> n/a
> 178   n/a  n/a  n/a    n/a   n/a   n/a    2.5    13    15    n/a   n/a
> n/a
> 179   n/a  n/a  n/a    n/a   n/a   n/a     10  12.5    14    n/a   n/a
> n/a
>
> I had to give up on this data set, because I wasn't sure how to fix the
> problem, so I've been creating separate text files for all the combinations
> I'm interested in without the extra n/a's.  This is really time consuming,
> and I know there is probably a simpler way I just don't know what it is!
>
> I managed to run a lm with just the data in a separate file for gdist and
> gair and I have a few outliers.  I've tried to remove them with g_dist_air2
> <- update(g_dist_air, subset=(gair !=97)), but this doesn't seem to work.
> > g_dist_temp
>    gdist gair
> 1    17.0 32.0
> 2     1.0 29.7
> 3     5.0 29.0
> 4    -3.0 28.1
> 5    30.0 28.0
> 6     1.0 28.0
> 7     3.0 28.0
> 8    -0.7 27.5
> 9    -0.8 27.3
> 10   -0.2 27.0
> 11   -3.0 26.9
> 12    0.5 26.6
> 13   10.0 26.5
> 14   -0.1 26.0
> 15    1.0 26.0
> 16    3.0 26.0
> 17   -0.2 26.0
> 18   -0.1 26.0
> 19    0.2 25.9
> 20    3.5 25.2
> 21    0.0 25.0
> 22   -5.0 24.9
> 23    2.0 24.6
> 24   -4.0 24.6
> 25    0.1 24.6
> 26    3.5 24.5
> 27   -2.0 24.4
> 28    1.5 24.1
> 29    1.0 24.1
> 30   -2.5 24.1
> 31    0.1 24.1
> 32    1.5 24.0
> 33    2.0 24.0
> 34    2.0 24.0
> 35   -0.1 24.0
> 36   -0.3 23.8
> 37   -3.0 23.7
> 38    1.0 23.6
> 39    7.0 23.5
> 40    9.0 23.5
> 41    2.0 23.5
> 42    1.0 23.4
> 43    0.0 23.4
> 44    0.3 23.3
> 45   10.0 23.1
> 46    2.0 22.5
> 47    2.0 22.4
> 48    1.0 22.1
> 49    0.7 22.0
> 50   -3.0 21.6
> 51    0.2 21.5
> 52    0.7 21.3
> 53   10.0 21.1
> 54    3.0 21.1
> 55   15.0 21.0
> 56   -2.0 21.0
> 57    2.0 21.0
> 58    0.0 20.8
> 59    8.0 20.6
> 60   -0.3 20.4
> 61   -3.0 20.4
> 62    5.0 20.2
> 63    2.0 20.0
> 64    3.0 20.0
> 65   15.0 20.0
> 66    0.0 20.0
> 67    3.0 19.7
> 68    1.0 19.7
> 69    0.5 19.6
> 70    8.0 19.6
> 71    5.0 19.6
> 72    6.0 19.4
> 73    1.0 19.4
> 74    5.0 19.4
> 75    0.1 19.1
> 76    8.0 19.1
> 77    5.0 19.1
> 78    2.0 19.0
> 79    2.0 19.0
> 80    1.5 19.0
> 81    1.5 19.0
> 82    0.3 19.0
> 83    0.2 19.0
> 84    3.0 19.0
> 85    1.5 19.0
> 86    5.0 19.0
> 87   10.0 19.0
> 88    8.0 19.0
> 89    6.0 19.0
> 90    1.5 18.9
> 91    1.0 18.8
> 92   12.0 18.7
> 93    6.0 18.0
> 94    1.5 18.0
> 95   -1.0 18.0
> 96    8.0 18.0
> 97   50.0 18.0
> 98    5.0 17.8
> 99   -2.0 17.7
> 100   0.1 17.5
> 101   7.0 17.4
> 102   5.0 17.2
> 103   7.0 17.2
> 104  -0.1 17.1
> 105   6.0 17.0
> 106   6.0 17.0
> 107   2.0 17.0
> 108   2.0 17.0
> 109   1.0 16.9
> 110   0.1 16.6
> 111   0.2 16.3
> 112  10.0 16.1
> 113   6.0 16.0
> 114  -0.2 16.0
> 115  40.0 15.5
> 116   8.0 15.4
> 117   1.0 15.0
> 118  30.0 15.0
> 119   5.0 14.9
> 120   6.0 14.9
> 121   2.5 14.9
> 122   3.5 14.8
> 123   1.0 14.7
> 124  15.0 14.4
> 125   0.0 14.2
> 126   1.5 14.2
> 127   5.0 14.0
> 128   2.0 14.0
> 129  40.0 14.0
> 130  40.0 14.0
> 131   4.0 13.9
> 132  -0.5 13.6
> 133   4.0 13.0
> 134  10.0 13.0
> 135   2.5 13.0
> 136   3.0 12.7
> 137   0.0 12.7
> 138  30.0 12.6
> 139  40.0 12.6
> 140   0.3 12.0
> 141  15.0 11.5
> 142   0.5 11.2
> 143   2.5  8.4
> 144   1.0  8.1
> 145  20.0  8.0
> 146  40.0  2.0
>
> Are there any other ways to remove lines from data sets?  Or is there
> something wrong with my code?
>
> Is there anyway to use my old data set with all the n/a's to look at
> relationships between the variables?  Ideally I want to add in more habitat
> variables to this analysis, that will include some categorical data and
> more
> n/a's since the data collection was not complete with every observation.
>
> Any help is appreciated.
>
> Tara
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joshua Wiley
Senior in Psychology
University of California, Riverside
http://www.joshuawiley.com/

	[[alternative HTML version deleted]]

