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

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:

主站蜘蛛池模板: 吴江市| 阳谷县| 长泰县| 丰原市| 枞阳县| 万安县| 新乡县| 丰顺县| 北海市| 文昌市| 开远市| 宝鸡市| 英德市| 进贤县| 瑞昌市| 丰镇市| 迭部县| 成都市| 宣化县| 江口县| 宝山区| 藁城市| 亚东县| 嵊州市| 卢龙县| 许昌县| 巴里| 金昌市| 合作市| 嘉鱼县| 桃园市| 鹿邑县| 兰州市| 大姚县| 崇明县| 正阳县| 广元市| 富源县| 澄城县| 历史| 闽清县|