R Data Frame - r - learn r - r programming
- A data frame is a very important data type in R.
- A data frame is more common than a matrix, in that different columns can have different modes such as numeric, character, factor, etc. This is similar to SAS (Statistical Analysis System) and SPSS (Statistical Package for the Social Sciences) datasets.
- A data frame is used for storing data tables.
Syntax:
Sample Code:
Code Explanation:
- A dataframe of two vectors is created, each of three elements. The first vector, d1 is composed of a sequence of the integers 1 through 3 (1:3).
- A second vector, d2, is composed of three logical values drawn of type T (TRUE) and F (FALSE).
- The dataframe is then created, composed of the vectors d1 and d2.
- Here print() is used to print the value, that value stored in wikitechy variable.
Sample Output:
- Here in this output we display combine the vectors (d1 and d2) which using to data.frame() function.