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

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
主站蜘蛛池模板: 华安县| 甘洛县| 元朗区| 洱源县| 镇平县| 乌兰县| 保靖县| 达孜县| 蒲江县| 芒康县| 阜新| 大足县| 黎川县| 西华县| 郧西县| 洪泽县| 绍兴县| 铜鼓县| 栖霞市| 松阳县| 滨海县| 巴林左旗| 化德县| 桂林市| 房产| 福鼎市| 连江县| 韩城市| 康平县| 汝南县| 汨罗市| 资源县| 那坡县| 邵阳县| 怀来县| 赣榆县| 育儿| 肃南| 丰台区| 霍林郭勒市| 景德镇市|