Hi everyone,
I am writing on the community because I got the error in the title (Error in pnM) and I cannot find a single post about it online. I am trying to build a synthetic population from an dataObject inp that I am reporting in the following:
Formal class 'dataObj' [package "simPop"] with 7 slots
..@ data :Classes ‘data.table’ and 'data.frame': 2706 obs. of 12 variables:
.. ..$ ï..InterviewNumber: int [1:2706] 6 32 35 45 51 76 78 80 87 125 ...
.. ..$ Districts : Factor w/ 8 levels "1","2","3","4",..: 6 2 3 5 3 4 5 3 8 3 ...
.. ..$ HouseholdSize : int [1:2706] 4 1 3 4 2 3 2 2 2 2 ...
.. ..$ Age : int [1:2706] 41 61 46 48 32 62 69 30 77 50 ...
.. ..$ Gender : Factor w/ 2 levels "Female","Male": 2 1 2 2 2 1 1 1 2 2 ...
.. ..$ Citizenship : int [1:2706] 1 2 1 1 2 1 1 1 1 2 ...
.. ..$ Social.status : int [1:2706] 5 3 2 2 2 2 3 2 3 3 ...
.. ..$ Personal.income : int [1:2706] 1 2 1 1 4 1 4 1 4 2 ...
.. ..$ Children0under0six: int [1:2706] 0 0 0 1 0 0 0 0 0 0 ...
.. ..$ Neighborhood : Factor w/ 81 levels "Astangu","Haabersti",..: 39 37 47 29 46 52 66 10 77 20 ...
.. ..$ Weight : num [1:2706] 126 163 147 130 147 ...
.. ..$ pid : chr [1:2706] "6.1" "32.1" "35.1" "45.1" ...
.. ..- attr(*, ".internal.selfref")=<externalptr>
.. ..- attr(*, "sorted")= chr "ï..InterviewNumber"
..@ hhid : chr "ï..InterviewNumber"
..@ pid : chr "pid"
..@ hhsize : chr "HouseholdSize"
..@ weight : chr "Weight"
..@ strata : chr "Districts"
..@ ispopulation: logi FALSE
I am prompting the following:
synthP<-simStructure(data = inp, method = c("direct"), basicHHvars = c("Age", "Gender", "Districts"))
The above should be part of the simPop package and takes as input the inp dataObj obtained through specifyInput.
As mentioned I get only the message "Error in pnM[, numbers[[i]]] : indice fuori limite" which is not even coded within the simStructure function (https://rdrr.io/cran/simPop/src/R/simStructure.R). Also curious is that indice fuori limite is Italian for index out of range, I have R studio in English and all the other error messages where in English.
I am quite new in RStudio and I am still learning, still without a single online thread about this error I cannot progress on my own. Any help would be greatly appreciated.
Please do not refrain from asking question if needed, I thank you for your time.
Best,
Angelo