Boxplot

Read data from text file & create boxplot

1) Read data

# Save (Excel) data as as tab separated text file .tsv (Download example)

# read dataset (tabulator \t separated text file; data can contain empty fields)

mydata = read.table('Downloads/data_2x20.tsv', sep="\t", header=TRUE)

# check dataset 'mydata'

head(mydata) # show top lines of dataset

height width

sample01 6.576 3.644

sample02 6.379 3.110

2) Boxplot

# select columns for boxplot

x1=mydata$height

x2=mydata$width

# boxplot

boxplot(x1, x2, names=c("Height", "Width"), boxwex=0.4)

# boxwex=0.4 to get smaller boxplots

3) Save figure as pdf-file

dev.copy(pdf,'myboxplot.pdf')

dev.off()