首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Filter_time函数-用于过滤R中的时间

Filter_time函数-用于过滤R中的时间
EN

Stack Overflow用户
提问于 2018-06-29 01:28:51
回答 1查看 182关注 0票数 2

我正在尝试做一些基于R博客的博客的时间序列预测。Time Series Forecasting using keras

这是我正在尝试使用的代码。

代码语言:javascript
复制
# Core Tidyverse
library(tidyverse)
library(glue)
library(forcats)
library(dplyr)

# Time Series
library(timetk)
library(tidyquant)
library(tibbletime)
library(stats)

# Visualization
library(cowplot)

# Preprocessing
library(recipes)

# Sampling / Accuracy
library(rsample)
library(yardstick) 

# Modeling
library(keras)
library(tfruns)

#reading excel file

library("readxl")
incoming_volume <- read_excel(file.choose())

volume <- incoming_volume %>%
  tk_tbl() %>%
  mutate(index = as_date(index)) %>%
  as_time(index = index)

p1 <- volume %>%
  ggplot(aes(index, value)) +
  geom_point(color = palette_light()[[1]], alpha = 0.5) +
  theme_tq() +
  labs(
    title = "From July 2011 to May 2018 "
  )

p2 <- volume %>%
  filter_time("start" ~ "2011") %>%
  ggplot(aes(index, value)) +
  geom_line(color = palette_light()[[1]], alpha = 0.5) +su
  geom_point(color = palette_light()[[1]]) +
  geom_smooth(method = "loess", span = 0.2, se = FALSE) +
  theme_tq() +
  labs(
    title = "2011 to 2018 (Zoomed In To Show Changes over the Year)",
    caption = "Incoming Volume"
  )

我收到一个错误,指出找不到filter_time函数。我也尝试过time_filter。我得到了同样的错误。

我怎样才能避免这个错误。

问候你,Ren。

EN

回答 1

Stack Overflow用户

发布于 2018-06-29 11:17:04

您可以通过以下方式更改"filter_time“:

代码语言:javascript
复制
require(lubridate)

p2 <- volume %>%
      filter(year(as.Date(index)) > 2011)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51088545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档