Questions tagged [nchar]
17 questions
0
votes
1 answer
R - delete rows with more than x chars using which
I have a dataframe with 7 variables. Some variables have more characters then they are supposed to have. To find the lines containing too many characters for one value I use this:
df <- df[-c(which(nchar(as.character(df$u)) > 5)), ]
So every line…

BallerNacken
- 305
- 7
- 16
-3
votes
1 answer
Hi I would like to understand the way R read this line of code
Object data is a dataframe that contain multiple columns and v is the column that contains icd10 code.
The aim is to store a logical value that will return TRUE if satisfy those conditions.
indication <- nchar(gsub("[^[:alpha:]]", "", data[[v]])) >…

Lukman Afandi
- 3
- 2