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

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
主站蜘蛛池模板: 潼南县| 恩施市| 秦安县| 诸暨市| 客服| 云南省| 南漳县| 临江市| 乐至县| 吴江市| 琼结县| 临西县| 凤凰县| 山阳县| 调兵山市| 祁阳县| 苏尼特左旗| 阿拉善左旗| 新乡县| 吉首市| 喜德县| 都兰县| 中西区| 保山市| 青海省| 玛曲县| 大理市| 隆子县| 贺州市| 江门市| 青阳县| 长宁区| 额济纳旗| 正镶白旗| 康保县| 华池县| 静宁县| 宜章县| 台北市| 陇西县| 衡山县|