Hi! I have been working with creting a hypervolume from a dataset for some time, and after some tweaking and scaling I have been able to create a hypervolume with seemingly no errors or issues. My problem is that when I try to get the centroid from this hypervolume with the get_centroid function, I get this error:
dataCeltisaustralis <- df.clim.occ_wider %>% filter(., species == "Celtis australis") %>%
select(mean_temperature, mean_precipitation, seasonality_temperature, seasonality_precipitation)
scaledCeltisaustralis<- scale(dataCeltisaustralis)
hypervolume(scaledCeltisaustralis)
get_centroid(scaledCeltisaustralis)
Error in get_centroid(scaledCeltisaustralis) : Wrong class input.
The data seems fine and the hypervolume gives me no error back, so I am not sure of what I have done wrong. Any idea on what could be the problem?
R functions very rarely transform their inputs 'in-place' and typically are content to return their transformation to the calling environment. The user has the option to assign such results to a name for further use; you haven't assigned a name to the result of hypervolume(scaledCeltisaustralis)
that would be something like my_hypvol_from_scaled <- hypervolume(scaledCeltisaustralis)
and then get_centroid(my_hypvol_from_scaled)