is.numeric0 <- function(x){length(x)==0 & is.numeric(x)} ## Get an index of all tips in one or more sections getWikiTipsIndex <- function(sections = NULL) { # First of all, we need to get the list of all subsections in tips stips <- readLines("http://wiki.r-project.org/rwiki/doku.php?id=&idx=tips") # Keep only lines related to tips sections stips <- stips[grep("idx=tips:", stips)] # Retrieve the sections from these lines stips <- sub("^.*(idx=tips:[^\"]*).*$", "\\1", stips) # If section is NULL, just use the whole list # Otherwise, rework sections "[section]" -> idx=tips:[section]" # and look if these sections are there if (!is.null(sections)) { Sections <- paste("idx=tips:", sections, sep = "") inwiki <- Sections %in% stips if (!all(inwiki)) stop("One or more sections are not in the R Wiki:\n\t", paste(sections[!inwiki], collapse = ", ")) stips <- Sections # Keep only these sections... and in that order! } # Cycle through all the tips subsections and retrieve the list of pages ltips <- character(0) for(st in stips) { Ltips <- readLines(paste("http://wiki.r-project.org/rwiki/doku.php?id=", st, sep = "&")) # Keep only lines related to tips pages in that section Ltips <- Ltips[grep("
This is a snapshot of a part of the", file = file, append = TRUE)
cat(" R Wiki", file = file, append = TRUE)
cat(" taken on ", date(), ".\n
\n", sep = "", file = file, append = TRUE)
cat("Please, visit the R Wiki to edit original document, or to check for latest version.