Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-26 Thread Edzer Pebesma
On 10/26/19 4:43 AM, Micha Silver wrote: > > On 25/10/2019 15:55, Edzer Pebesma wrote: >> Thanks for reporting Micha, and creating a reprex on github Andy; the >> problem seems to be fixed, now. > > > Great, thanks for the quick response. > > I guess reinstalling stars from CRAN should get

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-26 Thread Micha Silver
On 25/10/2019 15:55, Edzer Pebesma wrote: Thanks for reporting Micha, and creating a reprex on github Andy; the problem seems to be fixed, now. Great, thanks for the quick response. I guess reinstalling stars from CRAN should get the fix? Best regards, On 10/23/19 2:22 PM, Andy Teucher

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-25 Thread Edzer Pebesma
Thanks for reporting Micha, and creating a reprex on github Andy; the problem seems to be fixed, now. Best regards, On 10/23/19 2:22 PM, Andy Teucher wrote: > I’m fairly certain this is a bug in stars; I opened an issue here: > https://github.com/r-spatial/stars/issues/223 >

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Micha Silver
Thanks to both of you for identifying the problem so quickly, and offering a workaround! On 23/10/2019 21:25, Vijay Lulla wrote: Andy, you're spot on!  This is because stars:::`[.stars` is only looking for variables and not expressions (line 44 in the function!).  Your example gets around

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Vijay Lulla
Andy, you're spot on! This is because stars:::`[.stars` is only looking for variables and not expressions (line 44 in the function!). Your example gets around it by creating an object in the environment (parent.frame) which is then consulted in the `eval`. Sorry for tmi! HTH, Vijay. On Wed,

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Andy Teucher
I’m fairly certain this is a bug in stars; I opened an issue here: https://github.com/r-spatial/stars/issues/223 Cheers, Andy Teucher > On Oct 23, 2019, at 10:42 AM, Andy Teucher wrote: > > Interesting - there’s some rlang/tidy evaluation

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Andy Teucher
Interesting - there’s some rlang/tidy evaluation trickery going on there that I couldn’t quite figure out (I think it might be searching for yr in the wrong environment), but defining your range as a single variable, and putting that in the square brackets seems to work for me: rng <-

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Micha Silver
On 23/10/2019 19:30, Andy Teucher wrote: Hi Micha, I can see two problems immediately with your code:  1. you are using a double-colon (yr::last_yr) - the double colon is used for looking for an object in a package, so it is looking for object ‘yrs’ in package ‘yr’, which obviously doesn’t

Re: [R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Andy Teucher
Hi Micha, I can see two problems immediately with your code: 1. you are using a double-colon (yr::last_yr) - the double colon is used for looking for an object in a package, so it is looking for object ‘yrs’ in package ‘yr’, which obviously doesn’t make sense. Use a single colon to create a

[R-sig-Geo] Implementing a rolling window for stars object

2019-10-23 Thread Micha Silver
I am trying to run a function (mk.test to find MannKendall trends) using st_apply over a "rolling" window for a time series of rasters in a stars object. When I use subscript notation to slice out the window dimension with a looping variable I get an error: