Hello, For example:
url <- c("http://www.example.com", "http://www.example5.com") res <- vector("list", length(url)) for (i in 1:length(url)) res[[i]] <- try(readLines(url[i]), silent = TRUE) res[[2]] ## [1] "Error in file(con, \"r\") : cannot open the connection\n" ## attr(,"class") ## [1] "try-error" ## attr(,"condition") ## <simpleError in file(con, "r"): cannot open the connection> # or for (i in 1:length(url)) res[[i]] <- tryCatch(readLines(url[i]), error = function (e) conditionMessage(e)) res[[2]] ## [1] "cannot open the connection" -- Noia Raindrops noia.raindr...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.