官术网_书友最值得收藏!

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).

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.
主站蜘蛛池模板: 沙河市| 义马市| 洞头县| 丹阳市| 鄯善县| 瑞安市| 六枝特区| 饶阳县| 吐鲁番市| 大渡口区| 师宗县| 博客| 宁武县| 阿巴嘎旗| 虹口区| 东安县| 阳西县| 神农架林区| 波密县| 佳木斯市| 枣庄市| 郑州市| 萨嘎县| 泰安市| 邹城市| 永丰县| 惠东县| 洮南市| 乌什县| 甘泉县| 黔江区| 卢湾区| 柯坪县| 项城市| 五峰| 大理市| 长垣县| 周宁县| 禄劝| 含山县| 威信县|