Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. setwd("C:/Users/Donkey Kong/Desktop/Jdata") #set working directory
  2. filenames = list.files(pattern="*.txt") #check folder for all txt's and make a list of file paths
  3. output<-matrix(NA,ncol=14) #make empty output matrix
  4. colnames(output)<-c("hour", "minute", "second", "ms", "x", "y", "trial", "tx", "tw", "select", "rt", "intarget", "alltime", "fake")
  5.  
  6. doit<-function(){
  7.  
  8. matrix()
  9. for(i in 1:length(filenames)){
  10.  
  11. dat<- read.csv(filenames[i],sep="") # read in individual txt file, 1 can be changed to "i" for a loop
  12. output<-rbind(output,dat)
  13. }
  14.  
  15. output # returns ouput at the end
  16. }
  17.  
  18. BIGDATA<-doit() #run the function and save output to BIGDATA
  19.  
  20. BIGDATA #look at it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement