How can I write parts of a list into one data frame?


I want to write a single df with the freq of 150 raster objects (partly answered in: <a href="https://stackoverflow.com/questions/52365579/count-freq-of-multiple-raster-objects-in-r" rel="nofollow">Count freq of multiple raster objects in R</a>)

I have created a list of all the raster files with

spatial.tools::list.raster.files() and then called


Now I have a list containing 150 entries that contain a freq matrix for every raster file.

I am only interested in $Band.1[,"count"]) however. For a single entry of the list I can create a df for counts with


My question is: How can I write $Band.1[,"count"] for all of the 150 in the list into a single df in one go???


I see you're new here. Others will have an easier time answering your question if you can make your question reproducible -- check out this post on <a href="https://stackoverflow.com/q/5963269/2572423" rel="nofollow">how to make a great reproducible example</a>. That being said, using your other question, this should likely get you what you need:

library(tidyverse) list_of_results <- lapply(ls$raster,freq) df_of_results <- list_of_results %>% map_df(~ data.frame(.)) df_of_results$count

If the tidyverse and purrr::map functions aren't your thing, you could also do something like:

results <- unlist(lapply(list_of_results, function(x) x[, c("count")]))


  • Creating table with different row dimensions
  • Add “Rubber Band” effect in android while changing background of application
  • How to calculate variance of an image patch with vectorization
  • Passing matrices from function to function in MATLAB
  • Add a row to a matrix in Julia?
  • Ordering of eigenvectors when calculating eigenvectors using LAPACK's ssteqr
  • Combinatios in List of LIsts Prolog
  • Subreport causing infinite loop
  • Hierarchical Clustering Large Sparse Distance Matrix R
  • os.system not working, but typing the same thing into the command prompt works
  • JFreeChart BarChart - Category Markers
  • Calculate area of cross-section as function of height
  • Numpy: How to get rid of the minima along axis=1, given the indices - in an efficient way?
  • Why are `colMeans()` and `rowMeans()` functions faster than using the mean function with `lapply()`?
  • Merging a large number of files from one directory into a data frame in R
  • Merge arrays by common column values in julia
  • How to use ResourceDictionary in Windows Phone class library project
  • 3D Math: Calculate Bank (Roll) angle from Look and Up orthogonal vectors
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • rapply over a nested list in R
  • Not able to display correct data in table -AngularJS
  • Django model for a Postgres view
  • How can I get the choice “H2” back in the H2 consol?
  • How do I shift the decimal place in Python?
  • quiver not drawing arrows just lots of blue, matlab
  • OSX - always hide certain files
  • Using Sax parsing to edit and write XML in VB6
  • Stop Bash Script if Hive Fails
  • Insert new calendar with SyncAdapter- Calendar API Android
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Django: Count of Group Elements
  • Why is an OPTIONS request sent to the server?
  • Sending data from AppleScript to FileMaker records
  • MySQL WHERE-condition in procedure ignored
  • How do I use the BLAS library provided by MATLAB?
  • What do the 'size' numbers mean in the windbg !heap output?
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • How to set the response of a form post action to a iframe source?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • unknown Exception android