[rkward-devel] Setting Factor Levels... Broken?
meik michalke
Meik.Michalke at uni-duesseldorf.de
Tue Oct 2 11:35:14 UTC 2012
hi,
Am Dienstag, 2. Oktober 2012, 11:57:37 schrieb Thomas Friedrichsmeier:
> - Go to Settings->Configure RKWard->Command Log.
> - Check the leftmost three boxes for "application commmands" and
> "synchronization commands".
> - Try again.
> - Go to the Command log window, and copy and paste the relevant commands,
> here (starting with "my.data <- data.frame (..."
to my surprise, it does work on my other machine!
<snip>
my.data <- data.frame (var=as.numeric (rep (NA, 1)), var1=as.numeric (rep (NA,
1)), var2=as.numeric (rep (NA, 1)), var3=as.numeric (rep (NA, 1)),
var4=as.numeric (rep (NA, 1)))
.rk.get.structure.global ("my.data")
row.names (my.data) <- NULL
my.data[["var"]][1] <- NA
attr (my.data[["var"]], "levels") <- NULL
my.data[["var1"]][1] <- NA
attr (my.data[["var1"]], "levels") <- NULL
my.data[["var2"]][1] <- NA
attr (my.data[["var2"]], "levels") <- NULL
my.data[["var3"]][1] <- NA
attr (my.data[["var3"]], "levels") <- NULL
my.data[["var4"]][1] <- NA
attr (my.data[["var4"]], "levels") <- NULL
.rk.get.vector.data (row.names (my.data))
.rk.set.vector.mode(my.data[["var"]], as.factor)
attr (my.data[["var"]], "levels") <- NULL
my.data[["var"]][1] <- NA
attr (my.data[["var"]], "levels") <- c ("one", "two")
my.data[["var"]][1] <- NA
my.data[["var"]][1] <- "one"
.rk.data.frame.insert.row (my.data, 2)
row.names (my.data) <- NULL
my.data[["var"]][2] <- "two"
my.data
var var1 var2 var3 var4
1 one NA NA NA NA
2 two NA NA NA NA
</snip>
here's some details on the system where it works:
<working>
> rk.sessionInfo()
RKWard version: 0.5.7z+0.6.0+pre1
KDE version (runtime): 4.9.1
KDE version (compile time): 4.8.5 (4.8.5)
Local KDE directory: /home/m/.kde/
RKWard storage directory: /home/m/.rkward/
Debug message file(s) in use (these may contain relevant diagnostic output in
case of trouble):
/tmp/rkward.frontend.T11627
/tmp/rkward.rbackend.J11635
R version (compile time): 2.15.1 (2012-06-22 r59600)
R runtime session info:
R version 2.15.1 (2012-06-22)
Platform: i686-pc-linux-gnu (32-bit)
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C
LC_TIME=de_DE.UTF-8
[4] LC_COLLATE=de_DE.UTF-8 LC_MONETARY=de_DE.UTF-8
LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
[10] LC_TELEPHONE=de_DE.UTF-8 LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rkward_0.6.0
loaded via a namespace (and not attached):
[1] tools_2.15.1
</working>
i'll post details on the failing one later (it's a 64-bit system, that much i
can tell at once). i also tried this on our mac -- i can fully confirm the
report, the levels are not even stored in the first place, nothing shows up in
the command log at all when you try to set levels.
but try this:
1. create my.data
2. turn "var" into a factor
3. in the R console:
> my.data
NA var1 var2 var3 var4
1 <NA> NA NA NA NA
Warnmeldung:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
Korrupter Data Frame: Spalten werden abgeschnitten oder mit NAs aufgefüllt
4. after just setting the levels ("one", "two"):
> my.data
var var1 var2 var3 var4
1 <NA> NA NA NA NA
5. fill in data:
> my.data
var var1 var2 var3 var4
1 one NA NA NA NA
2 two NA NA NA NA
6. now remove the levels:
> my.data
var.NA var.NA var1 var2 var3 var4
1 <NA> <NA> NA NA NA NA
2 <NA> <NA> NA NA NA NA
Warnmeldung:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
Korrupter Data Frame: Spalten werden abgeschnitten oder mit NAs aufgefüllt
we suddenly gained a new variable? this is on the working machine -- can you
reproduce this?
viele grüße :: m.eik
--
dipl. psych. meik michalke
abt. f"ur diagnostik und differentielle psychologie
institut f"ur experimentelle psychologie
heinrich-heine-universit"at d"usseldorf
More information about the Rkward-devel
mailing list