read.csv row.names

前端 未结 4 1689
你的背包
你的背包 2020-12-17 15:34

I\'m trying to read a column oriented csv file into R as a data frame.

the first line of the file is like so:

sDATE, sTIME,iGPS_ALT, ...

4条回答
  •  长情又很酷
    2020-12-17 15:45

    You probably DO have an extra column.
    But it probably arises from a stray formatted cell (or column of cells) that is actually empty, to the right of your data in your original spreadsheet.
    Here is the key: Excel will save empty fields in the CSV file for any empty cells that are formatted in your sheet. Here is why you probably have this problem: Because when you open the CSV file with Excel and re-save it the problem with R goes away.
    What is happening: when you pull a CSV file back into Excel, it will subsequently ignore empty cells to the right or below your data (since CSV files have no formatting).

    Conclusion: be careful saving formatted spreadsheets as CSV files for use with statistical packages. Stray formatting means stray fields in the CSV.

提交回复
热议问题