Closed wcornwell closed 1 year ago
Once again having issues with galah but this time it's not my fault, they haven't updated it to the latest version of r so I'm trying to work out how to install older versions
Worked it out
Burnettia <- galah_call() |> galah_identify("Burnettia Lindl") |> galah_select(basisOfRecord, group = "basic") |> atlas_occurrences() australia_map <- map("world", "Australia", fill = TRUE, plot = FALSE) australia_polygon <- map2SpatialPolygons(australia_map, IDs = australia_map$names, proj4string = CRS("+proj=longlat +datum=WGS84")) within_polygon <- logical(nrow(Burnettia)) for (i in 1:length(polygons)) { polygon_coords <- australia_polygon@polygons[[i]]@Polygons[[1]]@coords within_polygon <- within_polygon | sapply(1:nrow(Burnettia), function(j) { point.in.polygon(Burnettia$decimalLongitude[j], Burnettia$decimalLatitude[j], polygon_coords[,1], polygon_coords[,2]) })} within_polygon_df <- tibble(within_polygon) # had to use tibble because data.tibble wasn't available in this version Burnettia_joined <- bind_cols(Burnettia, within_polygon_df)
add another column