Using lapply on multiple functions

enedene

HierCluster is the list of data frames.

I can get the info about one cluster like this:

tail(sort(colMeans(HierCluster[[i]])))

where i is an i-th element in the list.

I used lapply to get the info on all the clusters at once:

lapply(lapply(lapply(HierCluster, colMeans), sort), tail)

But using lapply 3 times seems rather cumbersome, is there a more practical way of doing this?

ilir

You can make an anonymous function that combines the three:

lapply(HierCluster, function(x) tail(sort(colMeans(x))))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Using functions with multiple arguments with lapply in Rcpp

From Dev

R store output from lapply with multiple functions

From Dev

R store output from lapply with multiple functions

From Dev

subset multiple data tables using lapply

From Dev

R manipulating multiple data frames using a lapply

From Dev

Using Multiple Functions in AngularJs

From Dev

Using a list in multiple Functions

From Dev

Using Multiple Functions in AngularJs

From Dev

Using lapply to perform multiple operations on many elements of a list in R

From Dev

Calculate multiple aggregations on several variables using lapply(.SD, ...)

From Dev

Web scraping into R multiple links with similar URL using a for loop or lapply

From Dev

How to sample a list containing multiple dataframes using lapply in R?

From Dev

Define names of objects in multiple lists within a list (using lapply?)

From Dev

Using lapply to perform multiple operations on many elements of a list in R

From Dev

R - lapply several functions in one lapply by elements

From Java

Using Multiple Recursive functions in Python

From Dev

Pandas: using multiple functions in a group by

From Dev

Multiple functions using the same template?

From Dev

Using transactions for multiple functions in plsql

From Dev

Using same parameter for multiple functions

From Dev

Multiple functions using the same template?

From Dev

R: Lapply multiple equality

From Dev

lapply 2 functions in one command

From Dev

lapply 2 functions in one command

From Dev

Using lapply with colorRampPalette

From Dev

List of plots using lapply

From Dev

Summary of Dataset using lapply

From Dev

using lapply on a list of dataframes

From Dev

Error in using lapply?

Related Related

HotTag

Archive