你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

excel数据导入的整理

2022/1/1 16:19:11

数据格式:
Excel中的格式:在这里插入图片描述
导入r后的格式:在这里插入图片描述
setwd(mypath)
myfolder<-dir()

mypattern<-"[:alpha:]*(\():alpha:)"

i=1
for (name_folder in myfolder) {
myfile<-paste(mypath,“3-0.csv”,sep="/")
#print(myfile)
tmp<-read.csv(myfile) %>% select_if(~ !all(is.na(.)))
tmp<-tmp %>% mutate(across(where(is.character), ~str_replace(.x,mypattern,""))) %>% mutate_if(is.character,as.numeric) %>% select_if(~ !all(is.na(.)))
tmp<-tmp %>% filter_all(any_vars(!is.na(.)))
time_test<-file.info(myfile)KaTeX parse error: Expected 'EOF', got '#' at position 8: mtime #̲print(time_test…time_test<-rep(time_test,times=nrow(tmp))
tmp$algo_test<-rep(algo_test,times=nrow(tmp))
ifelse(i==1, t<-tmp, t<-rbind(t,tmp))
i=i+1
}