错误指定的索引不是 x (as_tbl_time) 的列
error specified index is not a column of x (as_tbl_time)
我正在尝试使用 as_tbl_time
但我收到标题中的错误。
library(tidyverse)
library(lubridate)
dates <- c("01/01/18 1:01:10 PM" ,"01/01/18 1:10:10 PM")
vals <- c(100, 200)
df <- data.frame(dates, vals)
df$dates <- dmy_hms(df$dates)
df <- as_tbl_time(df, index = df$dates)
index The bare column name of the column to be used as the index.
所以你只需要列名:tibbletime::as_tbl_time(df, index = dates)
不是df$
。
我正在尝试使用 as_tbl_time
但我收到标题中的错误。
library(tidyverse)
library(lubridate)
dates <- c("01/01/18 1:01:10 PM" ,"01/01/18 1:10:10 PM")
vals <- c(100, 200)
df <- data.frame(dates, vals)
df$dates <- dmy_hms(df$dates)
df <- as_tbl_time(df, index = df$dates)
index The bare column name of the column to be used as the index.
所以你只需要列名:tibbletime::as_tbl_time(df, index = dates)
不是df$
。