-
Notifications
You must be signed in to change notification settings - Fork 4
plotshpcreate.R
library("UAStools")
?plotshpcreate
For details on infile format please see:
library("UAStools")
?SampleInfile
The infile for plotshpcreate.R requires four columns (Additional columns are permitted but wont be utilize):
- [,3] Plot The number of each plot (numeric)
- [,4] Barcode A unique identifier for each plot (character)
- [,9] Range The range [also called row] number of each plot in the experimental grid (numeric)
- [,10] Row The row [also called column] number of each plot in the experimental grid (numeric)
It is recommended to have repeated Barcodes and Plot numbers if there are multi-row plots (mrowplot= >1) as the plotshpcreatre function accounts for this redundancy within the function.
> head(SampleInfile)
Loc Test Plot Barcode Stock Pedigree Entry Rep Range Row
1 CS17 G2FE 1 CS17-G2FE-001 16.2.19716.04067.0000000 NILASQ4G31I11S3/LH123HT 1 1 4 255
2 CS17 G2FE 1 CS17-G2FE-001 16.2.19716.04067.0000000 NILASQ4G31I11S3/LH123HT NA 1 4 256
3 CS17 G2FE 2 CS17-G2FE-002 16.2.19716.04555.0000000.m1 2369/LH123HT NA 1 4 257
4 CS17 G2FE 2 CS17-G2FE-002 16.2.19716.04555.0000000.m1 2369/LH123HT NA 1 4 258
5 CS17 G2FE 3 CS17-G2FE-003 16.2.19716.04052.0000000 NILASQ4G31I06S2/LH123HT NA 1 4 259
6 CS17 G2FE 3 CS17-G2FE-003 16.2.19716.04052.0000000 NILASQ4G31I06S2/LH123HT NA 1 4 260
Barcodes must be unique across all observations if nrowplot=1.
- If every observation of the infile has a unique barcode use: nrowplot==1.
Barcodes must be identical across adjacent rows in a plot if the trial consists of multi-row plots (see table below).
> head(SampleInfile)
Loc Test Plot Barcode Stock Pedigree Entry Rep Range Row
1 CS17 G2FE 1 CS17-G2FE-001 16.2.19716.04067.0000000 NILASQ4G31I11S3/LH123HT 1 1 4 255
2 CS17 G2FE 1 CS17-G2FE-001 16.2.19716.04067.0000000 NILASQ4G31I11S3/LH123HT NA 1 4 256
- Plotshpcreate was developed for UTM coordinates. Please convert to UTM before attempting to use plotshpcreate.
- Plotshpcreate builds plot polygons based on the A point as a reference and utilized the plot locations in the rectangular grid (Range, Row) of the experimental design to calculate the appropriate geo-locations for the polygon corners.
- The location of "A" is specific and must lie at the bottom left corner of the first plot. More specifically, within the middle of the preceding alley and in the middle of the inter-row space to the left of the first plot (Figure 1).
- The B point is less specific but should be placed in the same inter-row space to accurately capture the angle (i.e. deviation from South/North orientation) of the field (Figure 2).
rowspc Row (i.e. column) spacing of a single row. Default 2.5 feet in reference to 30-inch row spacing.
rowbuf Distance removed from both sides of rowspc to create a buffer zone between plots boundaries.
Default is 0.1 feet.
rangespc Range (i.e. row) spacing of a single row. This dimension refers to the total plot length
including half alley distance on either side of the plot. Default 25 feet.
rangebuf Distance removed from both sides of rangespc to create a buffer zone between plots boundaries.
Default is 2 feet in reference to four-foot allies.
Note: If alleys are 4 feet rangebuf should be set to 2 feet to remove 2 ft from both ends of
the polygon.
If the trial consists of single-row plots a polygon will be created for each observation if each barcode is unique per observation.
If nrowplots=1 results in an error below, the infile$Barcode is not unique across observations.
Error in validObject(res) :
invalid class “SpatialPolygons” object: non-unique Polygons ID slot values
Executable:
#For this example, the plot number in the barcode was replaced with Range_Row
SampleInfile$Barcode<-paste(SampleInfile$Loc,"-",SampleInfile$Test,"-",SampleInfile$Range,"_",SampleInfile$Row,sep="")
### Set the working directory to where you want the files to be saved
setwd("C://Temp")
plotshpcreate(A=c(746374.266,3382152.489), #Point A c(Easting_0.0,Northing_0.0)
B=c(746476.259,3382265.951), #Point B c(Easting_1.0,Northing_1.0)
infile=SampleInfile,
outfile="Ind_plots",
nrowplot=1,
field="CS17-G2FE")
If you have multi-row plots plotshpcreate can create individual .shp files for each row in a plot but subsetting barcodes. Barcode subsetting is numbered left to right by grid location of adjacent rows within a plot.
nrowplot= # of adjacent rows in each plot (must be >1)
multirowind=T
Executable:
### Set the working directory to where you want the files to be saved
setwd("C://Temp")
plotshpcreate(A=c(746239.817,3382052.264), #Point A c(Easting_0.0,Northing_0.0)
B=c(746334.224,3382152.870), #Point B c(Easting_1.0,Northing_1.0)
infile=SampleInfile,
outfile="Ind_Multirow_plots",
nrowplot=2,
multirowind=T,
field="CS17-G2FE")
If you have multi-row plots they can be combined by indicating:
nrowplot= # of adjacent rows in each plot (must be >1)
multirowind=F
Adjacent rows identified as the same Infile$Barcode within the infile will be combined to create a single polygon for each plot.
Executable:
### Set the `working directory to where you want the files to be saved
setwd("C://Temp")
plotshpcreate(A=c(746239.817,3382052.264), #Point A c(Easting_0.0,Northing_0.0)
B=c(746334.224,3382152.870), #Point B c(Easting_1.0,Northing_1.0)
infile=SampleInfile,
outfile="Ind_Multirow_plots",
nrowplot=2,
multirowind=F,
field="CS17-G2FE")
# Find the current working directory
getwd()
# Set working directory example
setwd("C:\\Temp")







