I am an intermediate user of R and have a data set of ~850,000 rows that was edited through Stata, saved as a csv, but about .01% of the rows got split to the following row after column 4. Column 5 should all have a typeof()
equal to "integer" and column 4 should be "character". I am trying to get the file back to its original form, with no split rows. I am using the column 4 "type of" as the required condition, which in the erroneous rows is equal to "integer". When trying this:
wages <- for (i in wages) {
if(typeof(wages[i,4]) == "integer") {
cat(i-1, i)
}
}
all I get is NAs.
When trying:
for (i in wages) {
if(typeof(i[ ,4]) == "integer") {
append(i-1, i, after = length(i-1))
}
}
it says: Error in [.default
(i, , 4) : incorrect number of dimensions
I have spent hours searching for solutions and trying different methods with no success. Thanks in advance for any help.
Aucun commentaire:
Enregistrer un commentaire