Vojta Bartak
Vojta Bartak

Reputation: 19

Missing function "split" in the R package stars

I have a problem with package stars when trying to use split function to split a stars raster object. I use the stars version 0.5-4 (that one is automatically installed when asking for installing stars). According to the package documentation, there should be a function split (in fact, it's probably a method for the generic R function split) for splitting stars object. However, when I try to use it, my R says there is no such function in the stars namespace. Is the function really missing and the documentation wrong? Or could that be caused by some other problem with namespaces?

> library(stars)
> split.stars
Error: object 'split.stars' not found
> stars::split
Error: 'split' is not an exported object from 'namespace:stars'

But when I type

> ?stars

I get the help for the split function from stars. Can someone explain that?

Thanks in advance!

Edit: It works now, not sure what the problem was.

Upvotes: 1

Views: 169

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 546193

split is a base R function. It’s an S3 generic, and the ‘stars’ package provides its own method implementation for a custom S3 class.

To use the method, use it as any other, regular function from base R. That is, write split. Don’t write split.stars, nor stars::split.

Upvotes: 2

Related Questions