-1

When I clean my data, which is called total, I need to delete rows where Column V9's string length is less than 10. Is there any function to do this?

I already tried the subset function, but I get the error mentioned below:

subset(total$V9, str_length < 10)

Error in str_length < 10 : comparison (3) is possible only for atomic and list types.

Artem
  • 3,304
  • 3
  • 18
  • 41
user1120
  • 109
  • 1
  • 1
  • 7

2 Answers2

1

If you use:

total[which(nchar(total$V9))>=10,]

it will return only line where the string length is >= 10

Chelmy88
  • 1,106
  • 1
  • 6
  • 17
0

yes you can remove Multiple Rows by selecting a subset
you can also use subset function with multiple conditions

  # remove rows in r - subset function with multiple conditions
 subset(total$V9, your condition) //you can check your conditions here

you can select your subset as per your requirement

Update from Jogo Comment

subset(total, str_length(V9)>=10) or total[str_length(total$V9)>=10, ]
ArunPratap
  • 4,816
  • 7
  • 25
  • 43