non-equi-join

Summing a dataframe based on another dataframe

会有一股神秘感。 提交于 2019-12-08 07:21:28
问题 I have daily data of rainfall from 10 locations across 10 years set.seed(123) df <- data.frame(loc.id = rep(1:10, each = 10*365),years = rep(rep(2001:2010,each = 365),times = 10), day = rep(rep(1:365,times = 10),times = 10), rain = runif(min = 0 , max = 35, 10*10*365)) I have a separate data frame that has certain days using which I want to sum the rainfall in df df.ref <- data.frame(loc.id = rep(1:10, each = 10), years = rep(2001:2010,times = 10), index1 = rep(250,times = 10*10), index2 =

non-equi-joins in R with data.table - backticked column name trouble

血红的双手。 提交于 2019-11-28 12:53:20
I can't manage to do a non-equi-join with data.table when (backticked) column names include a space. I collect such names from our database at work, and our explicit policy is for everyone to use those same names to avoid confusion. I could of course convert and reconvert, but I'd prefer to avoid that. I wonder, is this a glitch in data.table, and if so, can it be remedied? Or am I missing something? I'm quite new to R, so the latter is entirely possible... A reproducible example: The following does work: a <- data.table(`test name1` = c('A', 'A', 'A', 'B', 'B'), `test_name2` = c(1,2,3,3,4)) b

non-equi-joins in R with data.table - backticked column name trouble

喜你入骨 提交于 2019-11-27 07:27:45
问题 I can't manage to do a non-equi-join with data.table when (backticked) column names include a space. I collect such names from our database at work, and our explicit policy is for everyone to use those same names to avoid confusion. I could of course convert and reconvert, but I'd prefer to avoid that. I wonder, is this a glitch in data.table, and if so, can it be remedied? Or am I missing something? I'm quite new to R, so the latter is entirely possible... A reproducible example: The