[datatable-help] Strange key behaviour with character string (involving spaces)
Timothée Carayol
timothee.carayol at gmail.com
Fri Aug 19 17:11:37 CEST 2011
Hi,
I noticed some unexpected behaviour:
> key(test) <- "Var1"
> test["a 1"]
Var1 Var2
[1,] a 1 NA
> test <- data.table(expand.grid(c(paste("a ", 1:10), "b"),1:10))
> key(test) <- "Var1"
> test["b"]
Var1 Var2
[1,] b 1
[2,] b 2
[3,] b 3
[4,] b 4
[5,] b 5
[6,] b 6
[7,] b 7
[8,] b 8
[9,] b 9
[10,] b 10
> test["a 1"]
Var1 Var2
[1,] a 1 NA
>
That is, subsetting a keyed data.table by a string that contains a
space seems to break it? Am I missing something?
Timothee
More information about the datatable-help
mailing list