| objects_size | R Documentation |
Returns a summary of objects in the current R workspace, sorted from largest to smallest by memory size. Useful for identifying memory-intensive objects and diagnosing memory issues.
objects_size(n = 10)
n |
Integer specifying the number of largest objects to display. Default: |
This utility function helps monitor memory usage by displaying the largest objects in your workspace. It's particularly useful for:
Identifying memory bottlenecks during large spatial analyses
Deciding which objects to remove to free memory
Understanding the memory footprint of different data structures
The function examines all objects in the global environment (.GlobalEnv) and calculates their memory usage using utils::object.size(). Objects are automatically sorted by size in descending order.
Data frame with object names as row names and four columns:
Type: Object class (e.g., "data.frame", "matrix", "list").
Size: Memory size with automatic unit formatting (e.g., "1.2 Mb", "500 bytes").
Length/Rows: Number of elements (for vectors) or rows (for data frames/matrices).
Columns: Number of columns (for data frames/matrices; NA for vectors and other objects).
utils::object.size(), base::ls(), base::rm()
Other utilities:
.vif_to_df(),
auc(),
beowulf_cluster(),
optimization_function(),
prepare_importance_spatial(),
rescale_vector(),
root_mean_squared_error(),
setup_parallel_execution(),
standard_error(),
statistical_mode(),
thinning(),
thinning_til_n()
# Create some objects of different sizes
small_vector <- runif(100)
medium_matrix <- matrix(runif(10000), 100, 100)
large_matrix <- matrix(runif(100000), 1000, 100)
# View the 5 largest objects
objects_size(n = 5)
# Check all objects (up to 10 by default)
objects_size()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.