I\'ve got a data frame with multiple rows for each participant. There is an error in some of their ids (for example, some are double). I wanted to assign them a new one like
The error duplicate subscripts for columns
tells you here that you are trying to assign a value to a nonsensical part of dataframe. So you need to use dat$participant
rather than only dat
.
Generally speaking, you can use this command:
dat$participant[some condition] <- "101"
E.g. modifying your first command:
dat$participant[dat$participant == "36" & dat$date == "2020-06-07_12h33.46.880"] <- "101"
But there can be another problem, e.g. make sure you provide correct date (copy and paste the value, as there are many types of hyphens and dashes) which can occur in dirty data, maybe the IDs are not characters but numbers, etc.
So if you want more concrete help, provide here a few lines of your data frame.