Running examples in ‘MarketMatching-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: MarketMatching
> ### Title: Market Matching and Causal Impact Inference
> ### Aliases: MarketMatching MarketMatching-package
> ### Keywords: causal impact matching, series time warping,
> 
> ### ** Examples
> 
> 
> ##-----------------------------------------------------------------------
> ## Find best matches for CPH
> ## If we leave test_market as NULL, best matches are found for all markets
> ##-----------------------------------------------------------------------
> library(MarketMatching)
> data(weather, package="MarketMatching")
> mm <- best_matches(data=weather, 
+                    id="Area",
+                    date_variable="Date",
+                    matching_variable="Mean_TemperatureF",
+                    parallel=FALSE,
+                    markets_to_be_matched="CPH",
+                    warping_limit=1, # warping limit=1
+                    dtw_emphasis=1, # rely only on dtw for pre-screening
+                    matches=5, # request 5 matches
+                    start_match_period="2014-01-01",
+                    end_match_period="2014-10-01")
> head(mm$Distances)
NULL
> 
> ##-----------------------------------------------------------------------
> ## Analyze causal impact of a made-up weather intervention in Copenhagen
> ## Since this is weather data it is a not a very meaningful example. 
> ## This is merely to demonstrate the functionality.
> ##-----------------------------------------------------------------------
> results <- MarketMatching::inference(matched_markets = mm, 
+                                      test_market = "CPH", 
+                                      analyze_betas=FALSE,
+                                      end_post_period = "2015-10-01", 
+                                      prior_level_sd = 0.002)
	------------- Inputs -------------
	Test Market: CPH
	Control Market 1: BOS
	Control Market 2: JFK
	Control Market 3: LHR
	Control Market 4: STR
	Control Market 5: ZRH
	Market ID: Area
	Date Variable: Date
	Matching (pre) Period Start Date: 2014-01-01
	Matching (pre) Period End Date: 2014-10-01
	Post Period Start Date: 2014-10-02
	Post Period End Date: 2014-12-31
	Matching Metric: Mean_TemperatureF
	bsts parameters: 
	  prior.level.sd: 0.002
	  No seasonality specified. Seasonality will be controlled for by the matched markets 
	Posterior Intervals Tail Area: 95%


	------------- Model Stats -------------
	Matching (pre) Period MAPE: 6.86%
	Beta 1 [BOS]: -0.056
	Beta 2 [JFK]: 0.3463
	Beta 3 [LHR]: 0.2456
	Beta 4 [STR]: 0.3854
	Beta 5 [ZRH]: -0.0281
	DW: 0.65


	------------- Effect Analysis -------------
	Absolute Effect: 104.18 [-12.94, 234]
	Relative Effect: 2.55% [-0.32%, 5.73%]
	Probability of a causal impact: 95.5912%
> 
> ## Plot the impact
> results$PlotCumulativeEffect
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics
Execution halted