0

Anybody knows what kind of function is "." and in which library it is included. I try to run it in this dataframe

x_dt<-structure(list(interval_end = c("2021-08-14", "2021-08-14", "2021-08-14", 
"2021-08-14", "2021-08-15", "2021-08-15", "2021-08-15", "2021-08-15", 
"2021-08-16", "2021-08-16"), interval_days = c(1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L), inv_bin = c("(0.0, 10.0]", "(10.0, 70.0]", 
"(70.0, 330.0]", "(330.0, inf]", "(0.0, 10.0]", "(10.0, 70.0]", 
"(70.0, 330.0]", "(330.0, inf]", "(0.0, 10.0]", "(10.0, 70.0]"
), N = c(58L, 55L, 38L, 25L, 0L, 9L, 13L, 6L, 2L, 11L), distinct_feature = c("feature_a", 
"feature_a", "feature_a", "feature_a", "feature_a", "feature_a", 
"feature_a", "feature_a", "feature_a", "feature_a"), ga_view = c("Sellwerk", 
"Sellwerk", "Sellwerk", "Sellwerk", "Sellwerk", "Sellwerk", "Sellwerk", 
"Sellwerk", "Sellwerk", "Sellwerk"), query = c("step2_sw_ux_2_of_10", 
"step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10", 
"step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10", 
"step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10", "step2_sw_ux_2_of_10"
), ga_view_id = c("ga:233250370", "ga:233250370", "ga:233250370", 
"ga:233250370", "ga:233250370", "ga:233250370", "ga:233250370", 
"ga:233250370", "ga:233250370", "ga:233250370"), tech_job_date_time = structure(c(1630369058, 
1630369058, 1630369058, 1630369058, 1630369058, 1630369058, 1630369058, 
1630369058, 1630369058, 1630369058), class = c("POSIXct", "POSIXt"
), tzone = "UTC")), row.names = c(NA, -10L), class = c("data.table", 
"data.frame"))

with

int_lengths_str <- x_dt[, .(interval = unique(inv_bin))][order(-inv_bin)][, inv_bin] %>% str_flatten(collapse = ", ")

but I get:

Error in .: could not find function "."
firmo23
  • 7,490
  • 2
  • 38
  • 114
  • AFter this step `x_dt[, .(interval = unique(inv_bin))]` there is only a single column 'interval' i.e. `inv_bin` is not in the data. WHat is your expected – akrun Sep 14 '21 at 19:27
  • I cannot reproduce that error in my working environment. If you are working this inside a local package, then try adding `.datatable.aware = TRUE` in the package. – r2evans Sep 14 '21 at 19:28
  • 1
    Since you seem to be using data.table, de sure to run `library(data.table)` to load the data.table package. Did you write this code yourself or did you copy it from somewhere? – MrFlick Sep 14 '21 at 19:28
  • no im trying to replicate something I found – firmo23 Sep 14 '21 at 19:33
  • 1
    I don't use data.table very much, but you're clearly using it (it's listed as a class of your data frame). If you need to learn how to use data.table, I'd start with tutorials on its syntax – camille Sep 14 '21 at 19:35

0 Answers0