Help: getting "Error: unexpected symbol in:...." after a lot of commands

I'm trying to load data from the Human Mortality Database. forecast, and plot the Lee-Carter model. This involves the demography package. I keep getting an error of unexpected symbol every time I put another command in which is weird. Is there any fix?

Here is an example of what I'm talking about

Hi, welcome!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

It seems like you are concatenating the two functions lca() and forecast() incorrectly, but we can't know for sure based on a screenshot.

> hmd.mx(country="USA", username="blank",#password="blank", label="USA")
+ usa.lca <- lca("bltper_5x1.txt", series="mortality", chooseperiod = FALSE, restype = c("logrates", "rates", "deaths"), interpolate = FALSE )
+ usa.fcast <- (usa.lca, 50)
Error: unexpected symbol in:
"usa.lca <- lca("bltper_5x1.txt", series="mortality", chooseperiod = FALSE, restype = c("logrates", "rates", "deaths"), interpolate = FALSE )
usa.fcast"

Your example is not reproducible so we can just try to guess what the problem is.

This is not valid R code usa.fcast <- (usa.lca, 50) what are you trying to do with this code?

If you run just this part, do you get any error message?

usa.lca <- lca("bltper_5x1.txt", series="mortality", chooseperiod = FALSE, restype = c("logrates", "rates", "deaths"), interpolate = FALSE )

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.