The document discusses different data types in R including logical, numeric, integer, complex, character, and raw data types. It then summarizes the main data structures in R: atomic vectors, lists, arrays, matrices, data frames, and factors. Vectors are collections of elements that can be character, integer, logical or numeric. Lists allow elements to be different types. Matrices are rectangular arrangements of numbers in rows and columns. Factors categorize data into levels and data frames store tabular data.
The document discusses different data types in R including logical, numeric, integer, complex, character, and raw data types. It then summarizes the main data structures in R: atomic vectors, lists, arrays, matrices, data frames, and factors. Vectors are collections of elements that can be character, integer, logical or numeric. Lists allow elements to be different types. Matrices are rectangular arrangements of numbers in rows and columns. Factors categorize data into levels and data frames store tabular data.
The document discusses different data types in R including logical, numeric, integer, complex, character, and raw data types. It then summarizes the main data structures in R: atomic vectors, lists, arrays, matrices, data frames, and factors. Vectors are collections of elements that can be character, integer, logical or numeric. Lists allow elements to be different types. Matrices are rectangular arrangements of numbers in rows and columns. Factors categorize data into levels and data frames store tabular data.
The document discusses different data types in R including logical, numeric, integer, complex, character, and raw data types. It then summarizes the main data structures in R: atomic vectors, lists, arrays, matrices, data frames, and factors. Vectors are collections of elements that can be character, integer, logical or numeric. Lists allow elements to be different types. Matrices are rectangular arrangements of numbers in rows and columns. Factors categorize data into levels and data frames store tabular data.
UID: 22MSM40017 Branch: M.Sc. Data Science Section/Group: 22MSD-1/A Semester: 1st Date of Performance: - 24-09-2022
Subject Name: Fundamentals of Programing Lab Subject Code: 22SDT-603
Let's discuss each of these R data types one by one.
Logical Data Type -TRUE, FALSE Numeric Data Type- 2, 15.5 Integer Data Type- 2L (the L tells R to store this as an integer) Complex Data Type - 1+4i (complex numbers with real and imaginary parts) Character Data Type -"a", "swc" Raw Data Type -The raw data type holds raw bytes . transform a character object or a integer numeric value to a raw object with the CharToRaw and IntToBits Function. R has many data structures, which include: 1. Atomic vector 2. List 3. Array 4. Matrix 5. Data Frame 6. Factors Vectors -A vector is a collection of elements which is most commonly of mode character, integer, logical or numeric. List-A list is a special type of vector in which each element can be a different type. Array-An array is a collection of a similar data type with contiguous memory allocation. Matrices- A matrix is a rectangular arrangement of numbers in rows and columns. To create a matrix in R you need to use the function called matrix. Factors- Factors are the data objects which are used to categorize the data and store it as levels., like “TRUE” or “FALSE”, or “MALE” or “FEMALE”, etc. Dataframes - Dataframes are generic data objects of R which are used to store the tabular data. To create a data frame we use the data.frame() function.