r 混合R片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r 混合R片段相关的知识,希望对你有一定的参考价值。

# Remove missing values
y <- x[!is.na(x)]

# Replace NA with 0
d[is.na(d)] <- 0

# Replace 0 with NA
dat[dat==0] <- NA

# Rename column by name: change "beta" to "two"
names(d)[names(d)=="beta"] <- "two"

# Reorder factors
mydf$task <- factor(mydf$task, levels = c("up", "down", "left", "right", "front", "back"))

# Convert all data frame columns from factor to numeric
indx <- sapply(breast, is.factor)
breast[indx] <- lapply(breast[indx], function(x) as.numeric(as.character(x)))

# Bioconductor install/update
source("https://bioconductor.org/biocLite.R")
biocLite()

# Bioconductor upgrage
biocLite("BiocUpgrade")

# List all loaded packages
(.packages())

# Get column classes
lapply(foo, class)

# Factor to columns
df <- data.frame(cbind(1:10, 2:11, 1:3))
colnames(df) <- c("ID","DATE","SECTOR")
df <- data.frame(df, value=TRUE)

reshape(df, idvar=c("ID","DATE"), timevar="SECTOR", direction="wide")

以上是关于r 混合R片段的主要内容,如果未能解决你的问题,请参考以下文章

r R有用的代码片段

r R有用的代码片段

R语言中混合效应模型结果怎么解释

R:生成混合分布的函数

R:sprintf 混合类型变量列表

怎么利用r语言做em算法估计混合双参数指数分布的数值模拟