library(nycflights13)
library(dplyr)
head(flights)
id.vec <- c("a", "b", "c")
for(i in seq_along(id.vec)){
id <- id.vec[i]
temp <- flights %>% dplyr::select(year, day, dep_time, arr_time) %>%
dplyr::mutate(year = year - mean(year),
day = day - mean(day),
dep_time = dep_time - mean(dep_time),
arr_time = arr_time - mean(arr_time))
# do some other tasks with temp file
}
У меня вопрос, как я могу поставить условие, что если id == "c"
, то не выбирать столбец dep_time
, а также не выполнять dep_time = dep_time - mean(dep_time)