[19154] in s-news-athena

home help back first fref pref prev next nref lref last post

[S] Summary: Changing factors to character vectors in

daemon@ATHENA.MIT.EDU (Michael Conklin)
Wed Sep 8 17:23:33 1999

Message-Id: <99Sep8.161834cdt.115207@gateway.cresearch.com>
Date: Wed, 8 Sep 1999 16:19:11 -0500
From: "Michael Conklin" <mconklin@customresearch.com>
To: <s-news@wubios.wustl.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline


Thanks to all who responded to my original post.(Reproduced below)

Terry Therneau suggested disabling the default as.data.frame.character
behavior by using:
  assign("as.data.frame.character", as.data.frame.vector, frame=0)

This, however, did not seem to have any effect in Splus 2000.


Marcelo A. Ferreira Gomes suggested using the as.is option when
creating the data.frame. I did not try this.

John James pointed me to an excellent solution. Using convert.col.type.


newdataframe<-convert.col.type(olddataframe,"@ALL", "character")

did the trick quite nicely. Thanks to all.

===============Original Post
Subject: [S] Changing factors to character vectors in data frames



I am experimenting with OLE automation and would like to put a data
frame into excel. Unfortunately, the data is character data which gets
coerced to factors when the data frame gets made. The factors get put
into Excel as their numeric level so I get a worksheet full of 1's and
2's instead of the actual data content.

Is there any way to prevent as.data.frame or data.frame from coercing
to factors. (The help file says using the I() function works but I
have
not had any success with it). I am using Splus 2000 on NT 4.0 sp4.


****************************************
Michael Conklin
VP Analytic Services
Custom Research Inc.
8401 Golden Valley Rd
Minneapolis, MN 55427
mconklin@customresearch.com 
612-542-0821 (Voice)
612-542-0864 (Fax)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
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

home help back first fref pref prev next nref lref last post