Can someone help to run this montecarlo simulation?

My random data is generated by the following code.

n_escenarios <- 10000 # Número de escenarios a simular
salario_4 <- rnorm(n_escenarios, mean=60000, sd=20000)
salario_mensual_4 <- (salario_4)/12
años_cotizados_4 <- round(rnorm(n_escenarios, mean = 37, sd = 5)) # Años cotizados aleatorios
seq_salario_mensual_4 <- rep(salario_mensual_4,años_cotizados_4*12)
for (i in 1:length(seq_salario_mensual_4)) {
** seq_salario_mensual_4[i] <- seq_salario_mensual_4[i](inflacion[i]/inflacion[1])**
**días_cotizados_4 <- floor(años_cotizados_4
edad_jubilacion_4 <- rnorm(n_escenarios, mean=65, sd=3) # Edades de jubilación aleatorias
años_vividos_4 <- años_cotizados_4
persona4 <- list("salario_mensual" = seq_salario_mensual_4, "años_cotizados" = años_cotizados_4, "edad_jubilacion" = edad_jubilacion_4, "años_vividos" = años_cotizados_4)

Then when I try to run it trough the function it appears this error.
Error in rep(0, años_cotizados * 12) : argumento 'times' inválido

Can someone give a clue to solve this issue?


This needs to be fixed before proceeding.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.