Title: | Visualization of Design of Experiments from the 'agricolae' Package |
---|---|
Description: | Visualization of Design of Experiments from the 'agricolae' package with 'ggplot2' framework The user provides an experiment design from the 'agricolae' package, calls the corresponding function and will receive a visualization with 'ggplot2' based functions that are specific for each design. As there are many different designs, each design is tested on its type. The output can be modified with standard 'ggplot2' commands or with other packages with 'ggplot2' function extensions. |
Authors: | Jens Harbers [aut, cre] |
Maintainer: | Jens Harbers <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.5.0 |
Built: | 2024-11-17 04:57:28 UTC |
Source: | https://github.com/jensharbers/agricolaeplotr |
Generates citations of all loaded packages
citations(includeURL = TRUE, bibtex = TRUE)
citations(includeURL = TRUE, bibtex = TRUE)
includeURL |
boolean, Should the URL be returned? |
bibtex |
boolean, Should the citations be returned as bibtex? |
printed output to console
library(ggplot2) library(agricolaeplotr) library(agricolae) library(raster) citations()
library(ggplot2) library(agricolaeplotr) library(agricolae) library(raster) citations()
Returns a list with several useful information about the experiment
DOE_obj(p)
DOE_obj(p)
p |
|
a list with several useful information about the experiment and the field
library(agricolae) library(agricolaeplotr) trt = c(2,3,4,5,6) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') p <- plot_design_crd(outdesign1, ncols = 7, nrows = 4, width = 10, height = 10, reverse_y = TRUE) stats <- DOE_obj(p) stats
library(agricolae) library(agricolaeplotr) trt = c(2,3,4,5,6) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') p <- plot_design_crd(outdesign1, ncols = 7, nrows = 4, width = 10, height = 10, reverse_y = TRUE) stats <- DOE_obj(p) stats
This function provides full control about the plotting. The user also may shift the coordinates as liked.
full_control_positions( design, x = "col", y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE, way_x = 0, way_y = 0, shift_x = 0, dist_x = 1, dist_y = 1, shift_y = 0, start_origin = FALSE )
full_control_positions( design, x = "col", y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE, way_x = 0, way_y = 0, shift_x = 0, dist_x = 1, dist_y = 1, shift_y = 0, start_origin = FALSE )
design |
data.frame containing the row and columns of an experiment |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
string Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
way_x |
numeric vector indicates the shift of the nth-plot in x-axis. |
way_y |
numeric vector indicates the shift of the nth-plot in y-axis. |
shift_x |
numeric indicates the shift in units in x-axis. |
dist_x |
numeric indicates the shift in plots in x-axis. |
dist_y |
numeric indicates the shift in plots for the y-axis. |
shift_y |
numeric indicates the shift in units for the y-axis. |
start_origin |
boolean. Should the design start at the origin (0|0)? |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) library(ggplot2) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) design <- outdesign$book design p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.5,space_height=0.5, shift_x=(-0.5*3) + (-0.5*3*0.5),shift_y=-0.5*4.5 + (-0.5*4.5*0.5)) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.13,space_height=0.445, shift_x=(-0.5*3) + (-0.5*3*(1-0.13)),shift_y=-0.5*4.5 + (-0.5*4.5*(1-0.445))) p varieties<-LETTERS[1:12] outdesign <-design.youden(varieties,r=12,serie=2,seed=23) design <- outdesign$book p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=1,space_height=1, shift_x=-0.5*3,shift_y=-0.5*4.5) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945, start_origin = TRUE) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945,way_x = c(2,6,8,10,12),way_y=c(3,8),dist_x=2,dist_y=4, start_origin = TRUE, reverse_y = FALSE, reverse_x = FALSE);p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945, way_x = c(2,4,6,8,10,12),way_y=c(3,8), start_origin = FALSE, reverse_y = FALSE, reverse_x = FALSE);p
library(agricolaeplotr) library(agricolae) library(ggplot2) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) design <- outdesign$book design p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.5,space_height=0.5, shift_x=(-0.5*3) + (-0.5*3*0.5),shift_y=-0.5*4.5 + (-0.5*4.5*0.5)) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.13,space_height=0.445, shift_x=(-0.5*3) + (-0.5*3*(1-0.13)),shift_y=-0.5*4.5 + (-0.5*4.5*(1-0.445))) p varieties<-LETTERS[1:12] outdesign <-design.youden(varieties,r=12,serie=2,seed=23) design <- outdesign$book p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=1,space_height=1, shift_x=-0.5*3,shift_y=-0.5*4.5) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945, start_origin = TRUE) p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945,way_x = c(2,6,8,10,12),way_y=c(3,8),dist_x=2,dist_y=4, start_origin = TRUE, reverse_y = FALSE, reverse_x = FALSE);p p <- full_control_positions(design,"col","row","varieties","plots", width=3,height=4.5, space_width=0.93,space_height=0.945, way_x = c(2,4,6,8,10,12),way_y=c(3,8), start_origin = FALSE, reverse_y = FALSE, reverse_x = FALSE);p
This function coerces all rectangles from a 'ggplot' object to 'SpatialPolygonDataFrame'.
make_polygons( ggplot_object, north = 3454206.89, east = 5939183.21, projection_input = "+init=epsg:31467", projection_output = "+init=epsg:4326" )
make_polygons( ggplot_object, north = 3454206.89, east = 5939183.21, projection_input = "+init=epsg:31467", projection_output = "+init=epsg:4326" )
ggplot_object |
saved ggplot object, containing the coordinates of the rectangles of a 'ggplot' object of the first two layers |
north |
float added to the rows to have a northing ordinate |
east |
float added to the rows to have a easting ordinate |
projection_input |
string defines in which EPSG projection the ggplot object should be converted to a raster object? a projection with a metric unit is highly recommended |
projection_output |
string defines in which EPSG projection the SpatialPolygonDataFrame should be exported. |
a SpatialPolygonDataFrame object
library(agricolaeplotr) library(agricolae) trt = c(2,3,4) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') plt <- plot_design_crd(outdesign1,ncols = 13,nrows = 3) spat_df <- make_polygons(plt) spat_df
library(agricolaeplotr) library(agricolae) trt = c(2,3,4) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') plt <- plot_design_crd(outdesign1,ncols = 13,nrows = 3) spat_df <- make_polygons(plt) spat_df
Plot a design of an experiment with an alpha design from agricolae
design.alpha
plot_alpha( design, x = "cols", y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_alpha( design, x = "cols", y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-1:30 t <- length(trt) # size block k k<-3 # Blocks s s<-t/k # replications r r <- 2 outdesign<- design.alpha(trt,k,r,serie=2) plot_alpha(outdesign)
library(agricolaeplotr) library(agricolae) trt<-1:30 t <- length(trt) # size block k k<-3 # Blocks s s<-t/k # replications r r <- 2 outdesign<- design.alpha(trt,k,r,serie=2) plot_alpha(outdesign)
Plot a design of an experiment with an Randomized Balanced Incomplete Block Designs (BIB) from design.bib
plot_bib( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_bib( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-c('A','B','C','D') k<-3 outdesign<-design.bib(trt,k,serie=2,seed =41,kinds ='Super-Duper') # seed = 41 plot_bib(outdesign) #now let us change position of the columns plot_bib(outdesign,reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) trt<-c('A','B','C','D') k<-3 outdesign<-design.bib(trt,k,serie=2,seed =41,kinds ='Super-Duper') # seed = 41 plot_bib(outdesign) #now let us change position of the columns plot_bib(outdesign,reverse_x = TRUE)
Plot a design of an experiment with an cyclic design from agricolae
design.cyclic
plot_cyclic( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_cyclic( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) k <- 2 r <- 6 trt <-c('CIP-101','CIP-201','CIP-301','CIP-401','CIP-501',LETTERS[1:2]) outdesign<- design.cyclic(trt,k=k, r=r, serie=3, rowcol=TRUE) plot_cyclic(outdesign, factor_name = 'trt')
library(agricolaeplotr) library(agricolae) k <- 2 r <- 6 trt <-c('CIP-101','CIP-201','CIP-301','CIP-401','CIP-501',LETTERS[1:2]) outdesign<- design.cyclic(trt,k=k, r=r, serie=3, rowcol=TRUE) plot_cyclic(outdesign, factor_name = 'trt')
Plot a design of an experiment with an augmented block design from agricolae
design.dau
plot_dau( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_dau( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('A','B','C','D','E','F') T2<-letters[19:26] outdesign <-design.dau(T1,T2, r=5,serie=2) plot_dau(outdesign) plot_dau(outdesign,reverse_y = TRUE)
library(agricolaeplotr) library(agricolae) T1<-c('A','B','C','D','E','F') T2<-letters[19:26] outdesign <-design.dau(T1,T2, r=5,serie=2) plot_dau(outdesign) plot_dau(outdesign,reverse_y = TRUE)
Plot a design of a factorial experiment with randomized complete block design from agricolae
design.ab
plot_design_crd( design, ncols, nrows, y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_design_crd( design, ncols, nrows, y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
ncols |
integer value, choose the number of columns to which the experiment should be plotted |
nrows |
integer value, choose the number of rows to which the experiment should be plotted |
y |
Describes the y coordinates of a experiment design, default is row |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt = c(2,3,4,5,6) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') plot_design_crd(outdesign1,ncols = 13,nrows = 3)
library(agricolaeplotr) library(agricolae) trt = c(2,3,4,5,6) outdesign1 <-design.crd(trt,r=5,serie=2,2543,'Mersenne-Twister') plot_design_crd(outdesign1,ncols = 13,nrows = 3)
Plot a design of a factorial experiment with completely randomized design (crd) from design.ab
plot_design.factorial_crd( design, ncols, nrows, y = "row", factor_name = "A", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_design.factorial_crd( design, ncols, nrows, y = "row", factor_name = "A", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
ncols |
integer value, choose the number of columns to which the experiment should be plotted |
nrows |
integer value, choose the number of rows to which the experiment should be plotted |
y |
Describes the y coordinates of a experiment design, default is row |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
string indicates the column of which the labels should be displayed |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-c(3,2) # factorial 3x2 outdesign <- design.ab(trt, r=3, serie=2,design = 'crd') plot_design.factorial_crd(outdesign,ncols = 8,nrows = 6) plot_design.factorial_crd(outdesign,reverse_y = TRUE,ncols = 8,nrows = 6) plot_design.factorial_crd(outdesign,reverse_y = TRUE,reverse_x = TRUE,ncols = 8,nrows = 6)
library(agricolaeplotr) library(agricolae) trt<-c(3,2) # factorial 3x2 outdesign <- design.ab(trt, r=3, serie=2,design = 'crd') plot_design.factorial_crd(outdesign,ncols = 8,nrows = 6) plot_design.factorial_crd(outdesign,reverse_y = TRUE,ncols = 8,nrows = 6) plot_design.factorial_crd(outdesign,reverse_y = TRUE,reverse_x = TRUE,ncols = 8,nrows = 6)
Plot a design of a factorial experiment with latin square design (lsd) design from agricolae
design.ab
plot_design.factorial_lsd( design, x = "col", y = "row", factor_name = "A", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_design.factorial_lsd( design, x = "col", y = "row", factor_name = "A", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-c(3,2) # factorial 3x2 outdesign <-design.ab(trt, r=3, serie=2,design = 'lsd') plot_design.factorial_lsd(outdesign,factor_name = 'B',reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) trt<-c(3,2) # factorial 3x2 outdesign <-design.ab(trt, r=3, serie=2,design = 'lsd') plot_design.factorial_lsd(outdesign,factor_name = 'B',reverse_x = TRUE)
Plot a design of a factorial experiment with randomized complete block design (rcbd) from design.ab
plot_design.factorial_rcbd( design, y = "row", factor_name = "A", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_x = FALSE, reverse_y = FALSE )
plot_design.factorial_rcbd( design, y = "row", factor_name = "A", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_x = FALSE, reverse_y = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') plot_design.factorial_rcbd(design=outdesign,factor_name = 'B') plot_design.factorial_rcbd(outdesign,reverse_y = TRUE,reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') plot_design.factorial_rcbd(design=outdesign,factor_name = 'B') plot_design.factorial_rcbd(outdesign,reverse_y = TRUE,reverse_x = TRUE)
Plots designs from FielDHub
package
plot_fieldhub( design, x = "COLUMN", y = "ROW", labels = "PLOT", factor_name = "TREATMENT", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE, shift_x = 0, shift_y = 0 )
plot_fieldhub( design, x = "COLUMN", y = "ROW", labels = "PLOT", factor_name = "TREATMENT", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE, shift_x = 0, shift_y = 0 )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
labels |
string Describes the column from that the plots are taken to display them |
factor_name |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
shift_x |
numeric indicates the shift in units in x-axis. |
shift_y |
numeric indicates the shift in units for the y-axis. |
ggplot
graphic that can be modified, if wished
## Not run: library(agricolaeplotr) library(FielDHub) H <- paste("H", 1:4, sep = "") V <- paste("V", 1:5, sep = "") strip1 <- FielDHub::strip_plot(Hplots = H, Vplots = V, b = 1, l = 1, plotNumber = 101, planter = "serpentine", locationNames = "A", seed = 333) strip1$fieldBook$ROW <- as.numeric(ordered(strip1$fieldBook$VSTRIP, levels = unique(strip1$fieldBook$VSTRIP))) strip1$fieldBook$COLUMN <- as.numeric(ordered(strip1$fieldBook$HSTRIP, levels = unique(strip1$fieldBook$HSTRIP))) plot_fieldhub(strip1, x = "ROW", y = "COLUMN", labels = "HSTRIP", factor_name = "HSTRIP", width = 12, height = 10, reverse_y = FALSE, reverse_x = FALSE) ## End(Not run)
## Not run: library(agricolaeplotr) library(FielDHub) H <- paste("H", 1:4, sep = "") V <- paste("V", 1:5, sep = "") strip1 <- FielDHub::strip_plot(Hplots = H, Vplots = V, b = 1, l = 1, plotNumber = 101, planter = "serpentine", locationNames = "A", seed = 333) strip1$fieldBook$ROW <- as.numeric(ordered(strip1$fieldBook$VSTRIP, levels = unique(strip1$fieldBook$VSTRIP))) strip1$fieldBook$COLUMN <- as.numeric(ordered(strip1$fieldBook$HSTRIP, levels = unique(strip1$fieldBook$HSTRIP))) plot_fieldhub(strip1, x = "ROW", y = "COLUMN", labels = "HSTRIP", factor_name = "HSTRIP", width = 12, height = 10, reverse_y = FALSE, reverse_x = FALSE) ## End(Not run)
Plot a design of an experiment with an Graeco - latin square design from agricolae
design.graeco
plot_graeco( design, x = "col", y = "row", factor_name = "T1", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_graeco( design, x = "col", y = "row", factor_name = "T1", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d') T2<-c('v','w','x','y','z','zz') outdesign <- design.graeco(trt1=T1, trt2=T2, serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE) plot_graeco(outdesign, factor_name = 'T2',reverse_y = TRUE) plot_graeco(outdesign, factor_name = 'T2',reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d') T2<-c('v','w','x','y','z','zz') outdesign <- design.graeco(trt1=T1, trt2=T2, serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE) plot_graeco(outdesign, factor_name = 'T2',reverse_y = TRUE) plot_graeco(outdesign, factor_name = 'T2',reverse_x = TRUE)
Plot a design of a factorial experiment with a latin square design from agricolae
design.lsd
plot_latin_square( design, x = "col", y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_latin_square( design, x = "col", y = "row", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-LETTERS[1:9] outdesign<- design.lsd(trt,serie=2) plot_latin_square(outdesign, reverse_y = TRUE)
library(agricolaeplotr) library(agricolae) trt<-LETTERS[1:9] outdesign<- design.lsd(trt,serie=2) plot_latin_square(outdesign, reverse_y = TRUE)
Plot a design of a factorial experiment with a lattice design from agricolae
design.lattice with r=2
plot_lattice_simple( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_lattice_simple( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-1:100 outdesign<-design.lattice(trt,r=2,serie=3) # simple lattice design, 10x10 plot_lattice_simple(outdesign,width = 2, height = 1)
library(agricolaeplotr) library(agricolae) trt<-1:100 outdesign<-design.lattice(trt,r=2,serie=3) # simple lattice design, 10x10 plot_lattice_simple(outdesign,width = 2, height = 1)
Plot a design of a factorial experiment with a latin square design from agricolae
design.lattice with r=3
plot_lattice_triple( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_lattice_triple( design, y = "block", factor_name = "trt", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) trt<-LETTERS[1:9] outdesign<-design.lattice(trt,r=3,serie=2) plot_lattice_triple(design=outdesign,reverse_x=TRUE)
library(agricolaeplotr) library(agricolae) trt<-LETTERS[1:9] outdesign<-design.lattice(trt,r=3,serie=2) plot_lattice_triple(design=outdesign,reverse_x=TRUE)
This function takes a field and plots the longest diagonal of the field. The field is divided into segments and points are sampled from these segments.
plot_longest_diagonal( field, n = 8, type = "random", n_segments = 2, distance_field_boundary = 3, width_diagonal_path = 2 )
plot_longest_diagonal( field, n = 8, type = "random", n_segments = 2, distance_field_boundary = 3, width_diagonal_path = 2 )
field |
An object of class sf representing the field. |
n |
Integer, the number of sample points along the longest diagonal. |
type |
Type of sampling. Default is "random". |
n_segments |
Numeric, the number of segments to divide the longest diagonal (default is 2). |
distance_field_boundary |
Numeric, the distance to buffer the field for creating the boundary (default is 3.0). |
width_diagonal_path |
Numeric, the width to buffer the diagonal path (default is 2.0). |
p: A ggplot object showing the field, the buffered field, the buffered line, and the sample points.
buffered_line: A sf object representing the buffered line.
my_line: A sf object representing the longest diagonal of the field.
sample_points: A sf object representing the sampled points.
length: A numeric value, representing the length of the longest line.
library(sf) my_sf <- st_read(system.file("shape/gfn_schlaege.shp", package="agricolaeplotr")) st_crs(my_sf) <- 25832 field <- my_sf[my_sf$SCHLAG_NR == 170,] plot_longest_diagonal(field)
library(sf) my_sf <- st_read(system.file("shape/gfn_schlaege.shp", package="agricolaeplotr")) st_crs(my_sf) <- 25832 field <- my_sf[my_sf$SCHLAG_NR == 170,] plot_longest_diagonal(field)
Plot a design of an experiment with randomized complete block design (rcbd) design from agricolae
design.rcbd
plot_rcbd( design, y = "block", factor_name = "trt", labels = "plots", treatment_label = "trt", width = 1, height = 1, space_width = 0.95, space_height = 0.85, label_width = 10, reverse_y = FALSE, reverse_x = FALSE )
plot_rcbd( design, y = "block", factor_name = "trt", labels = "plots", treatment_label = "trt", width = 1, height = 1, space_width = 0.95, space_height = 0.85, label_width = 10, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
Describes the y coordinates of a experiment design |
factor_name |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
treatment_label |
Describes the column(s) from the treatments the plots are taken to display them as a label text |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
label_width |
numeric value, describes the maximum width of a label |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) # 5 treatments and 6 blocks trt<-c('A','B','C','D','E') outdesign <-design.rcbd(trt,6,serie=2,986,'Wichmann-Hill') # seed = 986 plot_rcbd(outdesign) plot_rcbd(outdesign,reverse_y = TRUE,reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) # 5 treatments and 6 blocks trt<-c('A','B','C','D','E') outdesign <-design.rcbd(trt,6,serie=2,986,'Wichmann-Hill') # seed = 986 plot_rcbd(outdesign) plot_rcbd(outdesign,reverse_y = TRUE,reverse_x = TRUE)
Plot a design of a split plot experiment with a complete randomized design (crd) from design.split
plot_split_crd( design, nrows, ncols, factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", subplots = TRUE, width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_split_crd( design, nrows, ncols, factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", subplots = TRUE, width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
nrows |
Number of rows for the design |
ncols |
Number of columns for the design |
factor_name_1 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
factor_name_2 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
string Describes the column from that the plots are taken to display them |
subplots |
should the plot function return the subplots (default) or main plots? |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','zzz') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=TRUE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5) outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','zzz') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=TRUE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5) outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)
Plot a design of a split plot experiment with latin squared design (lsd) from design.split
plot_split_lsd( design, factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", subplots = TRUE, width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_split_lsd( design, factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", subplots = TRUE, width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
factor_name_1 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
factor_name_2 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
string Describes the column from that the plots are taken to display them |
subplots |
should the plot function return the subplots (default) or main plots? |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e') T2<-c('v','w','x','y') outdesign2 <- design.split(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper', randomization=TRUE,first=TRUE,design = 'lsd') plot_split_lsd(outdesign2,width = 4,height = 4)
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e') T2<-c('v','w','x','y') outdesign2 <- design.split(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper', randomization=TRUE,first=TRUE,design = 'lsd') plot_split_lsd(outdesign2,width = 4,height = 4)
Plot a design of a split plot experiment with randomized complete blocks design (rcbd) from design.split
plot_split_rcbd( design, y = "block", factor_name_1 = "T1", factor_name_2 = "T2", subplots = TRUE, labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_split_rcbd( design, y = "block", factor_name_1 = "T1", factor_name_2 = "T2", subplots = TRUE, labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
y |
string defines the block |
factor_name_1 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
factor_name_2 |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
subplots |
should the plot function return the subplots (default) or main plots? |
labels |
string Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e') T2<-c('v','w','x','y','z','zz') r = 3 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE, first=TRUE,design = 'rcbd') plot_split_rcbd(outdesign2,width = 1,height = 1) plot_split_rcbd(outdesign2,width = 1,height = 1,reverse_y = TRUE) plot_split_rcbd(outdesign2,width = 1,height = 1,reverse_x = TRUE,reverse_y = TRUE)
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e') T2<-c('v','w','x','y','z','zz') r = 3 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE, first=TRUE,design = 'rcbd') plot_split_rcbd(outdesign2,width = 1,height = 1) plot_split_rcbd(outdesign2,width = 1,height = 1,reverse_y = TRUE) plot_split_rcbd(outdesign2,width = 1,height = 1,reverse_x = TRUE,reverse_y = TRUE)
Plot a design of an experiment with an Strip Plot design from agricolae
design.strip
plot_strip( design, x = "col", y = "row", factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_strip( design, x = "col", y = "row", factor_name_1 = "T1", factor_name_2 = "T2", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name_1 |
Which factor should be used for plotting, needs to be a column in outdesign$book |
factor_name_2 |
Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
Describes the column from that the plots are taken to display them |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d') T2<-c('v','w','x','y','z') r = 3 outdesign <- design.strip(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE) plot_strip(outdesign,factor_name_1 = "T1",factor_name_2="T2") plot_strip(outdesign,factor_name_1 = "T1",factor_name_2="T2",reverse_x = TRUE)
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d') T2<-c('v','w','x','y','z') r = 3 outdesign <- design.strip(trt1=T1, trt2=T2, r=r,serie = 2, seed = 0, kinds = 'Super-Duper',randomization=TRUE) plot_strip(outdesign,factor_name_1 = "T1",factor_name_2="T2") plot_strip(outdesign,factor_name_1 = "T1",factor_name_2="T2",reverse_x = TRUE)
Plot a Youden experiment design from agricolae
design.youden
plot_youden( design, x = "col", y = "row", factor_name = "varieties", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
plot_youden( design, x = "col", y = "row", factor_name = "varieties", labels = "plots", width = 1, height = 1, space_width = 0.95, space_height = 0.85, reverse_y = FALSE, reverse_x = FALSE )
design |
outdesign from |
x |
Describes the x coordinates of a experiment design |
y |
Describes the y coordinates of a experiment design |
factor_name |
string Which factor should be used for plotting, needs to be a column in outdesign$book |
labels |
string Describes the column from that the plots are taken to display them. |
width |
numeric value, describes the width of a plot in an experiment |
height |
numeric value, describes the height of a plot in an experiment |
space_width |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of width |
space_height |
numeric value, describes the share of the space of the plots. 0=only space, 1=no space between plots in term of height |
reverse_y |
boolean, should the plots of the experiment be changed in reverse order in Row direction? Use reverse_y=TRUE to have same sketch as in agricolae. default:reverse_y=FALSE |
reverse_x |
boolean, should the plots of the experiment be changed in reverse order in column direction? default:reverse_x=FALSE |
ggplot
graphic that can be modified, if wished
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) plot_youden(outdesign, labels = 'varieties')
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) plot_youden(outdesign, labels = 'varieties')
This function generates protective layers around the polygons of an experiment. These layers can be used to plot boundaries, for example, to protect agricultural on-farm experiments from accidental harvesting.
protective_layers(design, borders = c(0, 3, 5, 10))
protective_layers(design, borders = c(0, 3, 5, 10))
design |
An |
borders |
A numeric vector specifying the distances (in meters) for which protective layers should be created. The layers will be created with decreasing distances, starting from the largest. |
An sf
object representing the protective layers around the
experiment polygons.
library(agricolaeplotr) library(sf) library(ggplot2) example("make_polygons") polygo <- make_polygons(plt, north = 13454206.89, east = 7939183.21) polygo <- st_transform(polygo, 25832) pl <- protective_layers(polygo) # plot experiment shape ggplot(pl) + geom_sf(fill=c("black","orange","blue","red"))+ theme_minimal() # write them to kml for Google Maps # st_write(pl, "boundaries2.kml", append = FALSE)
library(agricolaeplotr) library(sf) library(ggplot2) example("make_polygons") polygo <- make_polygons(plt, north = 13454206.89, east = 7939183.21) polygo <- st_transform(polygo, 25832) pl <- protective_layers(polygo) # plot experiment shape ggplot(pl) + geom_sf(fill=c("black","orange","blue","red"))+ theme_minimal() # write them to kml for Google Maps # st_write(pl, "boundaries2.kml", append = FALSE)
Returns locations to sample for each plot.
sample_locations(design, n, plot = TRUE, ...)
sample_locations(design, n, plot = TRUE, ...)
design |
Your experiment design of plot layouts. |
n |
Number of samples per plot (integer). |
plot |
Logical, indicating whether to visualize the sample locations as a ggplot2-based map. |
... |
further options for 'st_sample' and 'make_polygons' |
This function takes an experiment design (plot layout) and returns random sample locations within each plot. The function uses the 'sf' package to generate spatial polygons for the plots and then samples points within each polygon. Optionally, it can also display the sample locations as a ggplot2-based map.
An 'sf' object containing the sample locations within each plot.
library(agricolaeplotr) library(agricolae) library(ggplot2) trt <- c('A', 'B', 'C', 'D') k <- 3 outdesign <- design.bib(trt, k, serie = 2, seed = 41, kinds = 'Super-Duper') plot_bib(outdesign) p <- plot_bib(outdesign) sample_locations(p, 3, TRUE, projection_output = 25832)
library(agricolaeplotr) library(agricolae) library(ggplot2) trt <- c('A', 'B', 'C', 'D') k <- 3 outdesign <- design.bib(trt, k, serie = 2, seed = 41, kinds = 'Super-Duper') plot_bib(outdesign) p <- plot_bib(outdesign) sample_locations(p, 3, TRUE, projection_output = 25832)
This function produces a serpentine array of integers beginning by one
serpentine(n, times, m = 1)
serpentine(n, times, m = 1)
n |
integer value indicating the upper cap of a numeric sequence |
times |
integer number of replications |
m |
integer value indicating the lower cap of a numeric sequence |
vector containing the serpentine sequence
serpentine(n=20,times = 15) serpentine(n=20,times = 15,m=4)
serpentine(n=20,times = 15) serpentine(n=20,times = 15,m=4)
print a summary of a FieldLayout object
summary(object, unit = "m", part = "net_plot", ...)
summary(object, unit = "m", part = "net_plot", ...)
object |
an object, created by DOE_obj with a FieldLayout class |
unit |
a string that corresponds to measure unit (default is m) |
part |
which part of the summary are you interested? Choose one of the following: "net_plot","gross_plot","field","experiment","all" |
... |
further arguments passed to or from other methods |
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) p <- plot_youden(outdesign, labels = 'varieties') stats <- DOE_obj(p) # print plot summary for net plot (plots without space) summary(stats, part = "net_plot") # print plot summary for gross plot (plots with space) summary(stats, part = "gross_plot") # print plot summary for entire field summary(stats, part = "field") # print plot summary for design summary summary(stats, part = "experiment") # print plot summary for all information shown above in one output summary(stats, part = "all")
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) p <- plot_youden(outdesign, labels = 'varieties') stats <- DOE_obj(p) # print plot summary for net plot (plots without space) summary(stats, part = "net_plot") # print plot summary for gross plot (plots with space) summary(stats, part = "gross_plot") # print plot summary for entire field summary(stats, part = "field") # print plot summary for design summary summary(stats, part = "experiment") # print plot summary for all information shown above in one output summary(stats, part = "all")
Test if input is numeric for field width and height
test_input_extend(x)
test_input_extend(x)
x |
input to be tested |
error
library(agricolaeplotr) test_input_extend(3)
library(agricolaeplotr) test_input_extend(3)
checks if input is suitable for matrix column indication
test_input_ncols(x)
test_input_ncols(x)
x |
input to be tested |
error
library(agricolaeplotr) test_input_ncols(9)
library(agricolaeplotr) test_input_ncols(9)
checks if input is suitable for matrix row indication
test_input_nrows(x)
test_input_nrows(x)
x |
input to be tested |
error
library(agricolaeplotr) test_input_nrows(10)
library(agricolaeplotr) test_input_nrows(10)
Test if input is a logical
test_input_reverse(x)
test_input_reverse(x)
x |
input to be tested |
error
library(agricolaeplotr) test_input_reverse(TRUE)
library(agricolaeplotr) test_input_reverse(TRUE)
Test if input is numeric for shift parameter
test_input_shift(x)
test_input_shift(x)
x |
input to be tested |
error
library(agricolaeplotr) test_input_shift(0.5)
library(agricolaeplotr) test_input_shift(0.5)
Test if input is in column names of a table
test_name_in_column(x, design)
test_name_in_column(x, design)
x |
string input |
design |
design from |
error
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') test_name_in_column('B',outdesign)
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') test_name_in_column('B',outdesign)
Test if the outdesign file contains book and parameter list
test_names_design(design)
test_names_design(design)
design |
design from |
error
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') test_names_design(outdesign)
library(agricolaeplotr) library(agricolae) trt<-c(2,4) k=6 outdesign<-design.ab(trt, r=k, serie=3,design='rcbd') test_names_design(outdesign)
Test if input is a string
test_string(x)
test_string(x)
x |
input to be tested |
error
library(agricolaeplotr) test_string('smallstring')
library(agricolaeplotr) test_string('smallstring')
Creates a theme for 'ggplot' based graphics to ensure to meet formal requirements for conferences of the Gesellschaft fuer Informatik
theme_gi()
theme_gi()
a 'ggplot' graph with a modified theme
# example borrowed from ggplot2 library(ggplot2) df <- data.frame( gp = factor(rep(letters[1:3], each = 10)), y = rnorm(30)) p <- ggplot() + geom_point(data = df, aes(gp, y)) p <- p + theme_gi();p
# example borrowed from ggplot2 library(ggplot2) df <- data.frame( gp = factor(rep(letters[1:3], each = 10)), y = rnorm(30)) p <- ggplot() + geom_point(data = df, aes(gp, y)) p <- p + theme_gi();p
This theme is designed to increase font size to ensure readability on poster presentations
theme_poster()
theme_poster()
ggplot2 theme
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','z') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)+ theme_poster()
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','z') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)+ theme_poster()
This theme is designed to increase font size to ensure readability on outdoor used devices
theme_pres()
theme_pres()
ggplot2 theme
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','z') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)+ theme_pres()
library(agricolaeplotr) library(agricolae) T1<-c('a','b','c','d','e','f','g') T2<-c('v','w','x','y','z') r <- 4 outdesign2 <- design.split(trt1=T1, trt2=T2, r=r, serie = 2, seed = 0, kinds = 'Super-Duper', randomization=FALSE,first=TRUE,design = 'crd') plot_split_crd(outdesign2,ncols = 6,nrows=5)+ theme_pres()
Write field experiment information to a dataframe.
to_table(object, part = "net_plot", unit = "m", digits = 3, ...)
to_table(object, part = "net_plot", unit = "m", digits = 3, ...)
object |
an object, created by DOE_obj with a FieldLayout class |
part |
which part of the summary are you interested? Choose one of the following: "net_plot","gross_plot","field","experiment" |
unit |
a string that corresponds to measure unit (default is m) |
digits |
integer indicating the number of decimal places (round) or significant digits (signif) to be used. Negative values are allowed |
... |
further arguments passed to or from other methods |
dataframe with corresponding information about the experiment
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) p <- plot_youden(outdesign, labels = 'varieties', width=4, height=3) stats <- DOE_obj(p) r <- to_table(stats,part = "net_plot", digits = 2) r r <- to_table(stats,part = "gross_plot", digits = 2) r r <- to_table(stats,part = "field", digits = 2) r r <- to_table(stats,part = "experiment", digits = 2) r r <- to_table(stats,part = "all", digits = 2) r
library(agricolaeplotr) library(agricolae) varieties<-c('perricholi','yungay','maria bonita','tomasa') outdesign <-design.youden(varieties,r=2,serie=2,seed=23) p <- plot_youden(outdesign, labels = 'varieties', width=4, height=3) stats <- DOE_obj(p) r <- to_table(stats,part = "net_plot", digits = 2) r r <- to_table(stats,part = "gross_plot", digits = 2) r r <- to_table(stats,part = "field", digits = 2) r r <- to_table(stats,part = "experiment", digits = 2) r r <- to_table(stats,part = "all", digits = 2) r