Как я могу использовать дату в view_zoom_manual, работает ниже, но если я изменяю шаг на дату, я получаю ошибку ниже
Step <- c(1:50)
Value <- runif(50,0,10)
Final <- data.frame(Step, Value)
ggplot(Final, aes(x = Step, y = Value)) +
geom_line(size = 1) +
geom_point() +
view_zoom_manual(xmin = 0:20, xmax = 30:50, ymin = min(Final$Value), ymax = max(Final$Value))
Date = c( "2018-10-18 00:00:00 BST", "2018-10-18 00:10:00 BST", "2018-10-18 00:20:00 BST", "2018-10-18 00:30:00 BST", "2018-10-18 00:40:00 BST", "2018-10-18 00:50:00 BST",
"2018-10-18 01:00:00 BST", "2018-10-18 01:10:00 BST", "2018-10-18 01:20:00 BST", "2018-10-18 01:30:00 BST", "2018-10-18 01:40:00 BST", "2018-10-18 01:50:00 BST",
"2018-10-18 02:00:00 BST", "2018-10-18 02:10:00 BST", "2018-10-18 02:20:00 BST", "2018-10-18 02:30:00 BST", "2018-10-18 02:40:00 BST", "2018-10-18 02:50:00 BST",
"2018-10-18 03:00:00 BST", "2018-10-18 03:10:00 BST", "2018-10-18 03:20:00 BST", "2018-10-18 03:30:00 BST", "2018-10-18 03:40:00 BST", "2018-10-18 03:50:00 BST",
"2018-10-18 04:00:00 BST", "2018-10-18 04:10:00 BST", "2018-10-18 04:20:00 BST", "2018-10-18 04:30:00 BST", "2018-10-18 04:40:00 BST", "2018-10-18 04:50:00 BST",
"2018-10-18 05:00:00 BST", "2018-10-18 05:10:00 BST", "2018-10-18 05:20:00 BST", "2018-10-18 05:30:00 BST", "2018-10-18 05:40:00 BST", "2018-10-18 05:50:00 BST",
"2018-10-18 06:00:00 BST", "2018-10-18 06:10:00 BST", "2018-10-18 06:20:00 BST", "2018-10-18 06:30:00 BST", "2018-10-18 06:40:00 BST", "2018-10-18 06:50:00 BST",
"2018-10-18 07:00:00 BST", "2018-10-18 07:10:00 BST", "2018-10-18 07:20:00 BST", "2018-10-18 07:30:00 BST", "2018-10-18 07:40:00 BST", "2018-10-18 07:50:00 BST",
"2018-10-18 08:00:00 BST", "2018-10-18 08:10:00 BST")
Final <- data.frame(Date, Value)
ggplot(Final, aes(x = Date, y = Value)) +
geom_line(size = 1) +
geom_point() +
view_zoom_manual(xmin = Date[1]:Date[21], xmax = Date[30]:Date[50], ymin = min(Final$Value), ymax = max(Final$Value))#
Так что, если я определяю использование date [], я получаю ошибку. Есть ли способ использовать дату и время здесь?
Error in Date[1]:Date[21] : NA/NaN argument
In addition: Warning messages:
1: In data.frame(xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax) :
NAs introduced by coercion
2: In data.frame(xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax) :
NAs introduced by coercion