Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. # Set working directory with folder containing all .txt files for inspection
  2.  
  3. # Add all .txt files to the global environment
  4.  
  5. allruns<-list.files(pattern=".txt")
  6.  
  7. for(i in 1:length(allruns))assign(allruns[i],read.table(allruns[i]))
  8.  
  9. x<-run1.txt$V1
  10.  
  11. y1<-run1.txt$V2
  12. y2<-run2.txt$V2
  13. y3<-run3.txt$V2
  14. # ...
  15. yn<-runn.txt$V2
  16.  
  17. run1<-lm(y1~x)
  18. run2<-lm(y2~x)
  19. run3<-lm(y3~x)
  20. # ...
  21. runn<-lm(yn~x)
  22.  
  23. plot(x,y1,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y3,yn)))
  24.  
  25. par(new=TRUE)
  26. plot(x,y2,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y3,yn)))
  27.  
  28. par(new=TRUE)
  29. plot(x,y3,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y1,yn)))
  30.  
  31. # ...
  32.  
  33. par(new=TRUE)
  34. plot(x,yn,col="transparent",main="LSV Solid Film", xlab = "potential(V)",ylab="current(A)", xlim=rev(range(x)),ylim=range(c(y1,yn)))
  35.  
  36. #To obtain all LINEST lines (one for each scan, on the single graph):
  37. abline(run1,col=””, lwd=1)
  38. abline(run2,col=””,lwd=1)
  39. abline(run3,col=””,lwd=1)
  40. # ...
  41. abline(runn,col=””,lwd=1)
  42.  
  43. # Then to get each LINEST equation:
  44. summary(run1)
  45. summary(run2)
  46. summary(run3)
  47. # ...
  48. summary(runn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement