This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey all! I'm working in R, but am formally trained in Stata, which is why I am terrible at it for now. Hoping someone can shed a light.
Using the rather specific get_chirps package I am trying to download chirps data. Usually you would do:
weatherY00Q01 <- get_chirps(object = filtered_coords, dates = c("2000-01-01", "2000-03-31"))
So dates = c("Begindate", "enddate")). I want to loop over the dates, so I do:
date <- seq(as.Date("2000-01-01"), as.Date("2020-12-31"), by = "1 quarter")
date <- as.data.frame(date)
As I want to perform this per quarter (this is for my aims most convenient), I then do:
for(i in date){
xi <- get_chirps(object = filtered_coords, dates = c("i", "i" 1))
The 'for i' converts date to a value. My code gives the error
Error in strsplit(begindate, "-") : non-character argument
Alternatively, I do:
xi <- get_chirps(object = lonlat, dates = c("i", "i 1"))
giving:
Error in if (!all(cond1, cond2, cond3)) { : missing value where TRUE/FALSE needed
I think I am just misunderstanding the general loop logic, or how to apply it here. My aim is thus to extract data for i and i 1 wherein i = 2000-01-01 and i 1 = 2000-04-01, not 2000-01-02.
Sorry for the long question, and thank you so much for any help!
Subreddit
Post Details
- Posted
- 3 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/rstats/comm...