Invalid 'destfile' argument


#1

While downloading a file in R, getting this error.
download.file(url="https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile=file1, mode="wb")
Error in download.file(url = “https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2”, :
invalid ‘destfile’ argument


#2

Replace the code

download.file(url="https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile=file1, mode="wb")

with

download.file(url="https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile="stormdata.bz2", mode="wb")

This will create a new file in your working directory “stormdata.bz2” and save the downloaded file in that name.