Building a task with a spatRaster backend... #81
              
                Unanswered
              
          
                  
                    
                      h-a-graham
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
So I've previously been using {mlr3spatiotempcv} and simply building the backend myself before creating a task using for example
TaskRegrST$new().But I really like the ideas presented in {mlr3spatial} of building the the task directly from the
SpatRaster object itself - especially for the prediction benefits - this look awesome.
But I'm struggling to actually build the task - here is a reprex:
suppressMessages({ library(terra) library(mlr3) library(mlr3spatial) }) f <- rast(system.file("ex/elev.tif", package="terra")) rand <- rnorm(ncell(f), mean = 20, sd = 3) f$newvar <- f$elevation[]*rand f <- f*1 # to unite bands in memory (otherwise there is an error below) plot(f)Created on 2023-01-16 by the reprex package (v2.0.1)
As you can see, the backend is created as expected and the coordinates are retained in the coordinates slot. But the coordinate_names argument is required for
TaskRegrSTbut the columns are not present in the backend data table?Any help would be greatly appreciated - many thanks!
Beta Was this translation helpful? Give feedback.
All reactions