Possible Duplicate:
Change the index number of a dataframe
I did various operations with a dataframe and excluded a number of rows. As you see in my example the dataframe now starts with 366. I would like to redefine this row number back to 1 and of course the following index numbers.
-> head(new_pred)
pred_mean_temp pred_precipitation pred_visibility pred_wind
366 -0.4707149 156.00677 260.24943 12.006212
367 3.3950894 85.07009 28.66573 12.618096
368 0.9394914 276.67157 12.39165 8.249188
369 -2.9786171 147.03749 10.21351 7.432625
370 -3.5502385 24.66432 16.59086 13.495728
371 -4.2262573 37.21946 17.51434 9.309708
so it will look like this:
-> head(new_pred)
pred_mean_temp pred_precipitation pred_visibility pred_wind
1 -0.4707149 156.00677 260.24943 12.006212
2 3.3950894 85.07009 28.66573 12.618096
etc.
best thanks!
rownames(new_pred) <- seq(nrow(new_pred))
is simpler, andrownames(x) <- NULL
is simpler still.