Ю
Size: a a a
Ю
ЕТ
Ю
ГД
for(i in seq(1, ncol(a), by = 2)){
a[[i]] = dplyr::coalesce(a[[i]], a[[i + 1]])
}
a
ЕТ
PU
for(i in seq(1, ncol(a), by = 2)){
a[[i]] = dplyr::coalesce(a[[i]], a[[i + 1]])
}
a
tmp <- tibble(
first = c(1, 1, NA, NA),
second = c(NA, NA, 2, 2),
third = c(3, NA, 3, NA),
fourth = c(NA, 4, NA, 4)
)
ncols <- seq_len(length(tmp))
ncols_odd <- ncols[ncols %% 2 == 1]
tmp[is.na(tmp)] <- 0
tmp[, ncols_odd] + tmp[, ncols_odd + 1]
ГД
PU
PU
ГД
tmp = as.data.frame(tmp)
odd = c(TRUE, FALSE)
tmp_na = is.na(tmp[,odd])
tmp[,odd][tmp_na] = tmp[,!odd][tmp_na]
tmp
PU
EP
for(i in seq(1, ncol(a), by = 2)){
a[[i]] = dplyr::coalesce(a[[i]], a[[i + 1]])
}
a
PU
A
A
tmp <- data.table(
first = c(1, 1, NA, NA),
second = c(NA, NA, 2, 2),
third = c(3, NA, 3, NA),
fourth = c(NA, 4, NA, 4)
)
melt(tmp)[!is.na(value)]
variable value
1: first 1
2: first 1
3: second 2
4: second 2
5: third 3
6: third 3
7: fourth 4
8: fourth 4
HC
А[
HC
АК
as.POSIXlt(df$x)$mday == 10
или lubridate::mday(df$x) == 10
.