R语言求取月份的最后一天

摘要: lubridate包 date_test=as.Date('2015-1-31') date_test %m+% months(2) [1]"2015-03-31" 具体原因不明 >as.Date('2015-5-5') %m+% months(10)[1] "2016-03-05" 针对月底的情况 阅读全文
posted @ 2017-02-16 14:28 湘雨jay 阅读(1267) 评论(0) 推荐(0) 编辑

R语言调试工具

摘要: 可以使用的函数: debug(fun)-undebug(fun) 每次运行fun时将打开调试浏览器,使用undebug将退出这种调试 循环调试:http://www.cnblogs.com/xuanlvshu/p/6351825.html介绍的详细 https://support.rstudio.c 阅读全文
posted @ 2017-02-15 21:52 湘雨jay 阅读(165) 评论(0) 推荐(0) 编辑

R语言环境和变量的作用域

摘要: w=12 f=function(y){d=8 h=function(){ return(d*(w+y)) } return(h()) > environment(f) #environment函数用于获取对象所在的环境<environment: R_GlobalEnv> #R_GlobalEnv表示 阅读全文
posted @ 2017-02-15 21:42 湘雨jay 阅读(327) 评论(0) 推荐(0) 编辑

R语言添加注释

摘要: 使用#,添加注释 x=c(1,2,3) #zhang 阅读全文
posted @ 2017-02-15 17:27 湘雨jay 阅读(2683) 评论(0) 推荐(0) 编辑

R语言修改vector、matrix、dataframe列名

摘要: vector: names(vector)=c('zhang','li','liu') matrix、dataframe: colnames(m/d)=c('zhang','li','liu') 阅读全文
posted @ 2017-02-15 17:07 湘雨jay 阅读(2385) 评论(0) 推荐(0) 编辑

R语言获取数据框的行数

摘要: 1)dim(dataframe)[1] 2)nrow(dataframe) 3)length(dataframe[,1]) 阅读全文
posted @ 2017-02-15 13:58 湘雨jay 阅读(9952) 评论(0) 推荐(1) 编辑

R语言的which函数,针对没有符合条件的返回值为integer(0),之后如何判断

摘要: >x1=c(4,5) >which(x1==3) integer(0) > length(integer(0))[1] 0 返回值为integer(0),其长度为0; 针对integer(0),numeric(0),logical(0) 其长度全部为0 以下为转载:关于integer(0),nume 阅读全文
posted @ 2017-02-15 13:54 湘雨jay 阅读(3990) 评论(0) 推荐(0) 编辑