help.request <- function (subject = "",
                          ccaddress = Sys.getenv("USER"),
                          method = getOption("mailer"),
                          address = "r-help@R-project.org",
                          file = "R.help.request") {
    no <- function(answer) answer == "n"
    yes <- function(answer) answer == "y"
    go <- function(url) {
        cat("Please do this first - the site has been loaded in your web browser\n")
        browseURL(url)
    }
    cat("Checklist:\n")
    post <- readline("Have you read the posting guide? (y/n) ")
    if (no(post)) return(go("http://www.r-project.org/posting-guide.html"))
    FAQ <- readline("Have you checked the FAQ? (y/n) ")
    if (no(FAQ)) return(go("http://cran.r-project.org/faqs.html"))
    intro <- readline("Have you checked An Introduction to R? (y/n) ")
    if (no(intro))
        return(go("http://cran.r-project.org/doc/manuals/R-intro.html"))
    NEWS <- readline("Have you checked the NEWS of the latest development release? (y/n) ")
    if (no(NEWS)) return(go("https://svn.r-project.org/R/trunk/NEWS"))
    rsitesearch <- readline("Have you looked on RSiteSearch? (y/n) ")
    if (no(rsitesearch)) {
        cat("Please do this first - the site has been loaded in your web browser\n")
        return(RSiteSearch(subject))
    }
    inf <- sessionInfo()
    if ("otherPkgs" %in% names(inf)){
        other <- readline("You have packages other than the base packages loaded.",
                          "\nIf your query relates to one of these, have you ",
                          "checked any corresponding books/manuals \nand ",
                          "considered contacting the package maintainer? (y/n/NA) ")
        if(no(other)) return("Please do this first.")
    }

    man <- url("http://cran.r-project.org/manuals.html")
    ver <- scan(man, what = character(0), sep = "\n", skip = 13, nlines = 1,
                quiet = TRUE)
    ver <- strsplit(ver, " ")[[1]][3]
    if (getRversion() < numeric_version(ver)) {
        update <- readline("Your R version is out-of-date, would you like to update now? (y/n) ")
        if (yes(update)) {
            return(go(getOption("repos")))
        }
    }
    cat("Checking installed packages are up-to-date...\n")
    old <- old.packages()
    if (!is.null(old)) {
        cat("The following installed packages are out-of-date:\n",
            rownames(old), "\nwould you like to update now? (y/n)")
        if (yes(update)) {
            update.packages(ask = FALSE)
        }
    }

    ## To get long prompt!
    cat("Have you written example code that is\n",
        "- minimal\n - reproducible\n - self-contained\n - commented",
        "\nusing data that is either\n",
        "- constructed by the code\n - loaded by data()\n",
        "- reproduced using dump(\"mydata\", file = \"\")\n")
    code <- readline(paste("have you checked this code in a fresh R session",
                           "\n(invoking R with the --vanilla option if possible)",
                           "\nand is this code copied to the clipboard? (y/n) "))
    if (no(code))
        return(cat("\nIf your query is not directly related to code",
                   "(e.g. a general query \nabout R's capabilities),",
                   "email R-help@r-project.org directly. ",
                   "\nOtherwise prepare some example code first.\n"))
    change <- readline(paste("Would you like to change your subject line:\n",
                             subject, "\nto something more meaningful? (y/n) "))
    if (yes(change))
        subject <- readline("Enter subject: \n")

    create.post(instructions = paste(
                "\\n<<SEND AS PLAIN TEXT!>>\\n\\n",
                "\\n<<Write your query here, using your example code to illustrate>>",
                "\\n<<End with your name and affiliation>>\\n\\n\\n\\n"),
                description = "help request",
                subject = subject,
                ccaddress = ccaddress,
                method = method,
                address = address,
                file = file)
}