- Applied Data Visualization with R and ggplot2
- Dr. Tania Moulik
- 273字
- 2021-07-23 16:59:44
Types of Variables
Variables can be of different types and, sometimes, different software uses different names for the same variables. So, let's get familiar with the different kinds of variables that we will work with:
- Continuous: A continuous variable can take an infinite number of values, such as time or weight. They are of the numerical type.
- Discrete: A variable whose values are whole numbers (counts) is called a discrete variable. For example, the number of items bought by a customer in a supermarket is discrete.
- Categorical: The values of a categorical variable are selected from a small group of categories. Examples include gender (male or female) and make of car (Mazda, Hyundai, Toyota, and so on). Categorical variables can be further categorized into ordinal and nominal variables, as follows:
- Ordinal categorical variable: A categorical variable whose categories can be meaningfully ordered is called ordinal. For example, credit grades (AA, A, B, C, D, and E) are ordinal.
- Nominal categorical variable: It does not matter which way the categories are ordered in tabular or graphical displays of the data; all orderings are equally meaningful. An example would be different kinds of fruit (bananas, oranges, apples, and so on).
- Logical: A logical variable can only take two values (T/F).
You can read more about variables at http://www.abs.gov.au/websitedbs/a3121120.nsf/home/statistical+language+-+what+are+variables.
The following table lists variables and the names that R uses for them; make sure to familiarize yourself with both nomenclatures.
The variable names used in R are as follows:
In R, whenever the factor data is listed, the number of levels is also given. A dataset can contain different kinds of variables, as discussed previously.
推薦閱讀
- Verilog HDL數字系統設計入門與應用實例
- 來吧!帶你玩轉Excel VBA
- JMAG電機電磁仿真分析與實例解析
- 基于ARM 32位高速嵌入式微控制器
- Windows環境下32位匯編語言程序設計
- 電腦主板現場維修實錄
- 大數據驅動的設備健康預測及維護決策優化
- Kubernetes for Developers
- 工業機器人運動仿真編程實踐:基于Android和OpenGL
- LAMP網站開發黃金組合Linux+Apache+MySQL+PHP
- Mastering Game Development with Unreal Engine 4(Second Edition)
- Excel 2007常見技法與行業應用實例精講
- Silverlight 2完美征程
- Building Google Cloud Platform Solutions
- 自適應學習:人工智能時代的教育革命