Introduction to Ecological Analysis in R-Day1外文翻译.pdf
文本预览下载声明
Introduction to Ecological Analysis in R (Day 1)
Matthew Lau
November 4, 2008
Today, we covered lot of ground with the goal of providing the tools to
input and manipulate data, conduct analyses and make plots. Below,
I have detailed all of the activities that we did in R.
1. Scripting
2. Math Operations
3. Help!
4. Data Entry
5. Statistical Analyses
6. Plotting
7. Next Class
1 Scripting
Perhaps the most important thing we learned above everything else
is to use a script editor. Do not work solely in the console command
line. Please, open a new script file to work in by going to the file
menu and selecting a ”New Document”. This document can be saved
for future use, unlike the R Console, which will save what you have
done, but not in a reproducible format.
When you script you can write out your code and then run it by
placing the cursor on the line or highlighting all of the script you
want to run and running it (Windows users press CTRL + R and Mac
users press COMMAND or APPLE + ENTER). You can add notes by using
the pound symbol, #, which tells R not to run any text to the right
of that symbol on that line.
2 Math Operations
Math operations are basic and intuitive, but are essential tools for
working eectively in R.
1
2.1 Basic Math Operations:
1 + 1
[1] 2
1 - 1
[1] 0
2 * 2
[1] 4
2/2
[1] 1
2^2
[1] 4
(2 + 2) * 2
[1] 8
2.2 Math Commands
Commands (aka. functions) are the meat of R. They allow us to sim-
plify tasks. The basic structure of a command is command(arguments).
Here we can see the mechanics of any command. Simply, the command
tells R what you want to be done to wha
显示全部