且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何用逗号作为小数点分隔符读取数字?

更新时间:2021-10-07 22:19:25

当您查看 ?read.table 时,您可能会找到您需要的所有答案.

When you check ?read.table you will probably find all the answer that you need.

(大陆)欧洲 csv 文件有两个问题:

There are two issues with (continental) European csv files:

  1. csv 中的 c 代表什么?对于标准 csv,这是一个 ,,对于欧洲 csv,这是一个 ;
    sepread.table
  2. 中对应的参数
  3. 小数点的字符是什么?对于标准 csv,这是一个 .,对于欧洲 csv,这是一个 ,
    decread.table
  4. 中对应的参数
  1. What does the c in csv stand for? For standard csv this is a ,, for European csv this is a ;
    sep is the corresponding argument in read.table
  2. What is the character for the decimal point? For standard csv this is a ., for European csv this is a ,
    dec is the corresponding argument in read.table

读取标准csv使用read.csv,读取欧洲csv使用read.csv2.这两个函数只是 read.table 的包装器,用于设置适当的参数.

To read standard csv use read.csv, to read European csv use read.csv2. These two functions are just wrappers to read.table that set the appropriate arguments.

如果您的文件不符合这些标准中的任何一个,请手动设置参数.

If your file does not follow either of these standards set the arguments manually.