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

Data types in R

Everything in R is in the form of objects. Objects can be manipulated in R. Some of the common objects in R are numeric vectors, character vectors, complex vectors, logical vectors, and integer vectors.

Data types in R

How to do it…

In order to generate a numeric vector in R, we can use the C() notation to specify it as follows:

x = c(1:5) # Numeric Vector

To generate a character vector, we can specify the same within quotes (" ") as follows:

y ="I am Home" # Character Vector

To generate a complex vector, we can use the i notation as follows:

c = c(1+3i) #complex vector

A list is a combination of a character and a numeric vector and can be specified using the list() notation:

z = list(c(1:5),"I am Home") # List
主站蜘蛛池模板: 南城县| 民乐县| 长阳| 临颍县| 平塘县| 江城| 密云县| 庄河市| 德清县| 驻马店市| 容城县| 搜索| 建德市| 青州市| 黄梅县| 宜丰县| 金寨县| 肥西县| 邯郸市| 车险| 武威市| 永顺县| 辉南县| 石家庄市| 永胜县| 内乡县| 渝北区| 汕尾市| 平遥县| 吉木乃县| 石景山区| 咸宁市| 泗洪县| 城口县| 涞水县| 清新县| 庄浪县| 昌图县| 射洪县| 青海省| 德惠市|