function in R Language is used to list the names of all the objects that are present in the working directory.**ls()**

Syntax:ls()

Parameters:

This function needs no argument

**Example 1:**

`# R program to list all the object names ` ` ` `# Creating a vector ` `vec <` `-` `c(` `1` `, ` `2` `, ` `3` `) ` ` ` `# Creating a matrix ` `mat <` `-` `matrix(c(` `1` `:` `4` `), ` `2` `) ` ` ` `# Creating an array ` `arr <` `-` `array(c(` `1` `:` `4` `), ` `2` `) ` ` ` `# Calling ls() Function ` `ls() ` |

*chevron_right*

*filter_none*

**Output:**

[1] "arr" "mat" "vec"

**Example 2:**

`# R program to list all the object names ` ` ` `# Creating a list ` `list1 ` `=` `list` `(` `"Numbers"` `=` `c(` `1` `:` `3` `), ` ` ` `"Characters"` `=` `c(` `1` `:` `5` `)) ` ` ` `# Creating a Data frame ` `df ` `=` `data.frame(` `"Numbers"` `=` `c(` `1` `:` `3` `), ` ` ` `"Characters"` `=` `c(` `4` `:` `6` `)) ` ` ` `# Calling ls() Function ` `ls() ` |

*chevron_right*

*filter_none*

**Output:**

[1] "df" "list1"

## Recommended Posts:

- Working with CSV files in R Programming
- Working with XML Files in R Programming
- Working with Excel Files in R Programming
- Working with Databases in R Programming
- Data Wrangling in R Programming - Working with Tibbles
- Working with Binary Files in R Programming
- Working with JSON Files in R Programming
- Working with Sparse Matrices in R Programming
- Get Exclusive Elements between Two Objects in R Programming - setdiff() Function
- Intersection of Two Objects in R Programming - intersect() Function
- Check if Two Objects are Equal in R Programming - setequal() Function
- Check for Presence of Common Elements between Objects in R Programming - is.element() Function
- Union of two Objects in R Programming - union() Function
- Get Addition of the Objects passed as Arguments in R Programming - sum() Function
- Concatenating Objects in R Programming - combine() Function
- Remove Objects from Memory in R Programming - rm() Function
- Looping over Objects in R Programming
- Convert an Object to List in R Programming - as.list() Function
- Check if the Object is a List in R Programming - is.list() Function
- Get a List of all the Attached Packages in R Programming - search() Function

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.