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

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:

主站蜘蛛池模板: 铜陵市| 无棣县| 尚志市| 长岛县| 财经| 南和县| 信阳市| 海城市| 绥阳县| 任丘市| 邵东县| 历史| 奉新县| 嘉峪关市| 福清市| 普安县| 乌拉特前旗| 台湾省| 富裕县| 如皋市| 新建县| 彭泽县| 沂源县| 白朗县| 巍山| 怀仁县| 苏州市| 五常市| 闸北区| 东乌| 凤山市| 沙坪坝区| 浦北县| 廉江市| 宁都县| 宝山区| 抚州市| 太保市| 遂川县| 静宁县| 攀枝花市|