使用Animotum包时map函数报错:缺少.f参数无默认值的解决方法
问题解决:移动持久化模型SSM绘图报错修复
报错原因
你遇到的Error in map(fit.832.rp, what = "rerouted") : argument ".f" is missing, with no default错误,是因为命名空间冲突:R环境中多个包(如purrr、base R)都包含map函数,而你调用的map并非处理SSM拟合结果的专用函数(来自foieGras包,该包提供fit_ssm、route_path、grab等动物轨迹分析工具)。
修复方法
直接指定使用foieGras包的map函数,修改你的绘图代码:
原代码:
map_plot=map(fit.832.rp,what="rerouted") +ggtitle ("832, tag_name (or ID?), social class") map_plot_832=map(fit.832.rp, what = "rerouted") + ggtitle("832, 2023MX-Mno-00832, Adult")
修改后:
map_plot=foieGras::map(fit.832.rp,what="rerouted") +ggtitle ("832, tag_name (or ID?), social class") map_plot_832=foieGras::map(fit.832.rp, what = "rerouted") + ggtitle("832, 2023MX-Mno-00832, Adult")
补充说明
指定包名调用函数是避免命名冲突的最稳妥方式,尤其是当你同时加载了tidyverse(包含purrr)和foieGras这类有同名函数的包时。
内容的提问来源于stack exchange,提问作者Charlene Perez Santos
相关产品推荐
相关产品推荐

