Allow duplicates in row.names

Is there a way to allow duplicates in your data? I am creating multivariate graphs and need to change the names for one of the graphs to values that range 1-4. My code and error message is below:

aravo <- import_list("C:/Users/Desktop/R/RLQData10.xlsx")
row.names(aravo$env)<- aravo$env.names$name

Error in .rowNamesDF<-(x, value = value) :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘1’, ‘2’, ‘3’, ‘4’

Hi,

Welcome to the RStudio community!

It is not possible to have duplicate row names, but a simple workaround is creating an extra column (e.g. label) that holds the name that you would assign to your rows. You can then use this column for the names in the graph instead.

Hope this helps,
PJ

The excel file I am pulling from is using a separate sheet that only contains these names and no data in order to do just this, however, the code I provided above is not functioning as intended.

Hi,

Maybe it's best to create a reprex. A reprex consists of the minimal code and data needed to recreate the issue/question you're having. You can find instructions how to build and share one here:

PJ

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.