Mike Dunbar | 4 Jul 10:30
Picon
Favicon

Re: help with assignment

Exactly: STEER WELL CLEAR OF attach(). This is just the sort of problem you can get into.
Mike

>>> tyler <tyler.smith@...> 04/07/2008 00:11 >>>
"Olivia LeDee" <lede0025@...> writes:

> Would someone mind helping with the following code:
>
> 1) After attaching the primary dataset
>
> ambi1<-read.table("ambi.txt",header=TRUE,sep='\t')
> attach(ambi1)

> 2) I would like to change na's for variable (pwd) to 0
> pwd[is.na(pwd)]<-0
>
> 3) Then, I need the results of the following based on all observations.
> sqrt(area)
> m1<-lm(prs~area+sqrt(area))
> summary(m1)
> residuals(m1)
>
> 3) Next, I would like to omit na's from the rest of the dataset. I need this
> truncated dataset to include 0's for variable pwd.
>
> ambi2<-na.omit(ambi1)
>
> In this process, I am overwriting step 2. Can someone help (other than
> omitting na's for each column)?
>
(Continue reading)


Gmane