Functions & Methods in R Flashcards
What is the use of getwd() method ?
Get present working directory .
What is the use of require() method ?
It is used for searching a library is installed or not .
require(packageName)
What is the use of library() method ?
This method is used to include packages in R Code
library(packageName)
What is the use of length() method ?
This method is used to know how many members are in list , vector , dataframe etc.
What is the use of class() method ?
This method is used to know object type of variable , like integer,chars,numeric, etc.
What is the use of typeof() method ?
This Method is used to know Data Structure or container of object.
typeof(variable)
What is the use of str() method ?
str() method is used to know structure of Data Frame
What is the use of is.na() method ?
This method is used to find Null valeus in dataFrame
IT returns TRUE or FALSE value
my_vec4 = c(1, 2, NA, 4)
is.na(my_vec4)
is.na(dataFrame$column)
What is the use of anyNA() method,
How we use it ?
This method is used to know , if vector or data frame has any NA value or not
anyNA(my_vector)
anyNA(dataFrame$column)
What is the use of c() method ?
This method is used to create vectors .
What is the use of seq() method ?
This method is used to create vectors
my_vect= seq(from=1, to=10, by=1)
What is the use of list() method
This function f is used to create list object.
my_list= list(24,’MyName’,c(‘A’,’B’,’C’))
What are the use of names() function ?
names() function is used to create slots of list on column names
my_list = list(24,’Name’,c(‘A’,’B’,’C’))
names(my_list) =c(‘Col-1’,’Col-2’,’Col-3’)
What is the use of matrix() function and what is the proper format to use the function ?
Matrix function is used to create matrix.
my_matrix= matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,ncol=3,byrow=TRUE)
What is the use of rownames() method ?
We use a rownames() method into ways,
1. Give the row names while manually creating the data frame
2. Getting or extracting role names from Data frame
rownames() method is used to create a row names in manual data frames
It also be used to get row names of data Frame
rownames(dataFrame)