Convert map data to data frame using fortify {ggplot2} for spatial objects in R

后端 未结 2 1169
北荒
北荒 2020-12-16 06:47

I use to be able to run this script without any problem, but now the fortify {ggplot2} command gives me an error message. Any hint of what might be the problem would be grea

2条回答
  •  佛祖请我去吃肉
    2020-12-16 07:05

    Fortify is likely to be deprecated. A new alternative is broom (see documentation here). It is very simply to use:

    # Load shapefile
    FAO <- readOGR(dsn="fao", layer="World_Fao_Zones")
    #Convert
    FAO_df <- tidy(FAO)
    

    Unfortunately, the file you uploaded is not there anymore, so I cannot demonstrate the command for your example.

提交回复
热议问题