R的快速访问功能

r
阅读 41 收藏 0 点赞 0 评论 0

streamline.R
#Summary shortcut
s <- function(...)
	{
		summary(...)
	}


#Get a linear model summary quickly
slm <- function (...)
	{
		summary(lm(...))
	}
	
#Get a logistic model summary quickly
sglm <- function (...)
	{
		summary(glm(...))
	}
	
#Get a ZINB model summary quickly
szinb <- function (...)
	{
		summary(zeroinfl(...,dist="negbin"))
	}
	
#Read csv in the way I always do
rcsv <- function(...)
	{
		read.csv(..., header=T, stringsAsFactors=FALSE,na.strings=c("NA", "#N/A"))
	}
	
#This is a maximum function designed to handle NA
#sets by changing -Inf to NA (by default its -inf since the smallest number greater than nothing is -Inf
goodMax<- function (x)
{
	maxOut <- max(x, na.rm=T)
	if (maxOut == -Inf)
	maxOut <- NA
	
	return(maxOut)
}

评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号