Avoided join message and reordered columns

This commit is contained in:
yueguoguo 2017-03-24 13:26:13 +08:00
Родитель edca374583
Коммит 79c5be6372
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -340,11 +340,17 @@ expenseCalculator <- function(context,
filter(df_rates, MeterId %in% meter_list) %>% filter(df_rates, MeterId %in% meter_list) %>%
rename(meterId=MeterId) rename(meterId=MeterId)
# invisible(capture.output(df_cost <- left_join(df_used_data, df_used_rates)))
df_cost <- df_cost <-
left_join(df_used_data, df_used_rates) %>% left_join(df_used_data, df_used_rates, by="meterId") %>%
mutate(Cost=totalQuantity * MeterRate) %>% mutate(Cost=totalQuantity * MeterRate) %>%
select(-IncludedQuantity, -EffectiveDate, -MeterStatus, -usageStartDate, -usageEndDate, -meterId, -MeterRegion) %>% select(-IncludedQuantity, -EffectiveDate, -MeterStatus, -usageStartDate, -usageEndDate, -meterId, -MeterRegion) %>%
na.omit() na.omit()
# reorder columns.
df_cost <- df_cost[, c(3, 2, 4, 1, 5, 6, 7)]
df_cost df_cost
} }