How to display a Time-Series object in Shiny

Greetings,

I have a time-series object ("ts"), that counts the number of enrolled subjects, spans 3 years, starting in April of 2016 and is on-going (currently February 2018), and I need to display the results through the UI. If I print the time-series (ts) to the console, it looks like this:

     Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2016               2   8   7  11  14  17  12   8   3
2017   1   9  12  10   7  11  16  16   7  22  13  14
2018  12   3        

I have tried several variants of "render" (renderText, renderTable, etc) and all do not display what I see in the console window.

For example, renderText and verbatimTextOutput() as well as TextOutput() generate:

2 8 7 11 14 17 12 8 3 1 9 12 10 7 11 16 16 7 22 13 14 12 0

While renderTable() and TableOutput() show this in Shiny:

x
2
8
7
11
14
17
12
8
3
1
9
12
10
7
11
16
16
7
22
13
14
12
3

I have tried to convert to a data frame, however I run into an error with the following code:

dmn = list(month.abb, unique(floor(time(ts))))
df.test2 = as.data.frame(t(matrix(ts,12, dimnames = dmn)))

Error thrown is

In matrix(ts, 12, dimnames = dmn) :
data length [23] is not a sub-multiple or multiple of the number of rows [12]

I was thinking of loading the time series from January 2016 to March 2016 with leading zeros, and adding trailing zeros for all months until end of 2018 (March 2018 - Dec 2018), then trying the above code -- but that seems overly complex for a relatively simple need. Am I missing something here?

Thanks for any help I can get!

Warm Regards,
Dominick A Leone

A couple of ideas:

The output you're seeing in the console is probably the print method for your time series object. What this means is that when you type ts it doesn't just give you the content of ts but instead does some other processing to give you a more useful output. So when you are calling renderText you're printing the content of ts rather than the printed form. I think if you use the printOutout and renderPrint functions you should get the version that goes to the console. https://shiny.rstudio.com/reference/shiny/latest/renderPrint.html

Another great option for displaying time series data is the dygraphs package which has some great interactive visualization options.