1
I’m trying to give a filter
:
library(tidyverse)
library(lubridate)
filter(indicesBrutos, if_else(day(NomDataIn) != 1,
filter(Mes >= NomDataIn-30, Mes <= CMData)),
filter(Mes >= NomDataIn, Mes <= CMData))
This appears:
Error in Usemethod("filter_") : no applicable method for 'filter_' Applied to an Object of class "Logical"
Dice:
structure(list(Mes = structure(c(6971, 6999, 7030, 7060, 7091,
7121), class = "Date"), Indice = c("BTN", "BTN", "BTN", "BTN",
"BTN", "BTN"), VarPerc = c(3.6, 6.090733, 7.305977, 9.937256,
24.834181, 28.7656), Fator = c(1.036, 1.06090733, 1.07305977,
1.09937256, 1.24834181, 1.287656), Selic_Perc_Ano = c(7.0237,
8.2886, 2.7003, 2.6646, 17.0939, 30.0523), JM_Mes = c(0.005,
0.005, 0.005, 0.005, 0.005, 0.005)), row.names = c(NA, -6L), class = c("tbl_df",
"tbl", "data.frame"))
Read the code formatting help: https://answall.com/editing-help
– novic
Explain your problem and the result you expect. "Trying to give a filter" is too broad,
– neves
And where is the variable
NomDataIn
?– neves
I appreciate the answers. Neves, I ask excuses for my bad explanation, I will try to improve. I got by the normal if Else.
– Fernando Vieira