This has probably been answered, but I couldn't find the solution to my specific problem:
I am looking for a certain file type (for eg. jpeg) and printing to the user a message using the message() function. But along with the message I want to print a sequence.
The output should read:
1. Found filename at System time.
2. Found filename2 at System time.
Unfortunately, my output is:
1 Found filename at System time
2 Found filename at System time
1 Found filename2 at System time
2 Found filename2 at System time
My Code:
library(tools)
setwd("/Users/RLearner/Desktop/TEMP")
a<-list.files(getwd(), recursive=TRUE)
for (f in a)
for (i in 1:length(a))
if (file_ext(f)=="jpeg")
{
message(paste(i, "Found", f, "-", Sys.time(), sep = " "))
}
What am I doing wrong?