Creating data frames in R using data.frame()

Data frames are the most widely used data structures in R programming. Unlike each element in vector/matrix/array must have same data mode, a data frame can store data elements with different mode or type in one object. For example, a data frame of family information can have numeric (e.g. age, income), character (e.g. name), and logical (work/not work) data types. Data frames in R act somewhat similar as a spredsheet in Microsoft Excel, where each row represents each observation or subject and each column refers to each variable or attribute.