qDistnShiny: Simple Shiny Application for "q" Distributions

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This is a simple Shiny application that will display in a webpage. It allows one to manipulate simple inputs to change the parameters of the diameter distribution (e.g. dbh class width) and the “q” value illustrating the results in graphs and tabular output.

Usage

1
2
3
4
5
6
7
qDistnShiny(units = c("English", "metric"),
            returnVar = NA,
            useDT = TRUE,
            shiftZero = FALSE,
            ...)
qDistnUI(conv, useDT, ...)
qDistnServer(returnVar, conv, useDT, shiftZero, ...)

Arguments

units

“English” or “metric” units.

returnVar

This is the name of a variable that will hold a list of relevant stand parameters, including the data frame shown in the webpage; it will be created in the user's workspace (global environment). It must be a character string. Use it like a normal assignment from the return of a function when run from the workspace—more details below.

useDT

TRUE: the display uses the DataTable format (default—very nice); FALSE: uses a default html table format.

conv

A list of conversion factors, no need to be concerned about this since you should not call qDistnServer or qDistnUI directly (see below).

shiftZero

TRUE: shift the lower DBH limit down to zero diameter; FALSE: no shift, just include small trees to the normal lower bound of the first dbh class.

...

Just gobbled at present.

Details

Running the qDistnShiny function will display the application in your web browser. Its use is self-explanatory, there are several sliders for input that change both the graphs and the tabular output essentially instantaneously. The best thing to do is play with it.

Both qDistnServer and qDistnUI are meant to be called only from qDistnShiny. So please do not run these yourself (I know you will since I said this).

Now, because of the way a Shiny application is structured, there is no way to return a variable in the usual manner through R's return statement when calling a function: Shiny is in control of both the user interface (UI) and the server. Therefore, one has to kludge to get the final result back. In this case, the argument returnVar can be used to capture the tabular results on exit (actually all throughout the application's existence). It always gets saved to the user's workspace, so treat it like any other object with regard to the fact that it will delete any existing object of the same name. (If requested, an environment argument could be added to change where it is saved.)

Note that when you request shiftZero=TRUE, the slider for maximum diameter will normally be larger than the upper limit to the largest class shown. This is because the slider is set up for integers that may not align with the shift. This should be obvious and does not affect the results in any way.

Please use the “Exit Application” button to stop the application gracefully. Otherwise at the command line type control-c or escape, whatever works on your system.

Value

Returns an object of class “shiny.appobj”. If you want to capture this, simply assign it to a variable. Otherwise, the return value gets “printed”, which runs the application.

However, if you choose to save the results of the run using the returnVar argument, then a list is placed in the session .GlobalEnv with the following components...

stParams

Final prameter values from the session.

stSum

Stand totals: numbers, basal area, quadratic MSD.

df

A data frame with the tabular results.

Author(s)

JHG.

References

Please see http://shiny.rstudio.com/articles/ for more information about Shiny and its use.

See Also

The shiny package. Also see crDistnShiny.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#
# cut and paste these examples if desired...
#
## Not run: 
qDistnShiny('metric', 'q.df')  #run immediately
qsh = qDistnShiny()            #assign to qsh
str(qsh)                       #look at it
qsh                            #run it

## End(Not run)

Mensuration documentation built on May 2, 2019, 4:52 p.m.