FredHasselman / casnet

An R toolbox for studying Complex Adaptive Systems and NETworks
https://fredhasselman.github.io/casnet/
GNU General Public License v3.0
27 stars 7 forks source link

plotDC_res needs more than 50 data points to work #4

Closed heinonmatti closed 4 years ago

heinonmatti commented 4 years ago

In casnet 0.1.5, if the data is less than 50 observations, e.g. dc_win gives:

object 'majorBreaks' not found

In plotDC_res, there's an if call that says: if (NROW(df_win) > 50) { labels <- labels[minorBreaks] labels <- labels[c(seq(2, length(minorBreaks), by = round(length(minorBreaks)/25)))] majorBreaks <- minorBreaks[c(seq(2, length(minorBreaks), by = round(length(minorBreaks)/25)))] }

Changing the first line to if (NROW(df_win) > 50 | NROW(df_win) < 51) { at least makes the code run.

This affects behaviour of at least dc_win, plotDC_ccp, and plotDC_lvl.