简体   繁体   English

使用 R 读取包含科学数字的 csv 文件

[英]Read a csv file containing scientific numbers with R

I am trying to read a csv file containing a column with scientific values.我正在尝试读取包含具有科学值的列的 csv 文件。

My csv file looks like this:我的 csv 文件如下所示:

在此处输入图片说明

My script code is the following:我的脚本代码如下:

data <- read.csv('data_physico_qpcr_analyse.csv',sep=";")
head(data)

The problem is that the column with the scientific values is formatted as character type and not as numeric.问题是具有科学值的列被格式化为字符类型而不是数字。

I have attempted to convert the column with the following syntax:我尝试使用以下语法转换列:

data <- read.csv('data_physico_qpcr_analyse.csv',sep=";",colClasses=c("character","character","numeric","character","character","character",))

I have tried to convert the column to numeric in excel as well, but the comma always stays in the format.我也尝试将列转换为 excel 中的数字,但逗号始终保留在格式中。

How do I convert the cible__par_g column to numeric type using R?如何使用 R 将 cible__par_g 列转换为数字类型?

Have you tried the following?:您是否尝试过以下操作?:

options(scipen=999)

This usually returns the non-scientific values, but I am not sure if it will help your case when loading in from excel.这通常会返回非科学值,但我不确定从 excel 加载时是否会对您的情况有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM