Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setwd("C:/Users/Donkey Kong/Desktop/Jdata") #set working directory
- filenames = list.files(pattern="*.txt") #check folder for all txt's and make a list of file paths
- output<-matrix(NA,ncol=14) #make empty output matrix
- colnames(output)<-c("hour", "minute", "second", "ms", "x", "y", "trial", "tx", "tw", "select", "rt", "intarget", "alltime", "fake")
- doit<-function(){
- matrix()
- for(i in 1:length(filenames)){
- dat<- read.csv(filenames[i],sep="") # read in individual txt file, 1 can be changed to "i" for a loop
- output<-rbind(output,dat)
- }
- output # returns ouput at the end
- }
- BIGDATA<-doit() #run the function and save output to BIGDATA
- BIGDATA #look at it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement