I am trying to analyse data from http://orca.science.oregonstate.edu/1080.by.2160.monthly.hdf.vgpm.v.chl.v.sst.php
the code works on R in windows but not on a Mac. I downloaded a free trial for parallel desktop but it has ended and now I'm back to a Mac. Why is the exact code not working on a Mac? Is there a way I could fix this so I can run the code on a Mac? is it because its a hdf file?
library(raster)
library(rgdal)
Jan <- raster("vgpm.2018001.hdf")
extent(Jan) <- extent(-180, 180, -90, 90)
crs(Jan) <- "+proj=longlat +datum=WGS84"
NAvalue(Jan) <- -9999
SAZ <- extent(-180, 180, -60, -40)
NPP_Jan <- crop(Jan, SAZ)
NPP_Jan_mean <- cellStats(NPP_Jan, stat = 'mean', na.rm=TRUE)
I get an error on Mac when I try to open the hdf file using raster.
Jan <- raster("vgpm.2018001.hdf")
Error in .local(.Object, ...) : Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file