Apologies in advance if this has already been asked elsewhere, but I've tried different attempts and nothing has worked so far.
In my data frame Mesure I would like to split the values of the column Row.names into two new columns named Sample_type and Locality. I try to use a tidyverse solution but R returns me that the column must not be dupicated... How can I modify it ? Also, is it possible to remove the "<" ?
> head(Mesure) Row.names mean_Mesure max_Mesure min_Mesure 1 Aquatic_moss.Paris.AG-110m.< 100 110 90 2 Aquatic_moss.Paris.BE-7. 123 177 53 3 Aquatic_moss.Paris.CO-57.< 40 60 20 4 Aquatic_moss.Paris.CO-58.< 40 50 30 5 Aquatic_moss.Paris.CO-60.< 50 70 30 6 Aquatic_moss.Paris.CS-134.< 200 300 100 > > library(tidyverse) > new_df <- Mesure %>% + rownames_to_column(var = "Row.names") %>% + separate(Row.names,sep = ".",into = c("Sample_type","Locality")) Error: Column name `Row.names` must not be duplicated. Run `rlang::last_error()` to see where the error occurred.
Mesure, wouldn'tas_tibble(..., rownames="Row.names")give you what you want?Mesureis the merging of several lists that come from the splitting of several different data frames. During splitting of these initial data frames, I renamed the dataframes