Professional Documents
Culture Documents
CH 2
CH 2
Getting started
with R
Working with directory
• getwd()
getwd() command returns the absolute filepath of the current working directory.
• setwd()
setwd() command resets the current working directory to another location as per
users’ preference.
• dir()
This function returns a character vector of the names of files or directories in the
named directory.
Data types in R
Data type essentially means the kind of value which can be stored such as Boolean,
numbers, characters etc.
• tail()
tail() command displays the last ‘n’ observations from a given data frame.
• edit()
edit() command helps with dynamic editing/data manipulation to a dataset.
Few Commands for Data Exploration contd…
• summary()
summary() command includes functions like min, max, median, mean,
etc., for each variable present in the given data frame.
• str()
str() command displays the internal structure of a data frame.
• View()
View() command displays the given data set in a spreadsheet-like data
frame viewer.
• For calculating average
• #mean()