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:
vec < - c( 1 , 2 , 3 )
mat < - matrix(c( 1 : 4 ), 2 )
arr < - array(c( 1 : 4 ), 2 )
ls()
|
Output:
[1] "arr" "mat" "vec"
Example 2:
list1 = list ( "Numbers" = c( 1 : 3 ),
"Characters" = c( 1 : 5 ))
df = data.frame( "Numbers" = c( 1 : 3 ),
"Characters" = c( 4 : 6 ))
ls()
|
Output:
[1] "df" "list1"