Skip to content

Instantly share code, notes, and snippets.

@samehkamaleldin
Created July 20, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samehkamaleldin/3af55443aadbcaf33867e2b8320f8437 to your computer and use it in GitHub Desktop.
Save samehkamaleldin/3af55443aadbcaf33867e2b8320f8437 to your computer and use it in GitHub Desktop.
R_code
########## Start of header ################
# Title: Data Analysis Assignment [SeaWeed dataset]
#
# Description:
# Analysis of SeaWeed dataset
# extracted of from a field experiment on an island off Connemara
#
# Author:
# Date: 20.07.2017
########## End of header ###################
############################################
# 1- First we clean the table
############################################
# reset R environement
rm(list=ls())
# Import wolf data set from csv file
seaweed <- read.table('SeaWeed.csv', header=T, sep=',')
# convert textual values to numerical values
seaweed$Sediment <- as.numeric(factor(seaweed$Sediment, levels=c("None", "Low", "High")))
seaweed$Nutrients <- as.numeric(factor(seaweed$Nutrients, levels=c("None", "Low", "High")))
# Using examples from:
# http://www.ucd.ie/ecomodel/Resources/R_formulae_WebVersion.html
# fit a single mean to the brown-seaweeds
green_seed_mean <- lm(Green.seaweeds~1, data = seaweed)
plot(seaweed$Nutrients, seaweed$Brown.seaweeds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment