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

Plotting with qplot and R

Suppose that we want to visualize some of the variables in the built-in datasets. A dataset can contain different kinds of variables, as discussed previously. Here, the climate data includes numerical data, such as the temperature, and categorical data, such as hot or cold. In order to visualize and correlate different kinds of data, we need to understand the nomenclature of the dataset. We'll load a data file and understand the structure of the dataset and its variables by using the qplot and R base package. Let's begin by executing the following steps:

  1. Plot the temperature variable from the airquality dataset, with hist(airquality$Temp) .

hist is part of the built-in R graphics package.

  Take a look at the following output screenshot:

  1. Use qplot (which is part of the ggplot2 package) to plot a graph, using the same variables.
  1. Type the qplot(airquality$Temp) command to obtain the output, as shown in the following screenshot:

主站蜘蛛池模板: 台安县| 襄汾县| 新民市| 武义县| 鄄城县| 胶州市| 永春县| 抚顺市| 鲁甸县| 孟津县| 繁昌县| 黎城县| 安岳县| 嘉荫县| 吉隆县| 拜泉县| 龙里县| 高密市| 时尚| 阳山县| 获嘉县| 清苑县| 武山县| 苍梧县| 万全县| 吉水县| 横山县| 宁晋县| 滨州市| 甘肃省| 志丹县| 漾濞| 渑池县| 政和县| 新乡县| 手机| 衡阳县| 石家庄市| 葫芦岛市| 宁德市| 苏州市|