Description Usage Arguments Value Author(s) See Also Examples
Reads a plant file (a Yplant input file with extension .p, known as a
pfile), and writes a new pfile, by modifying angles, internode
lengths, or segment diameters.
The function modifypfile is a general function that can be used to modify
any variable in a pfile. The following variables can be changed in a
pfile :
Azimuth and angle of stem sections
Orientation angle of the midrib of the leaf
Branch sections
Petioles
Leaves
The function replaceangles is a specialized version for replacing leaf
angles (and do some specific error checking, or sampling from leaf angle
distributions). The function changeinternodes is a special function
for lengths of woody segments (technically not quite the same as
internodes!).
For replaceangles, an object of class angledist can be
constructed with the angledist function in package
LeafAngle (See Example below) or from fitting to a sample with
fitdistribution. If angles are provided but the vector is too
short, the vector will be sampled with replacement.
1 2 3 4 5 6 7 8 | replaceangles(whichangle = "An.3", pfile = NA, outputfile = NA,
newangles = NULL, distobj = NULL)
modifypfile(pfile = NA, whichvar = NA, outputfile = "tmp.p",
newvalues = NULL)
changeinternodes(pfile = NA, outputfile = "tmp.p", method = c("perc",
"constant"), changeperc = 50, consvalue = NA)
|
whichangle |
By default the leaf angle, or one of the other angles (see Details). |
pfile |
Name of the .p file. |
outputfile |
Name of the new file. |
newangles |
A vector of angles to be used in the new p file (optional, in stead of distobj). |
distobj |
An object of class |
whichvar |
Name of variable in p file to modify (see |
newvalues |
Vector of new values for the variable that is to be replaced. |
method |
for |
changeperc |
If method="perc", change the internodes by this percentage of their orginal value. |
consvalue |
If method="constant", change all internodes to this constant value. |
A new pfile is created, by default with the name "tmp.p",
unless the argument outputfile is set.
Remko Duursma
readp, fitdistribution,
readl, constructplant
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
# Replace angles by sampling from an ellipsoidal distribution:
mydist <- angledist("ellipsoid", distpars=0.7)
replaceangles(pfile="someplant.p", distobj=mydist)
# Make constant angles:
replaceangles(pfile="someplant.p", newangles=45)
# Change new file name:
replaceangles(pfile="someplant.p", outputfile="someplant 45degrees.p", newangles=45)
# Change petiole orientation, choose pfile with dialog box:
replaceangles("Az.2", newangles=runif(300, 0, 360))
# Modify various variables in a pfile, until we end up with an artificial plant,
# useful for testing.
# Order of changes, in this case (although it does not matter!):
# Leaf azimuth, leaf orientation, leaf angle, petiole length, petiole angle.
modifypfile("originalplant.p", whichvar="Az.3", outputfile="testplant.p", newvalues=45)
modifypfile("testplant.p", whichvar="Or", outputfile="testplant.p", newvalues=45)
modifypfile("testplant.p", whichvar="An.3", outputfile="testplant.p", newvalues=-45)
modifypfile("testplant.p", whichvar="L.2", outputfile="testplant.p", newvalues=10)
modifypfile("testplant.p", whichvar="An.2", outputfile="testplant.p", newvalues=45)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.