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

calculate median from data.table columns in R

I am trying to calculate a median value across a number of columns, however my data is a bit funky. …

r data.table lapply rep
sapply with custom function (series of if statements)

I want to run a function which looks at two vectors, returning different values depending on the signs of the …

r apply lapply sapply
How to return a data.frame with a given name from a function?

Assume I have a function that reads data from a MySQL table, manipulates it and returns some data.frame. Note …

r lapply
R: How do you apply grep() in lapply()

I would like to apply grep() in R, but I am not really good in lapply(). I understand that lapply …

r lapply sapply tapply
Nested lapply() in a list?

I have a list l, which has the following features: It has 3 elements Each element is a numeric vector of …

r function lapply
Anonymous function in lapply

I am reading Wickham's Advanced R book. This question is relating to solving Question 5 in chapter 12 - Functionals. The exercise …

r lapply
Iterating a function through different columns of a data.frame matching a pattern in the column names

I want to iterate a function through different columns (with a common pattern in the column names) of a data.…

r for-loop lapply
Dataframes in a list; adding a new variable with name of dataframe

I have a list of dataframes which I eventually want to merge while maintaining a record of their original dataframe …

list r dataframe names lapply
Why `missing` and default arguments are not working in functions called by `lapply`?

I'm astonished that missing seems not working in a function called by lapply. Assume I have the following functions: .add &…

r lapply
Replace first occurrence of ":" but not second in R

In order to be able to process I'd like to replace the first occurrence of a : in a string (which …

regex r lapply gsub