You can use Reduce
to successively apply a binary function to elements in a list.
Reduce("+",x)
[,1] [,2]
[1,] 2 4
[2,] 3 5
Reduce("+",x)/length(x)
[,1] [,2]
[1,] 1.0 2.0
[2,] 1.5 2.5
More Related Contents:
- Issue when passing variable with dollar sign notation ($) to aes() in combination with facet_grid() or facet_wrap()
- Round up from .5
- What does “The following object is masked from ‘package:xxx'” mean?
- R: rJava package install failing
- What is the width argument in position_dodge?
- Replace NA in column with value in adjacent column
- Remove columns with zero values from a dataframe
- How to display the frequency at the top of each factor in a barplot in R [duplicate]
- efficiently generate a random sample of times and dates between two dates
- Export data from R to Excel
- Data.table meta-programming
- R shiny: display “loading…” message while function is running
- How to plot just the legends in ggplot2?
- dplyr on data.table, am I really using data.table?
- Marker mouse click event in R leaflet for shiny
- how to show a legend on dual y-axis ggplot
- Different colours of geom_line above and below a specific value
- use ggpairs to create this plot
- How to make grouped layout in igraph?
- Update handsontable by editing table and/or eventReactive
- Determine the data types of a data frame’s columns
- Why is as.Date slow on a character vector?
- Alternative to expand.grid for data.frames
- Changing Million/Billion abbreviations into actual numbers? ie. 5.12M -> 5,120,000 [duplicate]
- R: t-test over all columns
- Apply a function to a subset of data.table columns, by column-indices instead of name
- Creating (and Accessing) a Sparse Matrix with NA default entries
- Deleting specific rows from a data frame
- Sum object in a column between an interval defined by another column
- R shiny sliderInput with restricted range