Re: [Rd] possible bug in 'scan'

From: Dan Davison <davison_at_stats.ox.ac.uk>
Date: Tue, 26 Jun 2007 17:24:37 +0100

Hi Ben,

On Tue, Jun 26, 2007 at 11:58:35AM -0400, Benjamin Tyner wrote:
> R-devel,
>
> When I run the following code on the attached file,
>
> tmp <- scan("C:/temp.csv",
> what=list("character","numeric"),
> sep=",")
>
> Then tmp[[2]] is a character vector. My impression from the help file
> is that it should be a numeric as specified by 'what'

?scan says

[...]
 what: the type of 'what' gives the type of data to be read. [...]

so for example

what=list(character(), numeric())

would presumably have worked, but not your code, as both of your list elements are of type character.

Dan

>
> >sessionInfo()
> R version 2.5.0 (2007-04-23)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] "stats" "graphics" "grDevices" "utils" "datasets"
> "methods" "base"
>
> other attached packages:
> lattice gdata
> "0.15-5" "2.3.1"
>
> My apologies if this is due to my misunderstanding.
> Ben

> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 26 Jun 2007 - 17:07:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Jun 2007 - 17:35:44 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.