David Yang bio photo

David Yang

A graduate school student in Taiwan.

pingjing.yang@gmail.com Facebook Github

#R学习笔记

##Rstudio快捷键

ctrl+shift+c 对选中内容进行批量注释、解注释

Ctrl+Alt+R 运行当前文件

##R常用处理函数

round()#四舍五入
round(target,digits=xx)
write.table(resource,target,append,quote)
length()#对象长度,R的index是从1开始的


is.na(a)
not variable
nan not a number

All the computing in R is element by element operation

names()
name of the component of one variable

c() v.s. list()

class(element_name[[]])
used to notificate the type of the object, embrace the element with a list
[],always get list
[[]], get the specific type of the element

always first row , second column in R(in setting)

to refer to certain position with []

LETTERS[] english characters

matrix() v.s. data.frame

as.data.frame() force convert to data frame

runif(number, intervalbegin,end)
which(condition)

cbind v.s. rbind (column and row)

order vs sort one for index, the other sequence

sapply(destination, operation)

head(destination, number of variable to release) see the head of the data.frame 
tail

as.factor() find key to get access to the array

levels(object)

as.factor have a array and its levels ,levels for retrieval

as.numeric have the levels of each element in the array

detach("package:vegan", unload=TRUE)