0

Thank you for assisting me. I am new to r. I have asserted that all my column types are correct.

There is a column that is a character type, but when I exercised count() on it, I saw that there is a number value in the character column. This is of course an error.

How do I find out the observation that has the number so that I can choose to modify or delete the cell? I used this code to determine what the column contained:

ned1 %>% count(source_id)

But the column that tells me the row number is titled X, and I do not know how to also call on the column X so I know the row number that contains the error.

I hope I explained this well enough, and I appreciate your time. I apologize if my newness has prevented me from giving you more information.

  • Hi! This is a _coding_ site, you can post code here, in fact it's highly encouraged. You might want to read our tutorial on [how to create a minimal example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). – jay.sf Jun 30 '22 at 17:43
  • Thanks. I'll have to try that. – daydreamer94 Jun 30 '22 at 17:45

1 Answers1

1

You can filter the rows of ned1 using dplyr::filter() and as.numeric()

library(dplyr)

ned1 %>% filter(!is.na(as.numeric(source_id)))
langtang
  • 22,248
  • 1
  • 12
  • 27
  • Thank you for your response. I appreciate it. It wasn't that I was necessarily looking for numbers, but any wrong data type in a column. One column only had thirteen variables, and I could see one was a numeric in a character column. I will have to follow jay.sf's suggestion to create an example. – daydreamer94 Jun 30 '22 at 22:22