[R] read.table question

Duncan Murdoch murdoch.duncan at gmail.com
Thu Dec 8 21:38:34 CET 2011


On 08/12/2011 3:28 PM, Pavan G wrote:
> Hello All,
> This works,
> results<- read.table("plink.txt",T)
>
> while this doesn't.
> results<- read.table("plink.txt")
>    Make sure your data frame contains columns CHR, BP, and P
>
> What does adding the "T" in read.table do? Which argument does this
> correspond to? I tried searching for it but didn't find the answer in:
>
>
>       read.table(file, header = FALSE, sep = "", quote = "\"'",
>                  dec = ".", row.names, col.names,
>                  as.is = !stringsAsFactors,
>                  na.strings = "NA", colClasses = NA, nrows = -1,
>                  skip = 0, check.names = TRUE, fill = !blank.lines.skip,
>                  strip.white = FALSE, blank.lines.skip = TRUE,
>                  comment.char = "#",
>                  allowEscapes = FALSE, flush = FALSE,
>                  stringsAsFactors = default.stringsAsFactors(),
>                  fileEncoding = "", encoding = "unknown")
>
>
> Could someone please explain?

You didn't name your arguments, so positional matching is used.  Your 
call is equivalent to

read.table(file = "plink.txt", header = T)

In most users' sessions, that's the same as

read.table(file = "plink.txt", header = TRUE)

and I'd guess that's true about yours.


Duncan Murdoch



More information about the R-help mailing list