Couldnt receive the required output

53 views Asked by At

I was working with the assignment to read the fixed width file format in the R Programming,this is my dataset

http://www.cpc.ncep.noaa.gov/data/indices/wksst8110.for

and I used the readr package to read the file and clean the data with the below shown code

library(readr)
x<-read_fwf(file=url("http://www.cpc.ncep.noaa.gov/data/indices/wksst8110.for"),skip=4,fwf_widths=c(12,7,4,9,4,9,4,9,4))
head(x)
y<-x[4]
sum(y)

now I got the required 9 columns, now my assignment is to find the sum of the 4th column,my answer is 36540 but the required answer is 32467,any answer would be appreciated, Thanx in advance.

1

There are 1 answers

0
emilliman5 On

You need to download the file as gas.xlsx not gas.xls

download.file("https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2FDATA.gov_NGAP.xlsx", "gas.xlsx" ,mode="wb")