s-news
[Top] [All Lists]

Re: [S] write.table() and factors

To: Nicole DePriest Demers <ntd@stat.ohio-state.edu>
Subject: Re: [S] write.table() and factors
From: Nicole DePriest Demers <ntd@stat.ohio-state.edu>
Date: Mon, 28 Jun 1999 14:17:30 -0400 (EDT)
Cc: s-news@wubios.wustl.edu
In-reply-to: <Pine.HPP.3.95.990628091241.5165A-100000@pegasus.mps.ohio-state.edu>
Reply-to: Nicole DePriest Demers <ntd@stat.ohio-state.edu>
Sender: owner-s-news@wubios.wustl.edu
As was politely pointed out by Bill Dunlap, Brian Ripley and Christian
Keller, you can't round a character string :-)  Omitting round() solved
the problem.

Nicole Demers

On Mon, 28 Jun 1999, Nicole DePriest Demers wrote:

> 
> Hello Splus Users,
> 
> My question is in regard to the write.table() function.  I have a
> dataframe with both numbers and character strings.  I am attempting to
> write some columns to an output file.  One of the columns I am trying
> to output consists of character strings.  However, I get the following
> error:
> 
> > write.table(round(bamowt.sqrt.df[,c(1,2,4:10,13)],6), file="tmp", sep="  ")
> Error in Math.data.frame(bamowt.sqrt.df[, c(1, 2, ..: Non-numeric 
> (non-complex)
>         variable: grouptyp
> Dumped
> 
> I suspect the problem has to do with the fact that I used read.table()
> to input the data originally so the character strings are now
> considered factors.  No problems occur when I omit the "grouptyp"
> column.  
> 
> Any suggestions or workarounds?
> 
> Please e-mail me and I will summarize to the group.
> 
> Thanks in advance,
> 
> Nicole Demers
> 
> 
> ______________________________________________________________________________
> Nicole Demers
> Statistics Department
> The Ohio State University
> 1958 Neil Ave., #404
> Columbus, OH 43210, USA
> (614) 292-6038
> ntd@stat.ohio-state.edu
> 
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message:  unsubscribe s-news
> 

______________________________________________________________________________


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>