Remove Objects from Memory in R Programming - rm() Function Last Updated : 19 Jun, 2020 Comments Improve Suggest changes Like Article Like Report rm() function in R Language is used to delete objects from the memory. It can be used with ls() function to delete all objects. remove() function is also similar to rm() function. Syntax: rm(x) Parameters: x: Object name Example 1: Python3 1== # R Program to remove # objects from Memory # Creating a vector vec <- c(1, 2, 3, 4) vec # Creating a list list1 = list("Number" = c(1, 2, 3), "Characters" = c("a", "b", "c")) list1 # Creating a matrix mat <- matrix(c(1:9), 3, 3) mat # Calling rm() Function rm(list1) # Calling ls() to check object list ls() Output: [1] 1 2 3 4 $Number [1] 1 2 3 $Characters [1] "a" "b" "c" [, 1] [, 2] [, 3] [1, ] 1 4 7 [2, ] 2 5 8 [3, ] 3 6 9 [1] "mat" "vec" Example 2: Python3 1== # R Program to remove # objects from Memory # Creating a vector vec <- c(1, 2, 3, 4) # Creating a list list1 = list("Number" = c(1, 2, 3), "Characters" = c("a", "b", "c")) # Creating a matrix mat <- matrix(c(1:9), 3, 3) # Calling rm() Function # to remove all objects rm(list = ls()) # Calling ls() to check object list ls() Output: character(0) Comment More infoAdvertise with us Next Article Remove Objects from Memory in R Programming - rm() Function N nidhi_biet Follow Improve Article Tags : R Language R Object-Function Similar Reads Remove names or dimnames from an Object in R Programming - unname() Function unname() function in R Language is used to remove the names or dimnames from an Object. Syntax: unname(x) Parameters: x: Object Example 1: Python3 1== # R Program to remove names from an object # Creating a matrix A = matrix(c(1:9), 3, 3) # Naming rows rownames(A) = c("a", "b", 1 min read Remove Duplicate Elements from an Object in R Programming - unique() Function unique() function in R Language is used to remove duplicated elements/rows from a vector, data frame or array. Syntax: unique(x) Parameters: x: vector, data frame, array or NULL Example 1: Python3 # R program to illustrate # unique function # Initializing some set of numbers x <- c(1:10, 5:9) x # 1 min read Removing Levels from a Factor in R Programming - droplevels() Function droplevels() function in R programming used to remove unused levels from a Factor. Syntax: # For vector object droplevels(x, exclude = if(anyNA(levels(x))) NULL else NA, ...) # For data frame object droplevels(x, except, exclude) Parameter values: x represents object from which unused level has to b 2 min read Get the Maximum element of an Object in R Programming - max() Function max() function in R Language is used to find the maximum element present in an object. This object can be a Vector, a list, a matrix, a data frame, etc.. Syntax: max(object, na.rm) Parameters: object: Vector, matrix, list, data frame, etc. na.rm: Boolean value to remove NA element. Example 1: Python 1 min read Display the internal Structure of an Object in R Programming - str() Function str() function in R Language is used for compactly displaying the internal structure of a R object. It can display even the internal structure of large lists which are nested. It provides one liner output for the basic R objects letting the user know about the object and its constituents. It can be 3 min read How to Resolve Object Not Found Error in R The "Object Not Found" error in R occurs when you try to call a variable, function, or dataset that does not exist or is not accessible in the current environment , it is a common issue especially for beginners but usually easy to fix a few simple checks.Common Causes & Solutions1. Typing Mistak 3 min read List all the Objects present in the Current Working Directory in R Programming - ls() Function ls() function in R Language is used to list the names of all the objects that are present in the working directory. Syntax: ls() Parameters: This function needs no argument Example 1: Python3 1== # R program to list all the object names # Creating a vector vec <- c(1, 2, 3) # Creating a matrix ma 1 min read Determine Memory Usage of Data Objects in R In this article, we are going to discuss how to find the memory used by the Data Objects in R Language. In R, after the creation of the object, It will allocate some space to the particular object. The object in memory is stored in bytes. Numeric type can allocate 56 bytes and character type can all 2 min read Melting and Casting in R Programming Melting and Casting are one of the interesting aspects in R programming to change the shape of the data and further, getting the desired shape. R programming language has many methods to reshape the data using reshape package. melt() and cast() are the functions that efficiently reshape the data. Th 3 min read Getting and Setting Length of the Vectors in R Programming - length() Function In R, the length() function is used to determine the number of elements in a vector. Vectors can be of various types, such as numeric, character, or logical, and the length() function provides a simple way to find out how many elements are contained in a vector. This function is versatile and can al 5 min read Like