1
我需要更改給定數據幀(fruits.df)的索引值與另一個數據幀的日期(date.index)。替換一個數據幀的索引值與另一個數據幀的日期
實施例的數據:
# fruits.df
x <- 1:5
y <- 1:12
z <- 1:16
w <- 1:7
fruits.list <- list(Apples = x, Bananas = y, Grapes = z, Kiwis = w)
library(qpcR)
fruits.df <- do.call(qpcR:::cbind.na, lapply(
fruits.list, data.frame))
names(fruits.df) <- names(fruits.list)
這將產生以下日期幀:
的日期索引的數據幀的示例性數據:
date.index <- data.frame(Days = seq(as.Date("2017-07-01"),
as.Date("2017-07-20"), by = 1), index = as.integer(1:20))
所以我需要什麼是以下內容:
我曾嘗試使用TI的dplyr的過濾功能,但它的工作原理,只有當我明確地選擇一列。
不起作用:
filtered_found_Index <- filter(date.index, index %in%
fruits.df)
的作品,但我需要與整個DF做在同一時間:
filtered_found_Index <- filter(date.index, index %in%
fruits.df$**Bananas**)