Skip to content

MarkusLoew/GlasshouseClimateImport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

GlasshouseClimateImport

R-package to import, and merge Creswick glasshouse *.dat files

See

help(package = GlasshouseClimateImport) 

for details on the functions provided by this package.

Installation

To enable installations of packages straight from github use:

install.packages("devtools", dep = TRUE)
library(devtools)

Then install the "GlasshouseClimateImport" package:

devtools::install_github("MarkusLoew/GlasshouseClimateImport")

Installation under Windows might require the installation of Rtools. There will be a prompt for it if needed.

Example session

# test code for package GlasshouseClimateImport

# load library
library(GlasshouseClimateImport)

# set the working directory to the folder with the files
# setwd("~/AgFace/2015/Glasshouses")

# import and merge all DAT files from the folder
# in the example, the DAT files are from the PC2 glasshouse.
# the two options for "glasshouse" are "PC2" or "teaching".
df <- GlasshouseFolderImport(glasshouse = "PC2")

# export the data to a spreadsheet file in csv format
write.csv(df, 
          file = "glasshouse_climate.csv",
          row.names = FALSE)

        
# to visualise the data 
library(reshape2) # library to re-order the data
# re-melting the data
my.data.all.melt <- melt(df,
                         id.vars = "TIME")

# create figures for all parameters
library(ggplot2)
MyPlotFunction <- function(data) {
    my.name <- sort(unique(data$variable))
    p <- ggplot(data, aes(x = TIME, y = value))
    p <- p + geom_line()
    p <- p + labs(y = my.name)
    p <- p + theme_bw()
    return(p)
}

library(plyr)
my.plots <- dlply(my.data.all.melt,
                .(variable),
	         function(x) MyPlotFunction(x))

# put all figures into a pdf file
pdf(file = "Glasshouse_figures.pdf", width = 9, height = 9)
print(my.plots)
dev.off()

About

Import climate data from Creswick glasshouses .DAT files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages