Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

## Files

This file contains data on pain score after laparoscopic vs. open hernia repair. Age, gender and primary/recurrent hernia also included. The ultimate aim here is to work out which of these factors are associated with more pain after this operation.

lap_hernia

## Script

##########################
# Getting started with R #
# Ewen Harrison          #
# April 2013             #
# www.datasurg.net       #
##########################

# Anything after a "#" is a comment and is not run
# Run a line or selection of lines with Ctrl-R

# Create a working directory
# Copy the address of the working directory
# Click on the R console window
# File > Change dir ...
# Paste address into Folder and hit OK.
# Can also use command
# but note \ need changed to /, which is a pain so above method easier.

# Import data from a csv file.
# You can export from Excel in .csv format.
# This is often easier than importing an .xls file

# Read.table into an "object". It can be called anything.
# I've used "data" here, but can be anything
# Ensure file is in working directory.

# Check no errors in console.
# List objects in workspace
ls()

# Summarise data
summary(data)
str(data)
tail(data)
data[1:5,] # first 5 lines
data[,1:5] # first 5 columns

# Get help
# If you know the exact command
# or

# If you don't know the exact command.

# Help with a package.
help(package="ggplot2")