Mam problem z expand.grid
. Wygląda na to, że ignoruję opcje ustawione u góry mojego skryptu.Dlaczego expand.grid ignoruje opcje?
Dla exmaple:
options(stringsAsFactors = FALSE)
tmp <- expand.grid(x = letters, y = 1:10)
powraca:
> str(tmp)
'data.frame': 260 obs. of 2 variables:
$ x: Factor w/ 26 levels "a","b","c","d",..: 1 2 3 4 5 6 7 8 9 10 ...
$ y: int 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "out.attrs")=List of 2
..$ dim : Named int 26 10
.. ..- attr(*, "names")= chr "x" "y"
..$ dimnames:List of 2
.. ..$ x: chr "x=a" "x=b" "x=c" "x=d" ...
.. ..$ y: chr "y= 1" "y= 2" "y= 3" "y= 4" ...
Co robię źle?
Ponieważ argument jest zakodowana, zamiast ustawiać jako 'default.stringsAsFactors()'. Prawdopodobnie coś, co można by podnieść jako potencjalną zmianę, jak sądzę, jeśli masz grubą skórę. – joran
'? Options' sugeruje, że' opcje (stringAsFactors = FALSE) 'będą miały wpływ tylko na' data.frame' i 'read.table':" "stringiAsFactors": Domyślne ustawienie dla argumentów "data.frame" i "read. stół'." –