随笔分类 -  [31] R

摘要:You should use either indexing or the subset function. For example : R> df <- data.frame(x=1:5, y=2:6, z=3:7, u=4:8) R> df x y z u 1 1 2 3 4 2 2 3 4 5 阅读全文
posted @ 2015-04-28 19:10 emanlee 阅读(584) 评论(0) 推荐(0) 编辑
摘要:按照某列的值拆分data.frameMy data is like this (for example):ID Rate State1 24 AL2 35 MN3 46 FL4 34 AL5 78 MN6 99 FLI want to split the ... 阅读全文
posted @ 2015-04-28 17:24 emanlee 阅读(731) 评论(0) 推荐(0) 编辑
摘要:The font AdobePiStd is missing. Affected text will be displayed using a substitute font.缺少字体 AdobePiStd。将使用替换字体显示受影响的文本。. I solved this by copying the... 阅读全文
posted @ 2015-04-18 19:46 emanlee 阅读(1217) 评论(0) 推荐(0) 编辑
摘要:Merging Data Adding Columns To merge two data frames (datasets) horizontally, use the merge function. In most cases, you join two data frames by one o 阅读全文
posted @ 2015-04-17 20:29 emanlee 阅读(13877) 评论(0) 推荐(0) 编辑
摘要:# sorting examples using the mtcars datasetattach(mtcars)# sort by mpgnewdata <- mtcars[order(mpg),]# sort by mpg and cylnewdata <- mtcars[order(mpg, 阅读全文
posted @ 2015-01-28 15:09 emanlee 阅读(3479) 评论(0) 推荐(0) 编辑
摘要:R免费使用;统计工具;# 注释,行注释块注释:anything="这是注释的内容"常用R语言编辑器:Rsutdio,Tinn-R,Eclipse+StatET;中文会有乱码帮助:?,help; ?boxplot, help(boxplot),help("[[")运行R文件:source('abc.R 阅读全文
posted @ 2014-10-12 10:35 emanlee 阅读(8911) 评论(0) 推荐(0) 编辑
摘要:args_test.R 代码如下:Args <- commandArgs()cat("Args[1]=",Args[1],"\n")cat("Args[2]=",Args[1],"\n")cat("Args[3]=",Args[3],"\n")cat("Args[4]=",Args[4],"\n") 阅读全文
posted @ 2014-10-11 07:31 emanlee 阅读(28020) 评论(3) 推荐(0) 编辑
摘要:df<-NULL new_row<-data.frame(colA="xxx",colB=123) df<-rbind(df,new_row) 阅读全文
posted @ 2014-10-11 07:20 emanlee 阅读(936) 评论(0) 推荐(0) 编辑
摘要:#==============================# ggplot2: subscript in x-axis labels(ticks) rm(list=ls(all=TRUE))library(ggplot2)data <- data.frame(names=tolow... 阅读全文
posted @ 2014-10-10 08:52 emanlee 阅读(2711) 评论(0) 推荐(0) 编辑
摘要:折线图-ggplot2 http://blog.163.com/yugao1986@126/blog/static/6922850820131161531421/http://blog.sina.com.cn/s/blog_7cffd1400101f50v.html《R Graphics Cookb... 阅读全文
posted @ 2014-10-02 08:30 emanlee 阅读(854) 评论(0) 推荐(0) 编辑
摘要:在线画韦恩图(Draw venn diagram online)网站: http://jura.wi.mit.edu/bioc/tools/venn.php http://bioinformatics.psb.ugent.be/webtools/Venn/ http://bioinfogp.cnb. 阅读全文
posted @ 2014-08-23 22:08 emanlee 阅读(5997) 评论(0) 推荐(0) 编辑
摘要:注意:R的升级必须先卸载(在R的目录中运行 make uninstall;或运行 yum remove R )再重新安装(下载/解压/configure/make/make install) Linux (RedHat, CentOS)上升级R语言: sudo yum install R Windo 阅读全文
posted @ 2014-08-22 10:55 emanlee 阅读(10209) 评论(0) 推荐(0) 编辑
摘要:f <- function(start_time) { start_time <- as.POSIXct(start_time) dt <- difftime(Sys.time(), start_time, units="secs") # Since you only want the H:M... 阅读全文
posted @ 2014-07-22 18:13 emanlee 阅读(9226) 评论(0) 推荐(0) 编辑
摘要:Arithmetic OperatorsOperatorDescription+addition-subtraction*multiplication/division^ or ** exponentiationx %% y modulus (x mod y) 5%%2 is 1x %/% y in... 阅读全文
posted @ 2014-07-12 19:09 emanlee 阅读(1157) 评论(0) 推荐(0) 编辑
摘要:cat("the total number is:",3+5,"\n")print(x, ...)?print?cat?format ?write 阅读全文
posted @ 2014-06-12 22:16 emanlee 阅读(12587) 评论(0) 推荐(0) 编辑
摘要:sessionInfo() 查看R中载入的包和版本 writeLines(capture.output(sessionInfo()), "sessionInfo.txt") sink("sessionInfo.txt") sessionInfo() sink() data.frame 动态确定列名称 阅读全文
posted @ 2014-06-07 15:42 emanlee 阅读(2291) 评论(0) 推荐(0) 编辑
摘要:test for data typeis.numeric(), is.character(), is.vector(), is.matrix(), is.data.frame()convert it as.numeric(), as.character(), as.vector(), as.m... 阅读全文
posted @ 2014-06-07 10:20 emanlee 阅读(42006) 评论(1) 推荐(1) 编辑
摘要:Sys.Date( ) returns today's date. 显示当前日期date() returns the current date and time. 显示当前日期和时间# print today's datetoday <-Sys.Date()format(today, format= 阅读全文
posted @ 2014-03-22 18:53 emanlee 阅读(23273) 评论(0) 推荐(0) 编辑
摘要:字符串长度: nchar("hello world") #字符串连接:paste() #paste(..., sep = " ", collapse = NULL)#字符串分割:strsplit() #strsplit(x, split, extended = TRUE, fixed = FALSE 阅读全文
posted @ 2014-02-04 15:23 emanlee 阅读(2538) 评论(0) 推荐(0) 编辑
摘要:numbers <- c(4,23,4,23,5,43,54,56,657,67,67,435, 453,435,324,34,456,56,567,65,34,435)a <- table(numbers)aa[names(a)==435]as.data.frame(table(numbers))... 阅读全文
posted @ 2014-01-17 18:51 emanlee 阅读(1804) 评论(0) 推荐(0) 编辑