Presentation is loading. Please wait.

Presentation is loading. Please wait.

A brief introduction to the nutrient tool-kit, getting R Studio to work and checking the data Martyn Kelly MGKelly@bowburn-consultancy.co.uk www.microscopesandmonsters.wordpress.com.

Similar presentations


Presentation on theme: "A brief introduction to the nutrient tool-kit, getting R Studio to work and checking the data Martyn Kelly MGKelly@bowburn-consultancy.co.uk www.microscopesandmonsters.wordpress.com."— Presentation transcript:

1 A brief introduction to the nutrient tool-kit, getting R Studio to work and checking the data
Martyn Kelly @Basil0saurus

2 Overview The CIS Guidance Manual explains the theory
Ecological Regulatory Chemical Statistical CIS Guidance Document 23 explains the EU’s strategy for eutrophication This workshop focuses on the process of deriving appropriate boundaries

3 Toolkit versions The most flexible version, but the one where you are most likely to encounter problems A user-friendly version of the R Studio scripts but slightly less flexible and run from a remote server The easiest to use, but also the most basic and lacks some of the functionality

4 How to learn more about R

5

6 Introduction to R: our assumptions
R and R Studio have been installed The toolkit has been extracted to a folder The data you want to use is in the correct format (see data template) This data file is in the same directory as the toolkit. Now open R Studio …

7 The R Studio interface The interface: your script opens here. You can edit it and save changes so that you can run them again in the future. Environment: tells you what data and information has been read into R or derived from calculations you have made. Other windows: includes all files in the working directory, plots you have produced, add-in packages you are using and help files The console: when you run a command you will see the outcome here.

8 R basics: the interface
Text appears in black except: Text that will not be executed is green type a “#” to tell R that this is the case (useful for annotating scripts) Text/numbers that are functions are blue If text appears in red, you’ve made a mistake or R is sending you a warning This will appear in the console, not the interface If it is a mistake, the script will stop working If it is a warning, the script will continue to run Some options in R scripts are prefaced by “#”: data <- read.csv(file = FName, dec=".", header = TRUE) #For "." decimal #data <- read.csv(file = FName, dec=",",header = TRUE) #For “,” decimal, Central Europe (Move the “#” to the upper line of script if you use comma decimals) Everything in R is case sensitive To execute commands: Highlight lines in script and press “run”; or, Ctrl-enter; or, Press “source” to run entire script (not recommended for this course)

9 R basics: graphics Graphs appear under the “plots” tab in the bottom right window … … unless you specify a separate window: > win.graph(width=8,height=4) > par(mfrow=c(1,2)) Different for Macs: > quartz(width=8, height=4)

10 Help! Or type your query directly into Google (answer is often found in stackoverflow.com)

11 Data format Column headings must be exactly as in template
Either cut and paste your values into template Or edit headings in your data file Avoid special characters (/,-,%,$ …) and accents in sample IDs

12 Data format Save your data file in *.csv format

13 Data format

14 More about data EQRs should be uncapped if possible
i.e. not truncated at 1.0 N and P should have few values < detection limit Both these factors can cause deviations from linearity in biology-pressure relationships

15 Load “required packages”
(p. # in Instruction manual) You don’t need these packages for this workshop Double click here

16 Check your data Page 24 in instruction manual
Now load 01_Tkit_check_data.R See if you can run this script yourself, using the example dataset provided. First, edit filename (“Fname”) (line 15) currently: DataTemplate_Example1.csv Change this to: DataTemplate_Example1_wks.csv


Download ppt "A brief introduction to the nutrient tool-kit, getting R Studio to work and checking the data Martyn Kelly MGKelly@bowburn-consultancy.co.uk www.microscopesandmonsters.wordpress.com."

Similar presentations


Ads by Google