laply is part of what package in R?

我们两清 提交于 2019-12-01 14:52:58

A useful way to find functions that are somewhere in some contributed package on CRAN is

install.packages("sos")
library("sos")
findFn("laply")

(of course, the first command is only necessary once per R installation ...)

In this case, you get

> findFn("laply")
found 5 matches

and a web page opens in your web browser that shows you (as stated above) that there is an laply function in the plyr package.

Of course, findFn() is much more broadly useful -- for example, you could try findFn("compositional data analysis") (if that was what you were interested in).

laply is a function in Hadley's "plyr" package. The convention is that the first letter refers to the input class and the second letter refers to the output class so laply takes a list and returns an array.

install.packages("plyr")
require(plyr)
?laply

Edit: Now that the question has changed the answer is now the base package. (But if the error message was as posted it did imply a misspelling.)

Try typing:

?lapply

And you'll see at the top of the documentation:

package:base

The message "Could not find function laply" is not surprising if, as here, you mis-spelled it with one "p", instead of two.

EDIT: as others pointed out, the plyr package provides laply; you need to clarify your question.

you are missing the package plyr. install:

install.packages("plyr")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!