In simple words a data frame is a table
Rows are called as observations
Columns are called as variables
Columns can be different data types
One column should store only one datatype data
Create data frame
Generally we are going to create data frame by importing csv files,relational database,excel ..etc
First let us see how to create manually

Structure of the data frame .Notice that above data frame has 3 observations(rows) and 4 variables(columns)

In create data frame include one more parameter stringsAsFactors = FALSE and observe str(emp.data)
Summary of data in data frame

Exercise : create one more dataframe with the name df and with below data

Extract specific column of a data frame using column name

Extract the first two rows and then all columns

Extract the first two columns and then all rows

Extract specific rows and columns
No comments:
Post a Comment