- Advanced Analytics with R and Tableau
- Jen Stirrup Ruben Oliva Ramos
- 306字
- 2021-07-02 20:26:04
Data structures in R
The power of R resides in its ability to analyze data, and this ability is largely derived from its powerful data types. Fundamentally, R is a vectorized programming language. Data structures in R are constructed from vectors that are foundational. This means that R's operations are optimized to work with vectors.
Vector
The vector is a core component of R. It is a fundamental data type. Essentially, a vector is a data structure that contains an array where all of the values are the same type. For example, they could all be strings, or numbers. However, note that vectors cannot contain mixed data types.
R uses the c()
function to take a list of items and turns them into a vector.
Lists
R contains two types of lists: a basic list, and a named list. A basic list is created using the list()
operator. In a named list, every item in the list has a name as well as a value. named lists are a good mapping structure to help map data between R and Tableau. In R, lists are mapped using the $
operator. Note, however, that the list label operators are case sensitive.
Matrices
Matrices are two-dimensional structures that have rows and columns. The matrices are lists of rows. It's important to note that every cell in a matrix has the same type.
Factors
A factor is a list of all possible values of a variable in a string format. It is a special string type, which is chosen from a specified set of values known as levels. They are sometimes known as categorical variables. In dimensional modeling terminology, a factor is equivalent to a dimension, and the levels represent different attributes of the dimension. Note that factors are variables that can only contain a limited number of different values.
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第二版)
- Maven Build Customization
- Unity 2D Game Development Cookbook
- 軟件測(cè)試實(shí)用教程
- 打開(kāi)Go語(yǔ)言之門(mén):入門(mén)、實(shí)戰(zhàn)與進(jìn)階
- Unity&VR游戲美術(shù)設(shè)計(jì)實(shí)戰(zhàn)
- 數(shù)據(jù)結(jié)構(gòu)與算法詳解
- Microsoft XNA 4.0 Game Development Cookbook
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)
- Splunk Developer's Guide(Second Edition)
- Computer Vision with Python 3
- 給產(chǎn)品經(jīng)理講技術(shù)
- HTML 5與CSS 3權(quán)威指南(第4版·下冊(cè))
- OpenCL異構(gòu)并行計(jì)算:原理、機(jī)制與優(yōu)化實(shí)踐
- Practical C Programming