- Machine Learning with R Quick Start Guide
- Iván Pastor Sanz
- 157字
- 2021-06-24 16:01:32
Data frames
Data frames are special lists that can also store tabular values. However, there is a constraint on the length of elements in the lists: they all have to be of a similar length. You can consider every element in the list as columns, and their lengths can be considered as rows.
Just like lists, a data frame can have objects belonging to different classes in a column; this was not allowed in matrices.
Let's quickly create a data frame using the data.frame() function:
a <- c(1, 3, 5)
b <- c("red", "yellow", "blue")
c <- c(TRUE, FALSE, TRUE)
df <- data.frame(a, b, c)
df
## a b c
## 1 red TRUE
## 3 yellow FALSE
## 5 blue TRUE
You can see the headers of a table as a, b, and c; they are the column names. Every line of the table represents a row, starting with the name of each row.
推薦閱讀
- PPT,要你好看
- 網(wǎng)上沖浪
- Getting Started with Clickteam Fusion
- 精通Windows Vista必讀
- 返璞歸真:UNIX技術(shù)內(nèi)幕
- 21天學(xué)通C++
- STM32G4入門與電機(jī)控制實(shí)戰(zhàn):基于X-CUBE-MCSDK的無刷直流電機(jī)與永磁同步電機(jī)控制實(shí)現(xiàn)
- PyTorch Deep Learning Hands-On
- Windows游戲程序設(shè)計(jì)基礎(chǔ)
- CompTIA Linux+ Certification Guide
- Splunk Operational Intelligence Cookbook
- 高維聚類知識(shí)發(fā)現(xiàn)關(guān)鍵技術(shù)研究及應(yīng)用
- Enterprise PowerShell Scripting Bootcamp
- 網(wǎng)絡(luò)安全與防護(hù)
- Hands-On Reactive Programming with Reactor