Newbie question about read.table

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Newbie question about read.table

David Kaplan
Hi

When I use the read.table function with header = T, I notice that it gives me the variable names along the top as I expect.  But, when I then attempt an analysis, e.g. regression, it doesn't recognize the variable names.  Am I missing a step.  

Thank you

David


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

Steve Miller-4
Are you prefixing the variable names with the data.frame name, i.e.
mydf$col2, or referencing by index mydf[,2]?

Steve Miller

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of David Kaplan
Sent: Thursday, May 11, 2006 12:39 PM
To: [hidden email]
Subject: [R] Newbie question about read.table

Hi

When I use the read.table function with header = T, I notice that it gives
me the variable names along the top as I expect.  But, when I then attempt
an analysis, e.g. regression, it doesn't recognize the variable names.  Am I
missing a step.  

Thank you

David


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

Chuck Cleland
In reply to this post by David Kaplan
David Kaplan wrote:
> Hi
>
> When I use the read.table function with header = T, I notice that it gives me the variable names along the top as I expect.  But, when I then attempt an analysis, e.g. regression, it doesn't recognize the variable names.  Am I missing a step.  
>
> Thank you
>
> David

   Are you assigning the result of read.table() to a data frame.  And
then do you refer to that data frame in your call to lm()?  If that does
not solve the problem, you may want to show us the code you are using.

Chuck

> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

David Kaplan
Here is what I'm doing

 birthweight <- read.table("c:/bw.dat", header = T)
> summary(glm(low~age,binomial))
Error in eval(expr, envir, enclos) : object "low" not found
>


Thanks all!


----- Original Message -----
From: "Chuck Cleland" <[hidden email]>
To: "David Kaplan" <[hidden email]>
Cc: <[hidden email]>
Sent: Thursday, May 11, 2006 1:53 PM
Subject: Re: [R] Newbie question about read.table


> David Kaplan wrote:
>> Hi
>>
>> When I use the read.table function with header = T, I notice that it
>> gives me the variable names along the top as I expect.  But, when I then
>> attempt an analysis, e.g. regression, it doesn't recognize the variable
>> names.  Am I missing a step.  Thank you
>>
>> David
>
>   Are you assigning the result of read.table() to a data frame.  And then
> do you refer to that data frame in your call to lm()?  If that does not
> solve the problem, you may want to show us the code you are using.
>
> Chuck
>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>
> --
> Chuck Cleland, Ph.D.
> NDRI, Inc.
> 71 West 23rd Street, 8th floor
> New York, NY 10010
> tel: (212) 845-4495 (Tu, Th)
> tel: (732) 512-0171 (M, W, F)
> fax: (917) 438-0894
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

Chuck Cleland
David Kaplan wrote:
> Here is what I'm doing
>
> birthweight <- read.table("c:/bw.dat", header = T)
>> summary(glm(low~age,binomial))
> Error in eval(expr, envir, enclos) : object "low" not found
>>

Try this:

birthweight <- read.table("c:/bw.dat", header = TRUE)
summary(glm(low ~ age, family=binomial, data=birthweight))

> Thanks all!
>
>
> ----- Original Message ----- From: "Chuck Cleland" <[hidden email]>
> To: "David Kaplan" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Thursday, May 11, 2006 1:53 PM
> Subject: Re: [R] Newbie question about read.table
>
>
>> David Kaplan wrote:
>>> Hi
>>>
>>> When I use the read.table function with header = T, I notice that it
>>> gives me the variable names along the top as I expect.  But, when I
>>> then attempt an analysis, e.g. regression, it doesn't recognize the
>>> variable names.  Am I missing a step.  Thank you
>>>
>>> David
>>
>>   Are you assigning the result of read.table() to a data frame.  And
>> then do you refer to that data frame in your call to lm()?  If that
>> does not solve the problem, you may want to show us the code you are
>> using.
>>
>> Chuck
>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide!
>>> http://www.R-project.org/posting-guide.html
>>>
>>
>> --
>> Chuck Cleland, Ph.D.
>> NDRI, Inc.
>> 71 West 23rd Street, 8th floor
>> New York, NY 10010
>> tel: (212) 845-4495 (Tu, Th)
>> tel: (732) 512-0171 (M, W, F)
>> fax: (917) 438-0894
>>
>
>

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

Sean O'Riordain-2
In reply to this post by David Kaplan
Hi David,

you might need to either:
a) attach(birthweight)
or
b) glm(low~age,binomial, data=birthweight)

refer ?attach / ?glm

cheers,
Sean

On 11/05/06, David Kaplan <[hidden email]> wrote:

