R语言基本指令,本文主要focus在数据结构上
接上篇
本文主要是不同的数据类型以及基本的结构,主要参考的是datacamp练习
##vector123456789101112131415***表示vector*** c(里面跟vector)***name a vector***:some_vector <- c("John Doe", "poker player")names(some_vector) <- c("Name", "Profession") #we will get Name Profession "John Doe" "poker player" ***比较大小***To check if 6 is larger than 5, you type 6 > 5. This returns a logical value (TRUE or FALSE).***选择数据***select the first element of the vector, you type poker_vector[1].select the second element of the vector, you type poker_vector[2](注意顺序和python中不一样,第一个数字就type1)***选择roulette_vector中大于0的时候***selectionvector <- roulette_vector>0***选择roulette_vector中大于0的时候并显示数额***roulette_winning_days <- roulette_vector[selection_vector]
##matrix
|
|
factor
|
|
data frames
|
|
lists
|
|