Coming soon - Get a detailed view of why an account is flagged as spam!
view details

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.

1
Looping over date values
Post Body

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!

Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
42,456
Link Karma
6,904
Comment Karma
34,941
Profile updated: 2 days ago
Posts updated: 7 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago