[R] stringsAsFactors has no impact in expand.grid()?
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Jun 25 14:55:39 CEST 2009
It works for me. Try a more recent version of R.
> a <- c("PR", "NC", "A2", "BS")
> b <- c(1, 0.5, 0.25, 0.125, 0.0625, 0.03125)
>
> class(expand.grid(a, b, stringsAsFactors=FALSE)[[1]])
[1] "character"
> class(expand.grid(a, b, stringsAsFactors=TRUE)[[1]])
[1] "factor"
> R.version.string
[1] "R version 2.9.1 RC (2009-06-19 r48804)"
On Thu, Jun 25, 2009 at 7:21 AM, Rainer M Krug<r.m.krug at gmail.com> wrote:
> Hi
>
> I have the feeling, that the argument stringsAsFactors has no impact in the
> function expand.grid:
>
> a <- c("PR", "NC", "A2", "BS")
> b <- c(1, 0.5, 0.25, 0.125, 0.0625, 0.03125)
>
> class(expand.grid(css, fscs, stringsAsFactors=FALSE)[[1]])
> [1] "factor"
> class(expand.grid(css, fscs, stringsAsFactors=TRUE)[[1]])
> [1] "factor"
>
> Also, when I look at the code of expand.grid, stringsAsFactors does not
> occur in the code.
>
> Am I missing something?
>
>> version
> _
> platform i486-pc-linux-gnu
> arch i486
> os linux-gnu
> system i486, linux-gnu
> status
> major 2
> minor 9.0
> year 2009
> month 04
> day 17
> svn rev 48333
> language R
> version.string R version 2.9.0 (2009-04-17)
>
> Cheers,
>
> Rainer
> --
> Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch
> University, South Africa
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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