I am using Desc() from DescTools to describe some variables in a rmarkdown PDF document. The problem is that it generates 3 plots that are kept in line when I knit the document, thus clipping the images.
Example:
dates <- sample(seq(as.Date('1999/01/01'), as.Date('2021/01/01'), by="day"), 1000)
results <- DescTools::Desc(dates)
results
The output contains 3 plots. I can find the individual responses using the list in results[[1]]], but I can't find the plot objects, which I think could be a way to put then one below the other.
Any thoughts?
There are no plot objects in
results
.Instead, when you type
results
in your console, it invokes the S3 genericprint
, which in turn dispatches theprint.Desc
method. By default,print.Desc
will call a plotting function based on the "class" member ofresults
, which in your example is"Date"
. If you typeDescTools:::plot.Desc.Date
in your console, you will see the function that actually generates the plot every time you printresults
.So there are no plot objects. There is data to create a plot, and whenever you print
results
to the console, the plots are created by a call to a plotting function.The
Desc
plotting functions seem to have very few options available to allow modifications, so the best option would probably be to use the data insideresults
to create your own plots. If you wish to see the contents ofresults
without the plots, simply type:And if you want the three plots one at a time, you can do: