[R] nchar on data.frames

ben@zoo.ufl.edu ben at zoo.ufl.edu
Thu Mar 29 04:29:58 CEST 2001


  Admittedly "protected by `I'" may not immediately conjure up the
particular construction shown below (although there is an example in the
help for data.frame() as well).  It doesn't mean that the text itself has
to begin with I, it means (as shown below) that the variable has to be
specified as I(x) rather than x itself.  This could be clumsy if for
example you wanted to convert a many-columned matrix to a data frame; I
guess you could do it with a loop (I just tried to figure out how to do it
with lapply() and a function levels(x)[x] which turns a factor back into a
text string, but it didn't work ...)

   Ben

On Wed, 28 Mar 2001, David White wrote:

>
> Ben mentions using
> %data.frame(text=I(temp$text),numbers=temp$numbers))
>
> to read in text and numeric data in data.frame. I have read the help pages
> about this, but not understood what was meant by protecting text data with
> I. Does this mean that any text entry beginning with "I" will be read as
> character string data variable rather than a factor?
>
> Many thanks!
>
> d
>
> S. David White
> sdavidwhite at bigfoot.com
> Columbus, Ohio
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list