R language error error: n() should only be called in a data context

suggests that there may be two conflicting functions, which can be resolved by creating a package plus function. The solution is shown in the following figure:

or a plyr package
detach(” package:plyr “)
Refer to the link: https://www.jianshu.com/p/491b6eca2d9a

Read More: