I am on mac OS X 10.9.4 Maverics. I am using R console to download some files (using Rstudio has no effect on my problem), version R 3.1.1, GUI 1.65 Snow Leopard build (6784). I have downloaded some data using the following code:
dataset_url <- "http://s3.amazonaws.com/practice_assignment/diet_data.zip"
download.file(dataset_url, "diet_data.zip")
unzip("diet_data.zip", exdir = "diet_data")
Then, if I check my directory:
getwd()
# [1] "/Users/katarinamayer/Desktop/diet_data"
list.files("diet_data")
# character(0)
But if I just type:
list.files()
# [1] "Andy.csv" "David.csv" "John.csv" "Mike.csv" "Steve.csv" "weightmedian.R"
Why I cannot get the list of my files when I specify my directory, using list.files("diet_data")
?
You are already inside the diet_data
directory, as indicated by the output of getwd()
. By default, list.files()
will list the files on the path returned by getwd()
.
If you setwd("/Users/katarinamayer/Desktop/")
, then execute list.files("diet_data")
, I believe you will observe the behaviour that you expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With