Programmers learn & share
0 votes
40 views

Problem :

Getting following error related to r
error in `row.names<-.data.frame`(`*tmp*`, value = value) : duplicate 'row.names' are not allowed
by (6.9k points)   | 40 views

1 Answer

0 votes

Solution :

You can probably use make.names(..., unique = TRUE) to get your unique row names

rownames(diasyhoras2) <- make.names(diasyhoras[,1], unique = TRUE)

Following is the quick example of what will happen to the names ...

rep(month.abb[1:2], 3)
# [1] "Jan" "Feb" "Jan" "Feb" "Jan" "Feb"
make.names(rep(month.abb[1:2], 3), unique = TRUE)
# [1] "Jan"   "Feb"   "Jan.1" "Feb.1" "Jan.2" "Feb.2"
If you follow above approch your issue will be resolved.
by (36.1k points)  
2,218 questions
2,683 answers
59 comments
241 users