[R] Reading T and F as strings

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jul 31 09:11:13 CEST 2007


Try this:

> Lines <- "Stock
+ T
+ F
+ "
> DF <- read.table(textConnection(Lines), header = TRUE,
+    colClasses = "character")
> class(DF$Stock)
[1] "character"


On 7/30/07, David Rowntree <david at watermarkgroup.com> wrote:
> Hi,
>
> I am trying to read a series of stock tickers into R, and I'm running
> into trouble with Ford (F) and the old AT&T (T).  Read.table seems to
> interpret these as boolean values instead of strings, even when I set
> colColumns to a vector of character(0)'s.  Is there a way to convince it
> to read them as strings?
>
> Thanks in advance for the help,
> David
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list