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

Numeric and Integers

The numeric data class includes all numbers except integers, which are their own separate class in R. Anything of class numeric will be of type doubleunless it is explicitly declared as an integer. To create an integer, you must type a capital letter, L, after a whole number.

Let's now create and check the class() and typeof() of different numeric objects in R. Follow the steps given below:

  1. Create the following numeric objects:
x <- 12.7
y <- 8L
z <- 950
  1. Check the class and type of each using class() and typeof(), respectively, as follows:
class(x)
typeof(x)

class(y)
typeof(y)

class(z)
typeof(z)

Output: The preceding code provides the following output:

主站蜘蛛池模板: 长葛市| 张家港市| 普定县| 剑河县| 平顺县| 西安市| 延吉市| 定西市| 全州县| 临沧市| 义乌市| 综艺| 普兰店市| 铜陵市| 潞西市| 长宁县| 阜康市| 新晃| 沙田区| 历史| 新建县| 桓仁| 扎兰屯市| 将乐县| 平武县| 五常市| 南丹县| 大港区| 江山市| 榆社县| 建昌县| 磐安县| 凯里市| 沽源县| 内江市| 淳化县| 瑞安市| 吴川市| 临沂市| 龙井市| 墨竹工卡县|