Excel中的数字列被转换为逻辑 [英] Numerical column in Excel gets converted as logical

查看:49
本文介绍了Excel中的数字列被转换为逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从Excel将数据导入R Studio时,数字列将作为R中的Logical导入.

When I try to import data into R studio from Excel, the number columns are getting imported as Logical in R.

是否可以将这些列作为数字导入R中?Excel中的列已设置为数字格式.

Is there a way to import these columns as a number into R? The column in Excel has been formatted to number.

我正在使用 read_excel 导入文件.

我要导入的电子表格有80列.

The spreadsheet I am trying to import has 80 columns.

推荐答案

使用 col_types 并明确指定列类型.

use col_types and explicitly specify the column types.

read_excel(path, sheet = 1, col_names = TRUE, col_types = c("text","numeric","date"), na = "", skip = 0)

https://www.rdocumentation.org/packages/readxl/versions/0.1.1/topics/read_excel

这篇关于Excel中的数字列被转换为逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