- 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.
推薦閱讀
- Word 2000、Excel 2000、PowerPoint 2000上機(jī)指導(dǎo)與練習(xí)
- 人工智能超越人類
- Apache Hive Essentials
- Mastering Salesforce CRM Administration
- 中國(guó)戰(zhàn)略性新興產(chǎn)業(yè)研究與發(fā)展:智能制造
- Learn CloudFormation
- 網(wǎng)絡(luò)安全與防護(hù)
- 工業(yè)機(jī)器人運(yùn)動(dòng)仿真編程實(shí)踐:基于Android和OpenGL
- Applied Data Visualization with R and ggplot2
- 大數(shù)據(jù)素質(zhì)讀本
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)學(xué)習(xí)指導(dǎo)與練習(xí)(Windows XP+Office 2003)
- EDA技術(shù)及其創(chuàng)新實(shí)踐(Verilog HDL版)
- Arduino創(chuàng)意機(jī)器人入門:基于Mind+
- 工業(yè)控制系統(tǒng)安全
- 傳感器與檢測(cè)技術(shù)