Excel Files corrupted in R.
0
0
Entering edit mode
7.5 years ago
Kachibunny • 0

Hello, I am working on a project that requires me to load multiple excel sheets as an xlsx file or individually as a csv file into R. On my laptop these files open up with out any hassle and I have ran multiple virus scans to make sure my laptop is not infected. When ever I load any of my excel files onto R and carry out the head( ) command all of my excel files open up as corrupted files or just plain not right.

Here is a snip of my work and out put returned

  setwd("C:\\Users\\12345\\Documents\\Dr XXXX Research")
    list.files()
    mhc2<- read.table(list.files()[36], sep="\t", skip=2, header= TRUE, nrows=1))
     head(mhc2)

Output

    V1
1 †BîÕÌàñ8Ñ»©

I would really appreciate help with this. Thank you.

R Excel • 3.2k views
ADD COMMENT
3
Entering edit mode

For loading xlsx files, I would recommend xlsx package

ADD REPLY
2
Entering edit mode

... and I would suggest the readxl package

ADD REPLY
1
Entering edit mode

That's about it!

An xlsx file is a compressed archive of your data, while read.table() assumes that your input data is uncompressed, flat text. The garbled text you're seeing is compressed binary. The xlsx package can read that.

ADD REPLY
0
Entering edit mode

Thank you, I would check that out. I was just wondering why even my csv files where acting out. I was wondering if it way be a Macro virus but all my scans come out clean.

ADD REPLY

Login before adding your answer.

Traffic: 1882 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6