R语言基础--向量

2020-05-02  本文已影响0人  山竹山竹px

R-基础-向量

setwd('E:\bioinfo_study\one')#设置工作目录
Error: '\o' is an unrecognized escape in character string starting "'E:\bioinfo_study\o" 
##报错原因,我直接在文件夹那里复制路径,里面的\,R无法识别,手动改/,即可
##其他错误还可能有,路径当中的文件夹不存在
setwd('E:/bioinfo_study/one')
getwd()
[1] "E:/bioinfo_study/one"

常量和变量

> a <- 1:10
> a
 [1]  1  2  3  4  5  6  7  8  9 10
> typeof(a)
[1] "integer"#数值型 (整型) ##double浮点型
> a <- "good"
> a
[1] "good"
> typeof(a)
[1] "character"#字符型
> a <- TRUE
> typeof(a)
[1] "logical"#逻辑型,一般产生自比较

####类型转换
as.numeric() #转化为数值型
as.logical() #转化为逻辑型
as.character()#转化为字符型
上一篇下一篇

猜你喜欢

热点阅读