攻城狮科学家

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

setwd("D:/Research/code/rcode")    #notice the "/"

list.files(getwd()) 

heisenberg <- read.csv(file="simple.csv",head=TRUE,sep=",")

colnames(datatemp)<-c("ID","InsertDate","F1","F2","F3","F4","AccountID","DeviceID","SearchKey")      #change the header of the dataframe

 

简单介绍下R中的各种APPLY函数:

https://screamyao.wordpress.com/2011/05/03/various-apply-functions-in-r-explained/

 

table_temp_avg_date<-as.data.frame(temp_avg_date)     # list to data frame

rm(*)  # remove variable

 

agg_datatemp<-aggregate(datatemp[,3],list(datatemp$Date),mean)  # group by column 3 and apply mean

 

data_stats_temp[grep("hotwaterhours", data_stats_temp$StatsType), ]

 

posted on 2016-01-12 16:18  攻城狮科学家  阅读(229)  评论(0编辑  收藏  举报