> Here is the code with the error
>
>  birthweight <- read.table("c:/bw.dat", header = T)
> > summary(glm(low~age,binomial))
> Error in eval(expr, envir, enclos) : object "low" not found
> >
>
>
> The read.table function works fine and when look at the data it shows the
> variable names across the top.  The data come from SPSS which I read out
> into a .dat file.
>
> Thanks
>
>
> ----- Original Message -----
> From: "Sean O'Riordain" <[hidden email]>
> To: "David Kaplan" <[hidden email]>
> Sent: Thursday, May 11, 2006 1:46 PM
> Subject: Re: [R] Newbie question about read.table
>
>
> Hi David,
> Can you show us the code that you're trying to use?
> cheers,
> Sean
>
> On 11/05/06, David Kaplan <[hidden email]> wrote:
> > Hi
> >
> > When I use the read.table function with header = T, I notice that it gives
> > me the variable names along the top as I expect.  But, when I then attempt
> > an analysis, e.g. regression, it doesn't recognize the variable names.  Am
> > I missing a step.
> >
> > Thank you
> >
> > David
> >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

David Kaplan
Thanks all.  I'll give the various suggestions a try.

Best

David


----- Original Message -----
From: "Sean O'Riordain" <[hidden email]>
To: "David Kaplan" <[hidden email]>; "r-help" <[hidden email]>
Sent: Thursday, May 11, 2006 2:05 PM
Subject: Re: [R] Newbie question about read.table


Hi David,

you might need to either:
a) attach(birthweight)
or
b) glm(low~age,binomial, data=birthweight)

refer ?attach / ?glm

cheers,
Sean

On 11/05/06, David Kaplan <[hidden email]> wrote:

> Here is the code with the error
>
>  birthweight <- read.table("c:/bw.dat", header = T)
> > summary(glm(low~age,binomial))
> Error in eval(expr, envir, enclos) : object "low" not found
> >
>
>
> The read.table function works fine and when look at the data it shows the
> variable names across the top.  The data come from SPSS which I read out
> into a .dat file.
>
> Thanks
>
>
> ----- Original Message -----
> From: "Sean O'Riordain" <[hidden email]>
> To: "David Kaplan" <[hidden email]>
> Sent: Thursday, May 11, 2006 1:46 PM
> Subject: Re: [R] Newbie question about read.table
>
>
> Hi David,
> Can you show us the code that you're trying to use?
> cheers,
> Sean
>
> On 11/05/06, David Kaplan <[hidden email]> wrote:
> > Hi
> >
> > When I use the read.table function with header = T, I notice that it
> > gives
> > me the variable names along the top as I expect.  But, when I then
> > attempt
> > an analysis, e.g. regression, it doesn't recognize the variable names.
> > Am
> > I missing a step.
> >
> > Thank you
> >
> > David
> >
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: Newbie question about read.table

David Kaplan
In reply to this post by Chuck Cleland
This worked!  Thanks!


----- Original Message -----
From: "Chuck Cleland" <[hidden email]>
To: "David Kaplan" <[hidden email]>
Cc: <[hidden email]>
Sent: Thursday, May 11, 2006 1:58 PM
Subject: Re: [R] Newbie question about read.table


> David Kaplan wrote:
>> Here is what I'm doing
>>
>> birthweight <- read.table("c:/bw.dat", header = T)
>>> summary(glm(low~age,binomial))
>> Error in eval(expr, envir, enclos) : object "low" not found
>>>
>
> Try this:
>
> birthweight <- read.table("c:/bw.dat", header = TRUE)
> summary(glm(low ~ age, family=binomial, data=birthweight))
>
>> Thanks all!
>>
>>
>> ----- Original Message ----- From: "Chuck Cleland"
>> <[hidden email]>
>> To: "David Kaplan" <[hidden email]>
>> Cc: <[hidden email]>
>> Sent: Thursday, May 11, 2006 1:53 PM
>> Subject: Re: [R] Newbie question about read.table
>>
>>
>>> David Kaplan wrote:
>>>> Hi
>>>>
>>>> When I use the read.table function with header = T, I notice that it
>>>> gives me the variable names along the top as I expect.  But, when I
>>>> then attempt an analysis, e.g. regression, it doesn't recognize the
>>>> variable names.  Am I missing a step.  Thank you
>>>>
>>>> David
>>>
>>>   Are you assigning the result of read.table() to a data frame.  And
>>> then do you refer to that data frame in your call to lm()?  If that does
>>> not solve the problem, you may want to show us the code you are using.
>>>
>>> Chuck
>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide!
>>>> http://www.R-project.org/posting-guide.html
>>>>
>>>
>>> --
>>> Chuck Cleland, Ph.D.
>>> NDRI, Inc.
>>> 71 West 23rd Street, 8th floor
>>> New York, NY 10010
>>> tel: (212) 845-4495 (Tu, Th)
>>> tel: (732) 512-0171 (M, W, F)
>>> fax: (917) 438-0894
>>>
>>
>>
>
> --
> Chuck Cleland, Ph.D.
> NDRI, Inc.
> 71 West 23rd Street, 8th floor
> New York, NY 10010
> tel: (212) 845-4495 (Tu, Th)
> tel: (732) 512-0171 (M, W, F)
> fax: (917) 438-0894
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html