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

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:

主站蜘蛛池模板: 嘉禾县| 太保市| 本溪市| 织金县| 伽师县| 托克逊县| 静安区| 游戏| 东乡族自治县| 奈曼旗| 裕民县| 凤阳县| 沙河市| 阿图什市| 揭西县| 沙湾县| 建湖县| 永靖县| 惠来县| 公主岭市| 汉阴县| 梅河口市| 成都市| 武义县| 岳池县| 宁武县| 呼玛县| 鹤山市| 贺兰县| 河津市| 闽侯县| 白银市| 临城县| 宁武县| 区。| 堆龙德庆县| 门源| 铜山县| 宁德市| 上蔡县| 昭平县|