Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (22 sloc) 1.62 KB

Hints and pseudo code for Exercise 8.23.3 (Wilmes, unpublished)

  1. Write a for loop that processes all images using the function getArea that is provided in CSB/r/solutions/getArea.R. The function accepts a single file name as argument, and returns the projected leaf area, measured in pixels. Your loop should record the leaf area for each image, and store it in the data frame results. To loop over all files, you can use the function list.files along with its pattern matching option, to produce a list of all the files with extension .JPG in the directory CSB/r/data/leafarea/. Work in your sandbox or change paths in the getArea.R function accordingly.

  2. Plot the area of each plant as measured on time point 1 versus time point 2.

  3. Determine if the plants significantly differ at time point 1 and 2 using a paired t-test.

Hints:

  • you will need to install the EBImage package and load it. You can use the code:
# install the EBImage package: run the following two commands
source("http://bioconductor.org/biocLite.R")
biocLite("EBImage")
# note that to install EBImage, you might need to install other libraries


# now load the library
library(EBImage)
  • create an empty data.frame to record results
results <- data.frame(JPG = character(), area = numeric(), stringsAsFactors = FALSE)
  • the function list.files can be used to list all the files in a directory

  • write a for loop and call the getArea function for each file; store the area in the data frame.

  • to extract the information on time point and plant name, parse the file name

  • to run a t-test in R, simply call t.test

You can’t perform that action at this time.