Learning to use R
Sep. 20th, 2011 08:53 pmSo today in Ecology lab we learned how to make plots in R using a data set collected a few years ago at Swan Lake. Granted, there are no swans at Swan Lake, and most of the time there is no lake, but that's neither here nor there. =] I then spent the next three hours outside of lab writing a pretty script that will display a histogram of richness and abundance, as well as plots of all 6 combinations on one page. It probably wasn't the most practical use of my time, but if you have R, you should check it out! And let me know if there's anything I should do differently.
My lab partners weren't having the easiest time understanding how the program works, so every section of the script has descriptive hashtags. After running the full script (or even just the add data section), you can then run any single linear regression model and see just the individual plot with the model line! I'm rather proud of myself for my first try. =] Here's a link to a .zip file with the .Rdata file and the data .txt file used. Hope you find it interesting!
http://www.mediafire.com/?3114jesk1zwd974
Also, does anyone know how to use the attach(data) function? I keep getting a warning message when I use it, and I'm not sure why. It didn't show up when my instructor used in in class today. =/ Everything seems to work peachykeen without it, though, so I'm not too worried! The only other thing I'd really like to be able to do is show the equation and R-squared value for linear regression in the plot, but I can always do that manually after the fact, I suppose.
In other news, I've got two exams (Calc and Genetics) still this week, and a paper for my Capstone, so I'd better quit screwing around with this and get some real work done!
My lab partners weren't having the easiest time understanding how the program works, so every section of the script has descriptive hashtags. After running the full script (or even just the add data section), you can then run any single linear regression model and see just the individual plot with the model line! I'm rather proud of myself for my first try. =] Here's a link to a .zip file with the .Rdata file and the data .txt file used. Hope you find it interesting!
http://www.mediafire.com/?3114jesk1zwd974
Also, does anyone know how to use the attach(data) function? I keep getting a warning message when I use it, and I'm not sure why. It didn't show up when my instructor used in in class today. =/ Everything seems to work peachykeen without it, though, so I'm not too worried! The only other thing I'd really like to be able to do is show the equation and R-squared value for linear regression in the plot, but I can always do that manually after the fact, I suppose.
In other news, I've got two exams (Calc and Genetics) still this week, and a paper for my Capstone, so I'd better quit screwing around with this and get some real work done!