[rkward-devel] Setting Factor Levels... Broken?

meik michalke meik.michalke at uni-duesseldorf.de
Wed Oct 3 15:27:07 UTC 2012


hi,

am Dienstag 02 Oktober 2012, 18:28:21 schrieb Thomas Friedrichsmeier:
> When testing on the other machine, please make sure to test once more
> *before* updating to the next daily build, and once after, so we can tell
> for sure whether this is really fixed.

even more odd, i can't reproduce it today, before the update. i'm still 
running 0.5.7z+0.5.8-0daily+3749+201210020147~precise1, but today i don't get 
any problems:

<commandLog>
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))

str(my.data)

'data.frame':	1 obs. of  5 variables:
 $ var : num NA
 $ var1: num NA
 $ var2: num NA
 $ var3: num NA
 $ var4: num NA

.rk.set.vector.mode(my.data[["var"]], as.factor)
attr (my.data[["var"]], "levels") <- NULL

my.data[["var"]][1] <- NA


str(my.data)

'data.frame':	1 obs. of  5 variables:
 $ var : Factor w/ 0 levels: NA
  ..- attr(*, ".rk.invalid.fields")= list()
 $ var1: num NA
 $ var2: num NA
 $ var3: num NA
 $ var4: num NA
Warnmeldung:
In str.default(object = quote(NA_integer_), max.level = quote(NA),  :
  'object' hat keine gültigen levels()

attr (my.data[["var"]], "levels") <- c ("one", "two")
my.data[["var"]][1] <- NA


str(my.data)

'data.frame':	1 obs. of  5 variables:
 $ var : Factor w/ 2 levels "one","two": NA
  ..- attr(*, ".rk.invalid.fields")= list()
 $ var1: num NA
 $ var2: num NA
 $ var3: num NA
 $ var4: num NA

my.data[["var"]][1] <- "one"

.rk.data.frame.insert.row (my.data, 2)
row.names (my.data) <- NULL

my.data[["var"]][2] <- "two"


str(my.data)

'data.frame':	2 obs. of  5 variables:
 $ var : Factor w/ 2 levels "one","two": 1 2
  ..- attr(*, ".rk.invalid.fields")= list()
 $ var1: num  NA NA
 $ var2: num  NA NA
 $ var3: num  NA NA
 $ var4: num  NA NA

my.data

  var var1 var2 var3 var4
1 one   NA   NA   NA   NA
2 two   NA   NA   NA   NA
</commandLog>


viele grüße :: m.eik

-- 
dipl. psych. meik michalke
institut f"ur experimentelle psychologie
abt. f"ur diagnostik und differentielle psychologie
heinrich-heine-universit"at d-40204 d"usseldorf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2282 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20121003/5b75a2f9/attachment.p7s>


More information about the Rkward-devel mailing list