I have a dataframe g with stock data with dates and price numbers. When I want Date1 to exist, Within the if statement, g doesn't become the dates specified. Here is the basic code:
Date1 <- "2020-10-31"
Date2 <- "2020-11-09"
if (exists(Date1)) {
g <- window(g,start=Date1,end=Date2)
}
g
I don't want to attach dput, but I do want to know how to get g to equal something else in an if statement.
Aucun commentaire:
Enregistrer un commentaire