Strategies for editing reactive functions in Shiny, 'data' must be of a vector type, was 'NULL' error
Tag : r , By : John Bentley
Date : March 29 2020, 07:55 AM
it fixes the issue Goal: I am trying to create a shiny app that displays (1) the stressplot of a non-metric multidimensional scaling solution, (2) a ggplot of the point configuration, and (3) the results of clustering the point configuration by plotting the point configuration and superimposing chulls of the clustering. , Your input$clust is undefined in: df_cl <- reactive({
km <- kmeans(x = pts(), centers = input$clust)
cl <- km$cluster
data.frame(pts(), clust = cl)
})
numericInput('clust', 'Clusters', 2, min = 2, max = 15)
|
ARIMA forecast keep getting error 'data' must be of a vector type, was 'NULL'
Date : March 29 2020, 07:55 AM
it should still fix some issue I keep getting an error when fitting my ARIMA to the data, 'data' must be of a vector type, was 'NULL'. library(forecast)
foo <- read.table(file="data.csv", header=T, sep=",")
data <- ts(foo$Car,start = c(1990,1),frequency = 1)
# Use 'forecast' to get predition from the model estimated by 'auto.arima'
ARIMAfit1 <- auto.arima(log10(data), approximation=T, trace=FALSE, allowdrift=F)
summary(ARIMAfit1)
forecast(ARIMAfit1, h = 3)
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
# 2017 1.415713 1.165870 1.665556 1.0336109 1.797815
# 2018 1.415713 1.128307 1.703119 0.9761635 1.855262
# 2019 1.415713 1.095115 1.736310 0.9254014 1.906024
# The same model estimated using 'arima'
# Here you can use 'predict'
ARIMAfit2 <- arima(log10(data), order=c(0,1,1))
summary(ARIMAfit2)
predict(ARIMAfit2, n.ahead=3)
# $pred
# Time Series:
# Start = 2017
# End = 2019
# Frequency = 1
# [1] 1.415713 1.415713 1.415713
# $se
# Time Series:
# Start = 2017
# End = 2019
# Frequency = 1
# [1] 0.1911677 0.2199090 0.2453055
|
Error In array :'data' must be of a vector type, was 'NULL' in R
Date : March 29 2020, 07:55 AM
This might help you First off, you should always explicitly include any additional non-base-R packages that you have been using (here forecast). This ensures that code is reproducible. As to your question, to predict forecast ARIMA models you need to use forecast instead of predict. library(forecast)
fit <- auto.arima(salesdata1)
pred <- forecast(fit, h = 12)
pred
# Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
#13 1300 1300 1300 1300 1300
#14 1400 1400 1400 1400 1400
#15 1500 1500 1500 1500 1500
#16 1600 1600 1600 1600 1600
#17 1700 1700 1700 1700 1700
#18 1800 1800 1800 1800 1800
#19 1900 1900 1900 1900 1900
#20 2000 2000 2000 2000 2000
#21 2100 2100 2100 2100 2100
#22 2200 2200 2200 2200 2200
#23 2300 2300 2300 2300 2300
#24 2400 2400 2400 2400 2400
plot(pred)
|
How can I create raster mosaic using list of rasters?
Tag : r , By : Steven Weber
Date : March 29 2020, 07:55 AM
|
R: Raster mosaic from list of rasters?
Tag : r , By : Matt Croydon
Date : March 29 2020, 07:55 AM
|