While trying out ifelse in R programming, when the words I tried to print, as result for each elements of vectors, have different length there is an un wanted extra white space. How should I resolve it? "trimws()" is not working[![tried out this, Here "fail & Average"] are words of different length hence fail is having extra space1]1
Asked
Active
Viewed 29 times
0
-
1Use `cat()`? E.g. `v <- c(20, 30, 60, 35, 70); cat(ifelse(v>50, "Average", "fail"))` – jared_mamrot Aug 23 '21 at 06:11
-
1No problem - please in future add more details to your question to help us help you (see e.g. [How to make a great R reproducible example](https://stackoverflow.com/q/5963269/12957340)) – jared_mamrot Aug 23 '21 at 06:17
-
@jared_mamrot You should post that comment as an answer to the dupe. – Rui Barradas Aug 23 '21 at 06:20
-
Good idea @RuiBarradas - I will - thanks :) – jared_mamrot Aug 23 '21 at 06:22