-2

laply for R is part of what package?

I get:

 "Error: could not find function "laply"".

Thanks.

user1317221_G
  • 15,087
  • 3
  • 52
  • 78
optform
  • 1,017
  • 3
  • 10
  • 6
  • 3
    Could it be that you're simply missing one of the p's? – hmakholm left over Monica Aug 10 '11 at 00:48
  • 2
    It would be useful to clarify whether you really mean `lapply` (i.e. this is a typo), or whether you are looking for `laply` ... – Ben Bolker Aug 10 '11 at 01:28
  • 1
    See documentation for `apropos` (`?apropos`) – aL3xa Aug 10 '11 at 01:49
  • possible duplicate of [Error: could not find function ... in R](http://stackoverflow.com/questions/7027288/error-could-not-find-function-in-r) – Joris Meys Aug 11 '11 at 14:10
  • To the editor (@user1317221_G): since the OP never told us, it's not entirely clear whether they meant to look for `lapply` and misspelled it in the body of the question, or whether they meant to look for `laply` and misspelled it in the title ... although I would guess that the latter (as your edit takes for granted) is slightly more likely – Ben Bolker May 20 '12 at 01:14
  • @ Ben Bolker, cheers. understood, i'll take care. – user1317221_G May 20 '12 at 05:14

4 Answers4

17

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).

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
10

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.)

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • 2
    I hate it when people call me Wickham :( It makes me feel like a badly behaved child in an English grammar school. – hadley Aug 10 '11 at 03:21
  • 2
    Sorry, Hadley. I thought I was being respectful. Unless of course you want to be Prof. Wickham? – IRTFM Aug 10 '11 at 03:38
  • 1
    @hadley: Someone upvoted this and it made me realize I had failed to honor your your request. Edited. – IRTFM May 20 '12 at 14:30
5

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.

neilfws
  • 32,751
  • 5
  • 50
  • 63
-1

you are missing the package plyr. install:

install.packages("plyr")
kevin
  • 1,107
  • 1
  • 13
  • 17