Top "Lapply" questions

lapply is a function in R that returns a list of the same length as given argument X, each element of which is the result of applying given function to the corresponding element of X

How to apply mean function over elements of a list in R

I have a list and I want to use lapply() to compute the mean of its elements. For example, for …

r list lapply
Same function over multiple data frames in R

I am new to R, and this is a very simple question. I've found a lot of similar things to …

r for-loop dataframe lapply
Creating a named list from two vectors (names, values)

Is there a way to use mapply on two vectors to construct a named list? The first vector would be …

r list constructor lapply named
Apply function on a subset of columns (.SDcols) whilst applying a different function on another column (within groups)

This is very similar to a question applying a common function to multiple columns of a data.table uning .SDcols …

r data.table subset lapply
lapply vs for loop - Performance R

It is often said that one should prefer lapply over for loops. There are some exception as for example Hadley …

r performance lapply
Counting the number of rows of a series of csv files

I'm working through an R tutorial and suspect that I have to use one of these functions but I'm not …

r apply lapply
lapply function /loops on list of lists R

I know this topic appeared on SO a few times, but the examples were often more complicated and I would …

r list loops lapply
How to tell lapply to ignore an error and process the next thing in the list?

I have an example function below that reads in a date as a string and returns it as a date …

r error-handling try-catch lapply
How to get the name of each element of a list using lapply()?

Imagine that I have the following list > test <- list("a" = 1, "b" = 2) Each element of the list has …

r lapply
Using lapply to change column names of a list of data frames

I'm trying to use lapply on a list of data frames; but failing at passing the parameters correctly (I think). …

r dataframe lapply