R语言基础-1
显示文件列表
> dir()
[1] "R pracitce.Rproj"
> list.files()
[1] "R pracitce.Rproj"
> list.files()
[1] "hello.txt" "R pracitce.Rproj"
加减乘除
> 3+5
[1] 8
> 5-7
[1] -2
> 5*2
[1] 10
> 5/5
[1] 1
> 4^5
[1] 1024
> sqrt(10)
[1] 3.162278
> abs(-5)
[1] 5
> log2(4)
[1] 2
> log10(100)
[1] 2
赋值
> x <- 4*7
> x
[1] 28
删除变量
> a <- 5
> b <- 6
> c <- 9
> d <- 4
> ls()
[1] "a" "b" "c" "d" "x"
> rm(a)
> ls()
[1] "b" "c" "d" "x"
> rm(b,c,d)
> ls()
[1] "x"
> rm(list = ls())
> ls()
character(0)