删除R中的列中的错误数据类型

发布于 2025-02-11 22:15:43 字数 290 浏览 0 评论 0原文

谢谢您协助我。我是R的新手。我断言我所有的列类型都是正确的。

有一个列是一个字符类型,但是当我在其上行使count()时,我看到字符列中有一个数字值。这当然是一个错误。

我如何找出具有数字的观察结果,以便可以选择修改或删除单元格?我使用此代码来确定列包含的内容:

ned1%>%count(source_id),

但是告诉我行号的列标题为x,我不知道如何在x列上打电话,所以我知道包含错误的行号。

我希望我能很好地解释这一点,并感谢您的时间。如果我的新颖性阻止我给您更多信息,我深表歉意。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆伤 2025-02-18 22:15:44

您可以使用ned1使用dplyr :: filtr()as.numeric()过滤ned1的行。

library(dplyr)

ned1 %>% filter(!is.na(as.numeric(source_id)))

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

library(dplyr)

ned1 %>% filter(!is.na(as.numeric(source_id)))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文