I have a dataset with empty rows. I would like to remove them:
It works OK. But now I would like to add a column in my data and initialize the first value:
myData$newCol <- -999
Error in `$<-.data.frame`(`*tmp*`, "newCol", value = -999) :
replacement has 1 rows, data has 0
Unfortunately, it doesn't work and I don't really understand why and I can't solve this. It worked when I removed one line at a time using:
TgData = TgData[2:nrow(TgData),]
Or anything similar.
It also works when I used only the first 13.000 rows.
But it doesn't work with my actual data, with 32.000 rows.
What did I do wrong? It seems to make no sense to me.