From noreply at r-forge.r-project.org Thu Dec 11 10:39:52 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 11 Dec 2014 10:39:52 +0100 (CET) Subject: [Dplr-commits] r920 - pkg/dplR Message-ID: <20141211093952.D1A45183C4E@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-11 10:39:52 +0100 (Thu, 11 Dec 2014) New Revision: 920 Modified: pkg/dplR/DESCRIPTION Log: The roles of M. Mudelsee and M. Schulz are now "ctb", as recommended by the CRAN repository policy. Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-11-21 08:59:07 UTC (rev 919) +++ pkg/dplR/DESCRIPTION 2014-12-11 09:39:52 UTC (rev 920) @@ -3,18 +3,18 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-11-21 +Date: 2014-12-11 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", role = c("aut", "cph")), person("Filipe", "Campelo", role = c("aut", "cph")), person("Pierre", "M?rian", role = c("aut", - "cph")), person("Manfred", "Mudelsee", role = "aut"), + "cph")), person("Manfred", "Mudelsee", role = "ctb"), person("Fares", "Qeadan", role = c("aut", "cph")), - person("Michael", "Schulz", role = "aut"), person("Christian", + person("Michael", "Schulz", role = "ctb"), person("Christian", "Zang", role = c("aut", "cph")), person("Jacob", "Cecile", role = "ctb")) -Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Manfred Mudelsee [aut], Fares Qeadan [aut, cph], Michael Schulz [aut], Christian Zang [aut, cph], Jacob Cecile [ctb] +Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Manfred Mudelsee [ctb], Fares Qeadan [aut, cph], Michael Schulz [ctb], Christian Zang [aut, cph], Jacob Cecile [ctb] Copyright: Authors and Aalto University (for work of M. Korpela) Maintainer: Andy Bunn Depends: R (>= 2.15.0) From noreply at r-forge.r-project.org Fri Dec 12 19:55:17 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 12 Dec 2014 19:55:17 +0100 (CET) Subject: [Dplr-commits] r921 - in pkg/dplR: . R inst/unitTests man Message-ID: <20141212185517.1E57418788C@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-12 19:55:16 +0100 (Fri, 12 Dec 2014) New Revision: 921 Modified: pkg/dplR/DESCRIPTION pkg/dplR/NAMESPACE pkg/dplR/R/latexify.R pkg/dplR/inst/unitTests/runit.utils.R pkg/dplR/man/latexify.Rd Log: latexify() supports a more comprehensive set of characters Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-11 09:39:52 UTC (rev 920) +++ pkg/dplR/DESCRIPTION 2014-12-12 18:55:16 UTC (rev 921) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-12-11 +Date: 2014-12-12 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", Modified: pkg/dplR/NAMESPACE =================================================================== --- pkg/dplR/NAMESPACE 2014-12-11 09:39:52 UTC (rev 920) +++ pkg/dplR/NAMESPACE 2014-12-12 18:55:16 UTC (rev 921) @@ -22,7 +22,7 @@ importFrom(png, readPNG) -importFrom(stringi, stri_trans_nfc) +importFrom(stringi, stri_trans_nfc, stri_trans_nfd) importFrom(stringr, str_pad, str_trim) Modified: pkg/dplR/R/latexify.R =================================================================== --- pkg/dplR/R/latexify.R 2014-12-11 09:39:52 UTC (rev 920) +++ pkg/dplR/R/latexify.R 2014-12-12 18:55:16 UTC (rev 921) @@ -13,15 +13,9 @@ ## Usage: \Sexpr{latexify(string_produced_by_R_code)} ## -## Make arbitrary character() vector compatible with LaTeX by escaping -## special characters, then convert to UTF-8 encoding. Any formatting -## (newlines, tabs, etc.) will be lost. Note that the set of -## characters actually supported depends on the font, LaTeX engine and -## set of packages used. -## ## It seems that Sweave needs doublebackslash = TRUE ## but knitr needs doublebackslash = FALSE. -latexify <- function(x, doublebackslash = TRUE, +latexify <- function(x, doublebackslash = TRUE, dashdash = TRUE, quotes = c("straight", "curved"), packages = c("fontenc", "textcomp")) { y <- as.character(x) @@ -39,8 +33,11 @@ cat(y[encBytes], sep = "\n") y[encBytes] <- foo } + l10n <- l10n_info() + Letters <- paste0(c(LETTERS, letters), collapse="") fontenc <- "fontenc" %in% packages textcomp <- "textcomp" %in% packages + eurosym <- "eurosym" %in% packages straightQuotes <- match.arg(quotes) == "straight" ## Remove control characters (not spaces!) y <- gsub("(?![[:space:]])[[:cntrl:]]", "", y, perl=TRUE) @@ -48,10 +45,14 @@ ## substitution must be done before control characters because ## newline belongs to both groups. y <- gsub("[[:space:]]+", " ", y) - ## Escape LaTeX special characters. + + ## Handle LaTeX special characters in the ASCII range. ## Some substitutions are mandatory, others affect matters such as - ## the rendering of the character in question (\textquote...) or - ## line breaks (\slash). + ## the rendering of the character in question (e.g. \textquote...) + ## or line breaks (\slash). Some substitutions are unnecessary if + ## using a font encoding other than OT1 (\textbar, ...), but are + ## performed every time nonetheless. The dash (-) is given + ## special treatment to disable the em and en dash ligatures. ## Source: Scott Pakin (2009) The Comprehensive LaTeX Symbol List. ## Accessible through "texdoc symbols". ## Particularly section 8.6 "ASCII and Latin 1 quick reference". @@ -61,46 +62,290 @@ ## Then, \ is replaced with \textbackslash{}, ## but not if followed by { or }. ## After that, the order does not matter. + ## + ## This starts the 'substitutions' list, which is finally + ## processed close to the end of the function. substitutions <- list(c("([{}])", "\\\\\\1"), - c("\\\\(?!\\{|\\})", "\\\\textbackslash{}"), + c("\\\\(?![{}])", "\\\\textbackslash{}"), c("\\^", "\\\\textasciicircum{}"), c("~", "\\\\textasciitilde{}"), + c("<", "\\\\textless{}"), + c(">", "\\\\textgreater{}"), + c("\\|", "\\\\textbar{}"), c("([#$%&_])", "\\\\\\1"), + if (isTRUE(dashdash)) { + c("-", "\\\\mbox{-}") + }, if (textcomp && straightQuotes) { c("'", "\\\\textquotesingle{}") }, + if (textcomp && straightQuotes) { + c("`", "\\\\textasciigrave{}") + }, c('"', if (fontenc && straightQuotes) { "\\\\textquotedbl{}" } else { "\\\\textquotedblright{}" }), c("/", "\\\\slash{}")) - if (isTRUE(l10n_info()[["MBCS"]])) { - ## The output of sQuote() and dQuote() may contain - ## non-ASCII quoting characters. If the input is ASCII, - ## it may be a surprise to the user that an UTF-8 input - ## encoding is then needed in LaTeX. Converting the - ## quotes to commands solves this problem. - substitutions <- - c(substitutions, - list(c("\u2018", "\\\\textquoteleft{}"), - c("\u2019", "\\\\textquoteright{}"), - c("\u201c", "\\\\textquotedblleft{}"), - c("\u201d", "\\\\textquotedblright{}"))) - } - ## Remove empty group after command when followed by a backslash - Letters <- paste(c(LETTERS, letters), collapse="") - substitutions <- c(substitutions, - list(c(sprintf("(\\\\[%s]+)\\{\\}(?=\\\\)", - Letters), "\\1"))) + substitutions <- substitutions[!vapply(substitutions, is.null, logical(1))] - for (subst in substitutions[!vapply(substitutions, is.null, logical(1))]) { + ## Treatment of non-ASCII characters follows. + + ## Digraphs and ligatures broken into their parts, except the + ## Dutch digraphs IJ and ij which have their own commands. + substitutions <- + c(substitutions, + list(c("\u0132", "\\\\IJ{}"), + c("\u0133", "\\\\ij{}"), + c("\u01f1", "DZ"), + c("\u01f2", "Dz"), + c("\u01f3", "dz"), + c("\u01c4", "DZ\u030c"), + c("\u01c5", "Dz\u030c"), + c("\u01c6", "dz\u030c"), + c("\u01c7", "LJ"), + c("\u01c8", "Lj"), + c("\u01c9", "lj"), + c("\u01ca", "NJ"), + c("\u01cb", "Nj"), + c("\u01cc", "nj"), + c("\ufb00", "ff"), + c("\ufb01", "fi"), + c("\ufb02", "fl"), + c("\ufb03", "ffi"), + c("\ufb04", "ffl"), + c("\ufb05", "\u017ft"), + c("\ufb06", "st"))) + + ## Accents (diacritics) above the letter (drop i and j dots) + above <- list(diaeresis = c("\u0308", "\""), + acute = c("\u0301", "'"), + dotabove = c("\u0307", "."), + macron = c("\u0304", "="), + circumflex = c("\u0302", "^"), + grave = c("\u0300", "`"), + tilde = c("\u0303", "~"), + doubleacute = c("\u030b", "H"), + ringabove = c("\u030a", "r"), + breve = c("\u0306", "u"), + caron = c("\u030c", "v"), + invbreve = c("\u0311", "newtie")) # textcomp + ## Accents that co-exist with i and j dots (mainly below the + ## letter, but also the ligature tie) + below <- list(macronbelow = c("\u0331", "b"), + cedilla = c("\u0327", "c"), + dotbelow = c("\u0323", "d"), + tie = c("\u0361", "t"), + ogonek = c("\u0328", "k")) # not in OT1 fontenc + accents <- c(above, below) + command <- paste0("\\\\[", Letters, "]+|\\\\.") + combining <- paste0(vapply(accents, "[", character(1), 1), + collapse="") + accPre <- paste0("(", command, "|.)({})?(?, |), but are converted to commands anyway. + ## The dash is included to prevent -- and --- turning into an n + ## dash and an m dash, respectively. ## ## NOTE that the handling (what kind of treatment if any) of some - ## characters (currently single quote) depends on the (default) + ## characters (currently quotes) depends on the (default) ## arguments of latexify(). specialChars <- - c("{", "}", "\\", "#", "$", "%", "^", "&", "_", "~", "\"", "/", "'") + c("{", "}", "\\", "#", "$", "%", "^", "&", "_", "~", "\"", "/", "'", + "<", ">", "|", "`", "-") specialStr <- paste(specialChars, collapse="") ## latexify() is designed to convert any sequence of space ## characters to a single regular space @@ -96,12 +107,14 @@ checkTrue(!any(grepl("\\\\", ltxSingle, fixed=TRUE)), msg="No line breaks (double backslash)") Letters <- paste(c(LETTERS, letters), collapse="") - textCommand <- sprintf("\\\\[%s]+", Letters) - commandAndGroup <- paste(textCommand, "(\\{\\}|(?=\\\\))", sep="") - commandsAt <- gregexpr(commandAndGroup, ltxSingle, perl=TRUE) + textCommand <- sprintf("\\\\[%s]+(\\{([^}]|\\\\})+})?", Letters) + commandTerminated <- + paste(textCommand, + "((?<=})|\\{\\}| +|(?=$|[[:digit:],.?!;:\\\\}+*/-]))", sep="") + commandsAt <- gregexpr(commandTerminated, ltxSingle, perl=TRUE) checkEquals(lapply(gregexpr(textCommand, ltxSingle), as.vector), lapply(commandsAt, as.vector), - msg="Command name is followed by empty group or backslash") + msg="Command name is terminated properly") escape <- sprintf("\\\\[^%s](\\{\\})?", Letters) escapesAt <- gregexpr(escape, ltxSingle) @@ -153,8 +166,8 @@ ## a space between words strStart <- which(diff(c(0, charIdx)) > 0) strStop <- c(strStart[-1] - 1, nChars) - ## Strip off empty group following a command - ltxChars <- sub(sprintf("([%s])\\{\\}$", Letters), "\\1", + ## Strip off empty group or spaces following a command + ltxChars <- sub(sprintf("([%s])(\\{\\}| +)$", Letters), "\\1", substring(ltxSingle[i], strStart, strStop)) } else { ltxChars <- character(0) @@ -194,16 +207,16 @@ tolerance=0) checkTrue(all(specialChars %in% specialMap[, 1]), msg="Each special character has a mapping") - ## A test for encoding conversion + ## A test for handling of different encodings in the input latin1String <- "clich\xe9 ma\xf1ana" Encoding(latin1String) <- "latin1" - utf8fy <- latexify(latin1String) - checkEquals("UTF-8", Encoding(utf8fy), - msg="Declared encoding is UTF-8") - checkEquals(as.raw(c(0x63, 0x6c, 0x69, 0x63, 0x68, 0xc3, 0xa9, 0x20, - 0x6d, 0x61, 0xc3, 0xb1, 0x61, 0x6e, 0x61)), - charToRaw(utf8fy), - msg="Conversion to UTF-8 NFC succeeded") + latinConverted <- latexify(latin1String, doublebackslash=FALSE) + checkEquals("clich\\'{e} ma\\~{n}ana", + latinConverted, + msg="Conversion of latin1 string succeeded") + checkEquals(latinConverted, + latexify(enc2utf8(latin1String), doublebackslash=FALSE), + msg="Encoding of the input does not matter") ## A test for other than default quoting options quoteString <- "\"It's five o'clock\", he said." res1 <- latexify(quoteString, doublebackslash=FALSE) @@ -211,48 +224,123 @@ res3 <- latexify(quoteString, packages=character(0), doublebackslash=FALSE) res4 <- latexify(quoteString, packages="fontenc", doublebackslash=FALSE) res5 <- latexify(quoteString, packages="textcomp", doublebackslash=FALSE) - exp2 <- gsub("\"", "\\\\textquotedblright{}", quoteString) - exp4 <- gsub("\"", "\\\\textquotedbl{}", quoteString) - exp5 <- gsub("'", "\\\\textquotesingle{}", exp2) - exp1 <- gsub("'", "\\\\textquotesingle{}", exp4) + exp2 <- sub("\"", "\\\\textquotedblright ", quoteString) + exp2 <- sub("\"", "\\\\textquotedblright", exp2) + exp4 <- sub("\"", "\\\\textquotedbl ", quoteString) + exp4 <- sub("\"", "\\\\textquotedbl", exp4) + exp5 <- gsub("'", "\\\\textquotesingle ", exp2) + exp1 <- gsub("'", "\\\\textquotesingle ", exp4) checkEquals(exp1, res1, msg="Default straight quotes") checkEquals(exp2, res2, msg="Curved quotes") checkEquals(res2, res3, msg="Fallback to curved quotes") checkEquals(exp4, res4, msg="Fallback to curved single quotes") - retVal <- checkEquals(exp5, res5, msg="Fallback to curved double quotes") + checkEquals(exp5, res5, msg="Fallback to curved double quotes") ## Check that non-ASCII quotes used by dQuote() and sQuote() are ## converted to LaTeX commands - if (isTRUE(l10n_info()[["MBCS"]])) { - nestQuotes <- paste0("You said, \u201cHe said, ", - "\u2018Have a nice day.\u2019\u201d") - nq <- latexify(nestQuotes, doublebackslash=FALSE) - retVal <- - checkEquals(gsub("\\{\\}(?=\\\\)", "", - gsub("\u2018", "\\\\textquoteleft{}", - gsub("\u2019", "\\\\textquoteright{}", - gsub("\u201c", "\\\\textquotedblleft{}", - gsub("\u201d", - "\\\\textquotedblright{}", - nestQuotes)))), - perl=TRUE), - nq) - } + nestQuotes <- paste0("You said, \u201cHe said, ", + "\u2018Have a nice day.\u2019\u201d") + nq <- latexify(nestQuotes, doublebackslash=FALSE) + checkEquals(gsub("\\{\\}(?=\\\\)", "", + gsub("\u2018", "\\\\textquoteleft ", + gsub("\u2019", "\\\\textquoteright", + gsub("\u201c", "\\\\textquotedblleft ", + gsub("\u201d", + "\\\\textquotedblright", + nestQuotes)))), + perl=TRUE), + nq, msg="dQuote() and sQuote() are safe") + diaeresisD <- "o\u0308ljysa\u0308ilio\u0308" + diasD <- latexify(diaeresisD, doublebackslash=FALSE) + diaeresisC <- "\u00f6ljys\u00e4ili\u00f6" + diasC <- latexify(diaeresisC, doublebackslash=FALSE) + checkEquals(diasD, diasC, msg="Unicode NFD and NFC") + ## Strings containing practically every non-ASCII character that + ## will be converted by latexify() + breakWords <- rep(c("space", "vacation", "movie", "line", "break", + "rope", "period"), 2) + allChars <- + c("\u0132sselmeer is a lake, Berl\u0133n is Dutch for Berlin.", + paste0("Other digraphs and ligatures: \u01f1, \u01f2, \u01f3, ", + "\u01c4, \u01c5, \u01c6, \u01c7, \u01c8, \u01c9, \u01ca, ", + "\u01cb, \u01cc, \ufb00, \ufb01, \ufb02, \ufb03, \ufb04, ", + "\ufb05, \ufb06"), + paste0("\u017c\u00f3\u0142ty, p\u0113c, f\u00eate, ", + "vis-\u00e0-vis, pi\u00f1ata, Erd\u0151s, ", + "\u00c5ngstr\u00f6m, m\u0103r, t\u0159i, \u0203, t\u0331, ", + "fa\u00e7ade, \u1e0c, ", + "k\u0361p (there should be a ligature tie), t\u0105sa"), + "Circled: a\u20dd, \u00f1\u20dd", + "\u00a1Hola! \u00bfQu\u00e9 pasa? \u2e18Verdad\u203d", + paste0("Money: \u00a3, \u20ac, \u00a2, \u00a5, \u00a4, \u0e3f, ", + "\u20a1, \u20ab, \u20b2, \u20a4, \u20a6, \u20b1, \u20a9"), + paste0("No-Break\u00a0", breakWords, collapse=" "), + paste0("Do-Break ", breakWords, collapse=" "), + "visible\u2423space", + paste0(rep("Zero\u200bWidth\u200bSpace\u200b", 10), collapse=""), + paste0(rep(paste0("S\u00ado\u00adf\u00adt\u00ad", + "H\u00ady\u00adp\u00adh\u00ade\u00adn\u00ad", + "E\u00adv\u00ade\u00adr\u00ady\u00ad", + "w\u00adh\u00ade\u00adr\u00ade"), 8), + collapse="\u00ad"), + "Legal \u00a7, \u00a9, \u00ae, \u00b6, \u2117, \u2120, \u2122", + paste0("Letters \u00c6, \u00e6, \u0152, \u0153, \u00d8, \u00f8, ", + "\u0141, \u0142, \u1e9e, \u00df, \u017f, \u00d0, \u00f0, ", + "\u0110, \u0111, \u014a, \u014b, \u00de, \u00fe"), + paste0("Quotes: \u00ab | \u00bb | \u201a | \u201e | \u2039 | \u203a", + " | \u2018 | \u2019 | \u201c | \u201d"), + paste0("mho \u2127, ohm \u03a9, micro \u00b5, Celsius \u2103, ", + "degree \u00b0"), + paste0("Division \u00f7, times \u00d7, fractions \u00bc, \u00bd, ", + "\u00be, plusminus \u00b1, root \u221a, minus \u2212, ", + "asterisk \u2217, not \u00ac, fraction solidus \u2044, ", + "superscript \u00b9, \u00b2, \u00b3"), + paste0("Discount \u2052, estimated \u212e, \u2116 5, ", + "per mille \u2030, parts per ten thousand \u2031"), + "Bullets: \u2022 Closed, \u25e6 open", + paste0("Spacing diacritics: double acute \u02dd, acute \u00b4, ", + "cedilla \u00b8, breve \u02d8, ", + "caron \u02c7, diaeresis \u00a8, macron \u00af"), + "Arrows: left \u2190, up \u2191, right \u2192, down \u2193", + "Delimiters: \u3008, \u3009, \u301a, \u301b, \u2045, \u2046", + paste0("Miscellaneous: feminine ordinal \u00aa, ", + "masculine ordinal \u00ba, middle dot \u00b7, ", + "daggers \u2020, \u2021, ellipsis \u2026, ", + "double vertical line \u2016, large circle \u25ef, ", + "blank symbol \u2422, broken bar \u00a6, recipe \u211e, ", + "reference mark \u203b, low tilde \u02f7, ", + "en dash \u2013, em dash \u2014")) + ac <- latexify(allChars, doublebackslash=FALSE) + retVal <- checkTrue(all(Encoding(ac) == "unknown"), + msg("No non-ASCII characters left")) ## When used independently outside the test suite, the function - ## can create a test document + ## can create a test document, but only in a UTF-8 locale. if (isTRUE(testDocument) && isTRUE(l10n_info()[["UTF-8"]])) { preamble <- c("\\documentclass[a4paper]{article}", + "\\usepackage{etoolbox}", + "\\usepackage{ifluatex}", + "\\usepackage{ifxetex}", + "\\usepackage{parskip}", + "\\usepackage{textcomp}", + "\\ifbool{luatex}{", + "\\usepackage{fontspec}", + "}{", + "\\ifbool{xetex}{", + "\\usepackage{fontspec}", + "}{", "\\usepackage[T1]{fontenc}", - "\\usepackage{textcomp}", - "\\usepackage{parskip}", - "\\usepackage[utf8]{inputenx}", - "\\input{ix-utf8enc.dfu}") - id <- c(testStrings, latin1String, rep(quoteString, 5), nestQuotes) - extraInfo <- c(rep("", length(testStrings) + 1), + "\\usepackage{lmodern}", + "}}") + id <- c(testStrings, latin1String, rep(quoteString, 5), nestQuotes, + diaeresisD, diaeresisC, allChars) + extraInfo <- c(rep("", length(testStrings) + length(latin1String)), paste0(" (", c("default", "curved", "no packages", "only fontenc", "only textcomp"), ")"), - "") + rep("", length(nestQuotes)), + rep(" (Unicode NFD)", length(diaeresisD)), + rep(" (Unicode NFC)", length(diaeresisC)), + rep("", length(allChars))) - ## Record how R prints inputDescription + ## Record how R prints the elements in 'id' inputDescription <- character(length(id)) # dummy line tc <- textConnection("inputDescription", "w", local = TRUE) sink(tc) @@ -265,9 +353,18 @@ close(tc) on.exit() - allOutput <- c(ltxSingle, utf8fy, res1, res2, res3, res4, res5, nq) - filename <- tempfile(pattern = "latexify", fileext = ".tex") - co <- file(filename, open = "wt", encoding = "UTF-8") + allOutput <- c(ltxSingle, latinConverted, res1, res2, res3, res4, + res5, nq, diasD, diasC, ac) + if (is.character(con)) { + co <- file(con, open = "wt", encoding = "UTF-8") + on.exit(close(co)) + } else { + co <- con + if (!isOpen(co)) { + open(co, open = "wt") + on.exit(close(co)) + } + } writeLines(preamble, co) writeLines("\\begin{document}", co) writeLines("\\begin{enumerate}", co) @@ -277,8 +374,7 @@ co, sep = "\n\n") writeLines("\\end{enumerate}", co) writeLines("\\end{document}", co) - close(co) - filename + con } else { retVal } [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/dplr -r 921 From noreply at r-forge.r-project.org Thu Dec 18 10:38:39 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 18 Dec 2014 10:38:39 +0100 (CET) Subject: [Dplr-commits] r922 - pkg/dplR/R Message-ID: <20141218093839.1920B1878FE@r-forge.r-project.org> Author: zang Date: 2014-12-18 10:38:38 +0100 (Thu, 18 Dec 2014) New Revision: 922 Modified: pkg/dplR/R/glk.R Log: GLK fixed for the case of neighbouring identical measurements in both series in the same years Modified: pkg/dplR/R/glk.R =================================================================== --- pkg/dplR/R/glk.R 2014-12-12 18:55:16 UTC (rev 921) +++ pkg/dplR/R/glk.R 2014-12-18 09:38:38 UTC (rev 922) @@ -20,11 +20,11 @@ } else { dif1 <- sign(diff(col1[not.na.both])) dif2 <- sign(diff(col2[not.na.both])) - G[i, k] <- sum(abs(dif1 + dif2)) / (2 * m - 2) - } - } - } - } - } + G[i, k] <- 1 - sum(abs(dif1 - dif2))/(2 * m - 2) + } + } + } + } + } G } From noreply at r-forge.r-project.org Thu Dec 18 10:49:02 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 18 Dec 2014 10:49:02 +0100 (CET) Subject: [Dplr-commits] r923 - pkg/dplR/man Message-ID: <20141218094902.E45D71878B6@r-forge.r-project.org> Author: zang Date: 2014-12-18 10:49:02 +0100 (Thu, 18 Dec 2014) New Revision: 923 Modified: pkg/dplR/man/glk.Rd Log: amend R:922 Modified: pkg/dplR/man/glk.Rd =================================================================== --- pkg/dplR/man/glk.Rd 2014-12-18 09:38:38 UTC (rev 922) +++ pkg/dplR/man/glk.Rd 2014-12-18 09:49:02 UTC (rev 923) @@ -27,7 +27,11 @@ upper triangle reports the \enc{Gleichl?ufigkeit}{Gleichlaeufigkeit} of each possible combination of records. The global \enc{Gleichl?ufigkeit}{Gleichlaeufigkeit} can be calculated as - \code{mean(glk(\var{x}), na.rm = TRUE)}. + \code{mean(glk(\var{x}), na.rm = TRUE)}. This implementation improves + the original formulation inasmuch as the case of neighbouring + identical measurements in the same years is accounted for. Here, it is + treated as full agreement, in contrast to only partial agreement in + the original formulation. } \value{ @@ -37,7 +41,8 @@ computed, and \code{NA} is returned. } -\author{ Christian Zang. Patched and improved by Mikko Korpela. } +\author{ Christian Zang. Patched and improved by Mikko Korpela. + Improved by Allan Buras. } \references{ Eckstein, D., Bauch J. (1969) Beitrag zur Rationalisierung eines From noreply at r-forge.r-project.org Fri Dec 19 22:58:00 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 19 Dec 2014 22:58:00 +0100 (CET) Subject: [Dplr-commits] r924 - pkg/dplR Message-ID: <20141219215800.B7336187845@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-19 22:58:00 +0100 (Fri, 19 Dec 2014) New Revision: 924 Modified: pkg/dplR/DESCRIPTION Log: * Added Allan Buras as contributor (see glk()) * Reordered the list of authors and contributors. Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-18 09:49:02 UTC (rev 923) +++ pkg/dplR/DESCRIPTION 2014-12-19 21:58:00 UTC (rev 924) @@ -3,18 +3,18 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-12-12 +Date: 2014-12-19 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", role = c("aut", "cph")), person("Filipe", "Campelo", role = c("aut", "cph")), person("Pierre", "M?rian", role = c("aut", - "cph")), person("Manfred", "Mudelsee", role = "ctb"), - person("Fares", "Qeadan", role = c("aut", "cph")), - person("Michael", "Schulz", role = "ctb"), person("Christian", - "Zang", role = c("aut", "cph")), person("Jacob", "Cecile", - role = "ctb")) -Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Manfred Mudelsee [ctb], Fares Qeadan [aut, cph], Michael Schulz [ctb], Christian Zang [aut, cph], Jacob Cecile [ctb] + "cph")), person("Fares", "Qeadan", role = c("aut", "cph")), + person("Christian", "Zang", role = c("aut", "cph")), + person("Allan", "Buras", role = "ctb"), person("Jacob", + "Cecile", role = "ctb"), person("Manfred", "Mudelsee", role = + "ctb"), person("Michael", "Schulz", role = "ctb")) +Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Fares Qeadan [aut, cph], Christian Zang [aut, cph], Allan Buras [ctb], Jacob Cecile [ctb], Manfred Mudelsee [ctb], Michael Schulz [ctb] Copyright: Authors and Aalto University (for work of M. Korpela) Maintainer: Andy Bunn Depends: R (>= 2.15.0) From noreply at r-forge.r-project.org Sat Dec 20 10:24:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 20 Dec 2014 10:24:30 +0100 (CET) Subject: [Dplr-commits] r925 - in pkg/dplR: . inst/unitTests Message-ID: <20141220092430.42C21186229@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-20 10:24:30 +0100 (Sat, 20 Dec 2014) New Revision: 925 Modified: pkg/dplR/DESCRIPTION pkg/dplR/inst/unitTests/runit.dplR.R Log: Changed the expected results in the glk() unit tests to reflect the changes made to the function. Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-19 21:58:00 UTC (rev 924) +++ pkg/dplR/DESCRIPTION 2014-12-20 09:24:30 UTC (rev 925) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-12-19 +Date: 2014-12-20 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", Modified: pkg/dplR/inst/unitTests/runit.dplR.R =================================================================== --- pkg/dplR/inst/unitTests/runit.dplR.R 2014-12-19 21:58:00 UTC (rev 924) +++ pkg/dplR/inst/unitTests/runit.dplR.R 2014-12-20 09:24:30 UTC (rev 925) @@ -593,14 +593,14 @@ msg="glk() is 1 when two sequences agree about the signs of all the differences and there are no zero differences") checkEquals(0, glk(data.frame(seq.rand, -seq.rand))[1, 2], msg="glk() is 0 when two sequences disagree about the signs of all the differences and there are no zero differences") - checkEquals(0, glk(data.frame(seq.step, -seq.step))[1, 2], - msg="glk() is 0 when two sequences agree about the location of zero differences and disagree about the signs of nonzero differences") + checkEquals(0.5, glk(data.frame(seq.step, -seq.step))[1, 2], + msg="dplR >= 1.6.1: a zero difference in both series is full agreement (here, exactly half of the cases)") checkEquals(0.5, glk(data.frame(seq.rand, rep(1, length(seq.rand))))[1, 2], msg="glk() is 0.5 when one sequence is constant and the other only has nonzero differences") - checkEquals(0.5, glk(data.frame(seq.step, seq.step))[1, 2], - msg="glk() is 0.5 when comparing a sequence where exactly half of the differences are zero with itself") - checkEquals(0.25, glk(data.frame(seq.step, rep(1, length(seq.step))))[1, 2], - msg="glk() is 0.25 when comparing a constant sequence and a sequence where exactly half of the differences are zero") + checkEquals(1, glk(data.frame(seq.step, seq.step))[1, 2], + msg="dplR >= 1.6.1: glk() is 1 when comparing any sequence with itself") + checkEquals(0.75, glk(data.frame(seq.step, rep(1, length(seq.step))))[1, 2], + msg="dplR >= 1.6.1: glk() is 0.75 when comparing a constant sequence and a sequence where exactly half of the differences are zero") } test.hanning <- function() { From noreply at r-forge.r-project.org Mon Dec 22 22:46:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 22 Dec 2014 22:46:38 +0100 (CET) Subject: [Dplr-commits] r926 - in pkg/dplR: . R Message-ID: <20141222214638.D78E518769B@r-forge.r-project.org> Author: andybunn Date: 2014-12-22 22:46:38 +0100 (Mon, 22 Dec 2014) New Revision: 926 Modified: pkg/dplR/ChangeLog pkg/dplR/DESCRIPTION pkg/dplR/R/crn.plot.R pkg/dplR/R/wavelet.plot.R Log: Several minor changes to crn.plot and wavelet.plot. The Description field in DESCRIPTION has been updated as well. Modified: pkg/dplR/ChangeLog =================================================================== --- pkg/dplR/ChangeLog 2014-12-20 09:24:30 UTC (rev 925) +++ pkg/dplR/ChangeLog 2014-12-22 21:46:38 UTC (rev 926) @@ -1,5 +1,29 @@ * CHANGES IN dplR VERSION 1.6.1 + +File: glk.R and glk.Rd +------------- +- Modified by Christian Zang in reponse to a bug report by Allan Buras. In the + case of no change from year i to year i+1 in both series then the glk sign + will for both be 0 and the sum of both is then also 0 and will not be + accounted for correctly in the sum of synchronous years. Zang and Buras have + pached and Zang updates the help file to reflect the change as: + "This implementation improves the original formulation inasmuch as the case + of neighbouring identical measurements in the same years is accounted for. + Here, it is treated as full agreement, in contrast to only partial agreement + in the original formulation."" + +File: crn.plot.R +------------- + +- Removed automatic plotting of chronology name in main title. + + +File: plot.wavelet.R +------------- + +- Fixed small bug in ylim for the chronology in the plot. + File: NAMESPACE --------------- Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-20 09:24:30 UTC (rev 925) +++ pkg/dplR/DESCRIPTION 2014-12-22 21:46:38 UTC (rev 926) @@ -24,7 +24,9 @@ Suggests: Biobase, dichromat (>= 1.2-3), foreach, forecast, iterators, knitr, RColorBrewer, RUnit (>= 0.4.25), tikzDevice, waveslim Description: This package contains functions for performing tree-ring - analyses, IO, and graphics. + analyses such as detrending, chronology building, and cross dating. + The package reads and writes standard file formats used in + dendrochronology LazyData: no License: GPL (>= 2) URL: http://huxley.wwu.edu/trl/htrl-dplr, Modified: pkg/dplR/R/crn.plot.R =================================================================== --- pkg/dplR/R/crn.plot.R 2014-12-20 09:24:30 UTC (rev 925) +++ pkg/dplR/R/crn.plot.R 2014-12-22 21:46:38 UTC (rev 926) @@ -33,8 +33,7 @@ nyrs2 <- nyrs for(i in seq_len(nCrn)){ spl <- crn[[i]] - plot(yr.vec, spl, type="n",axes=FALSE, - main=crn.names[i],...) + plot(yr.vec, spl, type="n",axes=FALSE,...) if(sd.exist) { par(new=TRUE) plot(yr.vec, samp.depth, type="n", Modified: pkg/dplR/R/wavelet.plot.R =================================================================== --- pkg/dplR/R/wavelet.plot.R 2014-12-20 09:24:30 UTC (rev 925) +++ pkg/dplR/R/wavelet.plot.R 2014-12-22 21:46:38 UTC (rev 926) @@ -7,7 +7,8 @@ key.lab = parse(text = paste0("\"", gettext("Power"), "\"^2")), add.spline = FALSE, f = 0.5, nyrs = NULL, crn.col = "black", crn.lwd = 1,coi.col='black', - crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE, + crn.ylim = c(min(wave.list$y)*0.95,max(wave.list$y)*1.05), + side.by.side = FALSE, useRaster = FALSE, res = 150, reverse.y = FALSE) { From noreply at r-forge.r-project.org Tue Dec 23 10:10:34 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 23 Dec 2014 10:10:34 +0100 (CET) Subject: [Dplr-commits] r927 - in pkg/dplR: . R man Message-ID: <20141223091034.37FAB183E18@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-23 10:10:33 +0100 (Tue, 23 Dec 2014) New Revision: 927 Modified: pkg/dplR/DESCRIPTION pkg/dplR/R/wavelet.plot.R pkg/dplR/man/wavelet.plot.Rd Log: Simpler default of crn.ylim in wavelet.plot(), edited the .Rd accordingly Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-22 21:46:38 UTC (rev 926) +++ pkg/dplR/DESCRIPTION 2014-12-23 09:10:33 UTC (rev 927) @@ -3,7 +3,7 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-12-20 +Date: 2014-12-23 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", Modified: pkg/dplR/R/wavelet.plot.R =================================================================== --- pkg/dplR/R/wavelet.plot.R 2014-12-22 21:46:38 UTC (rev 926) +++ pkg/dplR/R/wavelet.plot.R 2014-12-23 09:10:33 UTC (rev 927) @@ -7,7 +7,7 @@ key.lab = parse(text = paste0("\"", gettext("Power"), "\"^2")), add.spline = FALSE, f = 0.5, nyrs = NULL, crn.col = "black", crn.lwd = 1,coi.col='black', - crn.ylim = c(min(wave.list$y)*0.95,max(wave.list$y)*1.05), + crn.ylim = range(wave.list$y) * c(0.95, 1.05), side.by.side = FALSE, useRaster = FALSE, res = 150, reverse.y = FALSE) { Modified: pkg/dplR/man/wavelet.plot.Rd =================================================================== --- pkg/dplR/man/wavelet.plot.Rd 2014-12-22 21:46:38 UTC (rev 926) +++ pkg/dplR/man/wavelet.plot.Rd 2014-12-23 09:10:33 UTC (rev 927) @@ -15,7 +15,8 @@ key.lab = parse(text=paste0("\"", gettext("Power"), "\"^2")), add.spline = FALSE, f = 0.5, nyrs = NULL, crn.col = "black", crn.lwd = 1,coi.col='black', - crn.ylim = range(wave.list$y)*1.1, side.by.side = FALSE, + crn.ylim = range(wave.list$y) * c(0.95, 1.05), + side.by.side = FALSE, useRaster = FALSE, res = 150, reverse.y = FALSE) } \arguments{ From noreply at r-forge.r-project.org Tue Dec 23 21:31:54 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 23 Dec 2014 21:31:54 +0100 (CET) Subject: [Dplr-commits] r928 - in branches/teleconnections: . R data inst/doc inst/unitTests man vignettes Message-ID: <20141223203154.1D6E31875A9@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-23 21:31:53 +0100 (Tue, 23 Dec 2014) New Revision: 928 Added: branches/teleconnections/.R/ branches/teleconnections/00_README-developer branches/teleconnections/inst/unitTests/runit.utils.R branches/teleconnections/man/rasterPlot.Rd Modified: branches/teleconnections/ branches/teleconnections/.Rbuildignore branches/teleconnections/ChangeLog branches/teleconnections/DESCRIPTION branches/teleconnections/NAMESPACE branches/teleconnections/R/crn.plot.R branches/teleconnections/R/detrend.R branches/teleconnections/R/glk.R branches/teleconnections/R/latexify.R branches/teleconnections/R/rasterPlot.R branches/teleconnections/R/spag.plot.R branches/teleconnections/R/wavelet.plot.R branches/teleconnections/TODO branches/teleconnections/data/anos1.rda branches/teleconnections/data/ca533.rda branches/teleconnections/data/cana157.rda branches/teleconnections/data/co021.rda branches/teleconnections/data/gp.rwl.rda branches/teleconnections/inst/doc/ branches/teleconnections/inst/doc/00_INDEX branches/teleconnections/inst/doc/math-dplR.R branches/teleconnections/inst/doc/math-dplR.Rnw.txt branches/teleconnections/inst/doc/math-dplR.bib branches/teleconnections/inst/doc/math-dplR.pdf branches/teleconnections/inst/unitTests/runit.dplR.R branches/teleconnections/man/glk.Rd branches/teleconnections/man/latexify.Rd branches/teleconnections/man/spag.plot.Rd branches/teleconnections/man/wavelet.plot.Rd branches/teleconnections/vignettes/ branches/teleconnections/vignettes/dplR.sty Log: Merged changes from main development tree Property changes on: branches/teleconnections ___________________________________________________________________ Modified: svn:ignore - dplR-Ex.R svn*.tmp .* *~ + dplR-Ex.R svn*.tmp .* *~ .Rproj.user *.Rproj Modified: svn:mergeinfo - /branches/dplR-R-2.15:466-506 /branches/redfit:662-700 + /branches/dplR-R-2.15:466-506 /branches/redfit:662-700 /pkg/dplR:898-927 Modified: branches/teleconnections/.Rbuildignore =================================================================== --- branches/teleconnections/.Rbuildignore 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/.Rbuildignore 2014-12-23 20:31:53 UTC (rev 928) @@ -4,5 +4,9 @@ ^(.*/)?\..+$ ^inst/doc/cache(/.*)?$ ^inst/doc/figure(/.*)?$ -^inst/doc/.*\.Rout$ +^inst/doc/.*\.(Rnw|Rout|aux|bbl|blg|fdb_latexmk|fls|glo|gls|glg|idx|ind|ilg|lof|log|lot|out|synctex.gz|tex|toc)$ ^.*-tikzDictionary$ +^.*\.Rproj$ +^\.Rproj\.user$ +^.*/auto$ +^(|.*[^[:alpha:]])README-developer(|[^[:alpha:]].*)$ Copied: branches/teleconnections/00_README-developer (from rev 927, pkg/dplR/00_README-developer) =================================================================== --- branches/teleconnections/00_README-developer (rev 0) +++ branches/teleconnections/00_README-developer 2014-12-23 20:31:53 UTC (rev 928) @@ -0,0 +1,97 @@ +1. Introduction + +The (hidden) directory .R in the dplR source repository contains +suggested R initialization files to use when building, checking and +installing (compiling) the dplR package. The initialization files +should generally be placed in HOME/.R/ where HOME is the user's home +directory. Some customization may be required depending on the +platform. Check if the files already exist and combine the suggested +"dplR settings" with your previous settings if appropriate. + + +2. List of files included, and the settings explained + +* Makevars + +This file is used when R CMD INSTALL compiles the C source code +included in dplR. The compiler flags in the Makevars file should work +with the GCC compiler. Other compilers may require different flags. + +The following variables are set: + +CFLAGS=-Wall -pedantic -Wextra + + The purpose of the flags is to enable more thorough warnings than + those used by default [1, Customizing package compilation]. The + warnings are useful in the development phase when making changes to + the C code. Because all issues should be solved before releasing + the package on CRAN, there is no need to distribute a Makevars file + with dplR (as long as Makevars serves no other purpose than to add + more compile time checks). Spurious warnings may occur when using + an old compiler. A list of known cases: + - warning about imaginary constants being a GNU extension by + Apple's gcc 4.2, OS X 10.7 + +Note that a matching platform-specific Makevars file +(Makevars-R_PLATFORM, Makevars.win or Makevars.win64), if available, +takes precedence over a generic Makevars file. If you already have a +platform-specific Makevars file, consider adding these definitions +there. + +* build.Renviron + +This is used with R CMD build [2, Checking and building packages]. +The following environment variables are set: + +LC_ALL=en_US.UTF-8 + + The locale is set to use the UTF-8 character set and US English. + UTF-8 is used because dplR specifies UTF-8 as its Encoding in the + DESCRIPTION file. The language setting may not matter, but one must + be chosen, and the en_US.UTF-8 locale is probably available on most + systems. + +_R_BUILD_COMPACT_VIGNETTES_=both + + This enables the compression of vignettes and other PDFs, making the + dplR source package (.tar.gz) smaller. The value "both" means that + two compression steps (lossy and lossless) are performed. Two + programs must be available: Ghostscript [3] and QPDF [4]. Among + other things, the Ghostscript step applies lossy compression to + bitmap images using "ebook" quality (150 dpi) [5, 6]. This may + considerably reduce the size of the PDF. QPDF performs a lossless + compression. At the time of writing (dplR revision 908 on R-Forge, + Ghostscript 9.15, QPDF 5.12), the reduction in package size is 330 + KiB (18 %). [2, Building package tarballs; 7] + +* check.Renviron + +Settings for R CMD check [2, Checking and building packages]: locale +as in build.Renviron. + + +References + +[1] R Installation and Administration (R-devel). + http://cran.r-project.org/doc/manuals/r-devel/R-admin.html + (Accessed 2014-11-06) + +[2] Writing R Extensions (R-devel). + http://cran.r-project.org/doc/manuals/r-devel/R-exts.html + (Accessed 2014-11-06) + +[3] Ghostscript. http://ghostscript.com/ (Accessed 2014-11-06) + +[4] QPDF: A Content-Preserving PDF Transformation System. + http://qpdf.sourceforge.net/ (Accessed 2014-11-06) + +[5] File src/library/tools/R/build.R in the R source tree + +[6] compactPDF: Compact PDF Files. Rd help page accessible by running + "?tools::compactPDF" in the R command prompt. + +[7] Help text of "R CMD build" command line tool. Accessible by + running "R CMD build --help" in a command line interpreter. + +The version of R in 5, 6 and 7 was "R Under development (unstable) +(2014-11-03 r66928)". Modified: branches/teleconnections/ChangeLog =================================================================== --- branches/teleconnections/ChangeLog 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/ChangeLog 2014-12-23 20:31:53 UTC (rev 928) @@ -1,11 +1,36 @@ * CHANGES IN dplR VERSION 1.6.1 + +File: glk.R and glk.Rd +------------- +- Modified by Christian Zang in reponse to a bug report by Allan Buras. In the + case of no change from year i to year i+1 in both series then the glk sign + will for both be 0 and the sum of both is then also 0 and will not be + accounted for correctly in the sum of synchronous years. Zang and Buras have + pached and Zang updates the help file to reflect the change as: + "This implementation improves the original formulation inasmuch as the case + of neighbouring identical measurements in the same years is accounted for. + Here, it is treated as full agreement, in contrast to only partial agreement + in the original formulation."" + +File: crn.plot.R +------------- + +- Removed automatic plotting of chronology name in main title. + + +File: plot.wavelet.R +------------- + +- Fixed small bug in ylim for the chronology in the plot. + File: NAMESPACE --------------- -- Added latexify() and latexDate() to export list +- Added rasterPlot, latexify() and latexDate() to export list - Import readPNG from png. - Import more functions from grid. +- Import stri_trans_nfc from stringi. File: DESCRIPTION ----------------- @@ -16,7 +41,7 @@ math-dplR.pdf easier with openPDF(). RColorBrewer provides an alternative palette to an example in wavelet.plot.Rd. -- New Imported package: png. +- New Imported packages: png and stringi. File: chron.R ------------- @@ -46,6 +71,11 @@ - Bug fix: Argument 'method' was not used for moving correlations. Instead, the method used was always "spearman". +File: detrend.R +--------------- + +- Updated .export of foreach() to match previous changes to the loop body + File: latexify.R ---------------- @@ -90,9 +120,8 @@ New file rasterPlot.R --------------------- -- New function rasterPlot(), internal to the package. Adds a - raster image drawn with low level graphics commands to the current - high level plot. +- New function rasterPlot(). Adds a raster image drawn with low + level graphics commands to the current high level plot. Files: rcompact.c, readloop.c ----------------------------- @@ -119,6 +148,14 @@ plot with less than the full number of rows can fit in a smaller device and text on the sides won't be clipped. +File: spag.plot.R +----------------- + +- Added two options to spag.plot(). + 'useRaster': draw the tree-ring series as a raster image? (default + 'FALSE') + 'res': resolution of the tree-ring series when 'useRaster' is 'TRUE' + File: timeseries-dplR.Rnw ------------------------- @@ -254,14 +291,14 @@ File: corr.series.seg.R -------------------- -- Added method argument to specify method for cor.test(). Defauts to +- Added method argument to specify method for cor.test(). Defaults to "spearman." File: corr.rwl.seg.R -------------------- - Removed yr.range() function in favor of yr.range() in helpers.R. They are identical for all practical purposes. -- Added method argument to specify method for cor.test(). Defauts to +- Added method argument to specify method for cor.test(). Defaults to "spearman." File: interseries.cor.R ------------------------- @@ -363,7 +400,7 @@ Files: exactsum.c, exactsum.h ----------------------------- -- Reuse of code between function by using the C preprocessor +- Reuse of code between functions by using the C preprocessor - New (internal to dplR C code) function cumsum (cumulative sum, overwrites input array) - size_t n @@ -371,7 +408,7 @@ File: gini.c ------------ -- Simplified expression for gini coefficent reduces number of +- Simplified expression for gini coefficient reduces number of arithmetic operations performed - Fewer calls to other functions (use of the new cumulative sum function) @@ -631,7 +668,7 @@ ------------------- - Fixed trimming of all-NA rows -- Fixed a bug that could crash R if the fided-width columns of the input +- Fixed a bug that could crash R if the fixed-width columns of the input file did not follow the (loose) specifications of the Tucson format - AB: Note to dplR developers that this is a result of a poor standard in the Tucson format but this fix is needed to work with files that are @@ -1989,7 +2026,7 @@ 2011-05-18 Andy Bunn * CHANGES IN dplR VERSION 1.4.0 -* Incporporation of TRiDAS via Mikko Korpela, May 16, 2011 +* Incorporation of TRiDAS via Mikko Korpela, May 16, 2011 File: NAMESPACE --------------- @@ -2070,7 +2107,7 @@ 2010-11-15 Andy Bunn * CHANGES IN dplR VERSION 1.3.9 * Added an option to control the colors in plot.wavelet(). -* Added an option to plot wavelets side by side instead of stacked (plus a few owther beutifications). +* Added an option to plot wavelets side by side instead of stacked (plus a few other beautifications). * Changes mostly in wavelet.plot.R and arg side.by.side and key.col added to the help. * Added an axis on side three for the wavelet plot. @@ -2218,7 +2255,7 @@ * Modified wavelet.plot() to produce a better looking plot and put the wavelet code into a new function called morlet(). * Deprecated cwt.filled.contour * Added normalize1 to NAMESPACE -* Added arguiment label.cex to pass to axis to increase the size of the labels on the plot in corr.rwl.seg() and modified +* Added argument label.cex to pass to axis to increase the size of the labels on the plot in corr.rwl.seg() and modified the help file accordingly. This change was requested by a user and seems like a good idea. * Corrected some spelling in help for corr.rwl.seg(), ccf.series.seg(), and corr.series.seg(). I'm sure there is more. 2010-07-17 Andy Bunn @@ -2226,7 +2263,7 @@ * Modified rcs() to stop() if any of the pith offsets are <1 or not integers. The help file indicated that this should be so but it's now explicit in the code. * Fixed a bug in corr.rwl.seg() where floating series were not being drawn properly - the plot had them displaying all the way to the - max yr range b/c of an inexing problem. Also made some cosmetic changes to the guides in between segments for the graph. I do NOT + max yr range b/c of an indexing problem. Also made some cosmetic changes to the guides in between segments for the graph. I do NOT like the way the plot on this function is done with the odd bin and even bin looping. Very clunky and confusing to look at. The correlation part is fine and the graph is nice but the logic of the plot is silly. * Clarified language the help page for corr.rwl.seg(). @@ -2239,12 +2276,12 @@ ccf.df$bin factor to be the same order as bins[,1]. * Clarified language the help page for ccf.series.rwl(). * Improved series.rwl.plot() to give more diagnostic information in four plots. -* Improved the help page for series.rwl.plot() to beter explain what it now does. +* Improved the help page for series.rwl.plot() to better explain what it now does. 2010-07-05 Andy Bunn * CHANGES IN dplR VERSION 1.3.5 * Modified the help file for write.crn() so that the elev in the hdr will be written in a way that might - be more robust in terms of the ITRDB standard. But, it's very clunky and silly to depend on an unrelaible + be more robust in terms of the ITRDB standard. But, it's very clunky and silly to depend on an unreliable standard. I also added some text to the help file for write.tucson() to indicate that the header should be thought of as experimental. Thank goodness Mikko is working on getting tridas implemented. * Fixed a bug in rcs() where the rc was calculated wrong if none. The function implicitly assumed Modified: branches/teleconnections/DESCRIPTION =================================================================== --- branches/teleconnections/DESCRIPTION 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/DESCRIPTION 2014-12-23 20:31:53 UTC (rev 928) @@ -3,28 +3,30 @@ Type: Package Title: Dendrochronology Program Library in R Version: 1.6.1 -Date: 2014-09-12 +Date: 2014-12-23 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", role = c("aut", "cph")), person("Filipe", "Campelo", role = c("aut", "cph")), person("Pierre", "M?rian", role = c("aut", - "cph")), person("Manfred", "Mudelsee", role = "aut"), - person("Fares", "Qeadan", role = c("aut", "cph")), - person("Michael", "Schulz", role = "aut"), person("Christian", - "Zang", role = c("aut", "cph")), person("Jacob", "Cecile", - role = "ctb")) -Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Manfred Mudelsee [aut], Fares Qeadan [aut, cph], Michael Schulz [aut], Christian Zang [aut, cph], Jacob Cecile [ctb] + "cph")), person("Fares", "Qeadan", role = c("aut", "cph")), + person("Christian", "Zang", role = c("aut", "cph")), + person("Allan", "Buras", role = "ctb"), person("Jacob", + "Cecile", role = "ctb"), person("Manfred", "Mudelsee", role = + "ctb"), person("Michael", "Schulz", role = "ctb")) +Author: Andy Bunn [aut, cph, cre, trl], Mikko Korpela [aut, trl], Franco Biondi [aut, cph], Filipe Campelo [aut, cph], Pierre M?rian [aut, cph], Fares Qeadan [aut, cph], Christian Zang [aut, cph], Allan Buras [ctb], Jacob Cecile [ctb], Manfred Mudelsee [ctb], Michael Schulz [ctb] Copyright: Authors and Aalto University (for work of M. Korpela) Maintainer: Andy Bunn Depends: R (>= 2.15.0) Imports: gmp (>= 0.5-2), graphics, grDevices, grid, stats, utils, digest (>= 0.2.3), lattice (>= 0.13-6), png (>= 0.1-1), - stringr (>= 0.4), XML (>= 2.1-0) + stringi (>= 0.2-2), stringr (>= 0.4), XML (>= 2.1-0) Suggests: Biobase, dichromat (>= 1.2-3), foreach, forecast, iterators, knitr, RColorBrewer, RUnit (>= 0.4.25), tikzDevice, waveslim Description: This package contains functions for performing tree-ring - analyses, IO, and graphics. + analyses such as detrending, chronology building, and cross dating. + The package reads and writes standard file formats used in + dendrochronology LazyData: no License: GPL (>= 2) URL: http://huxley.wwu.edu/trl/htrl-dplr, Modified: branches/teleconnections/NAMESPACE =================================================================== --- branches/teleconnections/NAMESPACE 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/NAMESPACE 2014-12-23 20:31:53 UTC (rev 928) @@ -22,6 +22,8 @@ importFrom(png, readPNG) +importFrom(stringi, stri_trans_nfc, stri_trans_nfd) + importFrom(stringr, str_pad, str_trim) importFrom(utils, head, installed.packages, read.fwf, tail, @@ -42,7 +44,7 @@ write.compact, write.crn, write.rwl, write.tridas, write.tucson, plot.rwl, interseries.cor, summary.rwl, plot.crn, insert.ring, delete.ring, xskel.ccf.plot, xskel.plot, - latexify, latexDate) + latexify, latexDate, rasterPlot) S3method(print, redfit) S3method(plot, rwl) Modified: branches/teleconnections/R/crn.plot.R =================================================================== --- branches/teleconnections/R/crn.plot.R 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/R/crn.plot.R 2014-12-23 20:31:53 UTC (rev 928) @@ -33,8 +33,7 @@ nyrs2 <- nyrs for(i in seq_len(nCrn)){ spl <- crn[[i]] - plot(yr.vec, spl, type="n",axes=FALSE, - main=crn.names[i],...) + plot(yr.vec, spl, type="n",axes=FALSE,...) if(sd.exist) { par(new=TRUE) plot(yr.vec, samp.depth, type="n", Modified: branches/teleconnections/R/detrend.R =================================================================== --- branches/teleconnections/R/detrend.R 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/R/detrend.R 2014-12-23 20:31:53 UTC (rev 928) @@ -34,9 +34,7 @@ ## a way to get rid of "no visible binding" NOTE in R CMD check rwl.i <- NULL - exportFun <- c("detrend.series", "is.data.frame", - "row.names<-", "<-", "if") - + exportFun <- c("names<-", "detrend.series") out <- foreach::"%dopar%"(foreach::foreach(rwl.i=it.rwl, .export=exportFun), { Modified: branches/teleconnections/R/glk.R =================================================================== --- branches/teleconnections/R/glk.R 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/R/glk.R 2014-12-23 20:31:53 UTC (rev 928) @@ -20,11 +20,11 @@ } else { dif1 <- sign(diff(col1[not.na.both])) dif2 <- sign(diff(col2[not.na.both])) - G[i, k] <- sum(abs(dif1 + dif2)) / (2 * m - 2) - } - } - } - } - } + G[i, k] <- 1 - sum(abs(dif1 - dif2))/(2 * m - 2) + } + } + } + } + } G } Modified: branches/teleconnections/R/latexify.R =================================================================== --- branches/teleconnections/R/latexify.R 2014-12-23 09:10:33 UTC (rev 927) +++ branches/teleconnections/R/latexify.R 2014-12-23 20:31:53 UTC (rev 928) @@ -13,15 +13,11 @@ ## Usage: \Sexpr{latexify(string_produced_by_R_code)} ## -## Make arbitrary character() vector compatible with LaTeX by escaping -## special characters, then convert to UTF-8 encoding. Any formatting -## (newlines, tabs, etc.) will be lost. Note that the set of -## characters actually supported depends on the font, LaTeX engine and -## set of packages used. -## ## It seems that Sweave needs doublebackslash = TRUE ## but knitr needs doublebackslash = FALSE. -latexify <- function(x, doublebackslash=TRUE) { +latexify <- function(x, doublebackslash = TRUE, dashdash = TRUE, + quotes = c("straight", "curved"), + packages = c("fontenc", "textcomp")) { y <- as.character(x) ## Kludge for converting from "byte" to the current encoding ## in a way which preserves the hex notation. @@ -37,13 +33,26 @@ cat(y[encBytes], sep = "\n") y[encBytes] <- foo } + l10n <- l10n_info() + Letters <- paste0(c(LETTERS, letters), collapse="") + fontenc <- "fontenc" %in% packages + textcomp <- "textcomp" %in% packages + eurosym <- "eurosym" %in% packages + straightQuotes <- match.arg(quotes) == "straight" + ## Remove control characters (not spaces!) + y <- gsub("(?![[:space:]])[[:cntrl:]]", "", y, perl=TRUE) ## Convert any sequence of whitespace to a single space. This ## substitution must be done before control characters because ## newline belongs to both groups. y <- gsub("[[:space:]]+", " ", y) - ## Remove control characters - y <- gsub("[[:cntrl:]]", "", y) - ## Escape LaTeX special characters. + + ## Handle LaTeX special characters in the ASCII range. + ## Some substitutions are mandatory, others affect matters such as + ## the rendering of the character in question (e.g. \textquote...) + ## or line breaks (\slash). Some substitutions are unnecessary if + ## using a font encoding other than OT1 (\textbar, ...), but are + ## performed every time nonetheless. The dash (-) is given + ## special treatment to disable the em and en dash ligatures. ## Source: Scott Pakin (2009) The Comprehensive LaTeX Symbol List. ## Accessible through "texdoc symbols". ## Particularly section 8.6 "ASCII and Latin 1 quick reference". @@ -53,35 +62,290 @@ ## Then, \ is replaced with \textbackslash{}, ## but not if followed by { or }. ## After that, the order does not matter. + ## + ## This starts the 'substitutions' list, which is finally + ## processed close to the end of the function. substitutions <- - list(c("\\{", "\\\\{"), - c("\\}", "\\\\}"), - c("\\\\(?!(\\{|\\}))", "\\\\textbackslash{}"), - c("\\#", "\\\\#"), - c("\\$", "\\\\$"), - c("%", "\\\\%"), - c("\\^", "\\\\^{}"), - c("&", "\\\\&"), - c("_", "\\\\_"), - c("~", "\\\\~{}"), - c('"', "\\\\textquotedbl{}"), + list(c("([{}])", "\\\\\\1"), + c("\\\\(?![{}])", "\\\\textbackslash{}"), + c("\\^", "\\\\textasciicircum{}"), + c("~", "\\\\textasciitilde{}"), + c("<", "\\\\textless{}"), + c(">", "\\\\textgreater{}"), + c("\\|", "\\\\textbar{}"), + c("([#$%&_])", "\\\\\\1"), + if (isTRUE(dashdash)) { + c("-", "\\\\mbox{-}") + }, + if (textcomp && straightQuotes) { + c("'", "\\\\textquotesingle{}") + }, + if (textcomp && straightQuotes) { + c("`", "\\\\textasciigrave{}") + }, + c('"', if (fontenc && straightQuotes) { + "\\\\textquotedbl{}" + } else { + "\\\\textquotedblright{}" + }), c("/", "\\\\slash{}")) + substitutions <- substitutions[!vapply(substitutions, is.null, logical(1))] + + ## Treatment of non-ASCII characters follows. + + ## Digraphs and ligatures broken into their parts, except the + ## Dutch digraphs IJ and ij which have their own commands. + substitutions <- + c(substitutions, + list(c("\u0132", "\\\\IJ{}"), + c("\u0133", "\\\\ij{}"), + c("\u01f1", "DZ"), + c("\u01f2", "Dz"), + c("\u01f3", "dz"), + c("\u01c4", "DZ\u030c"), + c("\u01c5", "Dz\u030c"), + c("\u01c6", "dz\u030c"), + c("\u01c7", "LJ"), + c("\u01c8", "Lj"), + c("\u01c9", "lj"), + c("\u01ca", "NJ"), + c("\u01cb", "Nj"), + c("\u01cc", "nj"), + c("\ufb00", "ff"), + c("\ufb01", "fi"), + c("\ufb02", "fl"), + c("\ufb03", "ffi"), + c("\ufb04", "ffl"), + c("\ufb05", "\u017ft"), + c("\ufb06", "st"))) + + ## Accents (diacritics) above the letter (drop i and j dots) + above <- list(diaeresis = c("\u0308", "\""), + acute = c("\u0301", "'"), + dotabove = c("\u0307", "."), + macron = c("\u0304", "="), + circumflex = c("\u0302", "^"), + grave = c("\u0300", "`"), + tilde = c("\u0303", "~"), + doubleacute = c("\u030b", "H"), + ringabove = c("\u030a", "r"), + breve = c("\u0306", "u"), + caron = c("\u030c", "v"), + invbreve = c("\u0311", "newtie")) # textcomp + ## Accents that co-exist with i and j dots (mainly below the + ## letter, but also the ligature tie) + below <- list(macronbelow = c("\u0331", "b"), + cedilla = c("\u0327", "c"), + dotbelow = c("\u0323", "d"), + tie = c("\u0361", "t"), + ogonek = c("\u0328", "k")) # not in OT1 fontenc + accents <- c(above, below) + command <- paste0("\\\\[", Letters, "]+|\\\\.") + combining <- paste0(vapply(accents, "[", character(1), 1), + collapse="") + accPre <- paste0("(", command, "|.)({})?(? Author: andybunn Date: 2014-12-24 00:12:16 +0100 (Wed, 24 Dec 2014) New Revision: 929 Modified: pkg/dplR/R/crn.plot.R pkg/dplR/man/crn.plot.Rd Log: small plot changes. Modified: pkg/dplR/R/crn.plot.R =================================================================== --- pkg/dplR/R/crn.plot.R 2014-12-23 20:31:53 UTC (rev 928) +++ pkg/dplR/R/crn.plot.R 2014-12-23 23:12:16 UTC (rev 929) @@ -1,14 +1,14 @@ `plot.crn` <- function(x, ...){ crn.plot(crn=x, ...) } `crn.plot` <- function(crn, add.spline=FALSE, nyrs=NULL, f=0.5, - crn.line.col='grey50', - spline.line.col='red', - samp.depth.col='grey90', - samp.depth.border.col='grey80', - crn.lwd=1, spline.lwd=1.5, - abline.pos=1, abline.col='black', - abline.lty=1, abline.lwd=1, - ...) { + crn.line.col='grey50', + spline.line.col='red', + samp.depth.col='grey90', + samp.depth.border.col='grey80', + crn.lwd=1, spline.lwd=1.5, + abline.pos=1, abline.col='black', + abline.lty=1, abline.lwd=1, + ...) { if(!is.data.frame(crn)) stop("'crn' must be a data.frame") op <- par(no.readonly=TRUE) # Save par Modified: pkg/dplR/man/crn.plot.Rd =================================================================== --- pkg/dplR/man/crn.plot.Rd 2014-12-23 20:31:53 UTC (rev 928) +++ pkg/dplR/man/crn.plot.Rd 2014-12-23 23:12:16 UTC (rev 929) @@ -57,19 +57,18 @@ } \examples{data(cana157) crn.plot(cana157,xlab='Year',ylab='RWI') -plot(cana157,xlab='Year',ylab='RWI') +plot(cana157,xlab='Year',ylab='RWI', main='Twisted Tree Heartrot Hill') # with added spline crn.plot(cana157,add.spline=TRUE, nyrs=32, xlab='Year',ylab='RWI') ## Without sample depth cana157.mod <- cana157 cana157.mod$samp.depth <- NULL crn.plot(cana157.mod, add.spline = TRUE, xlab='Year',ylab='RWI') -## With multiple chronologies -data(gp.rwl) -data(gp.po) -gp.rwi <- cms(rwl = gp.rwl, po = gp.po) -gp.crn <- chron(gp.rwi,prefix="GP",prewhiten=TRUE) -crn.plot(gp.crn, add.spline = TRUE) +## A raw ring-width chronology +data(ca533) +ca533.raw.crn <- chron(ca533, prefix = "CAM", prewhiten=TRUE) +plot(ca533.raw.crn,abline.pos=NULL,ylab='mm',xlab='Year') + \dontrun{ # not pretty - but illustrates the coloring options my.cols <- c("#3182BD","#9ECAE1","#DEEBF7","#31A354","#A1D99B","#E5F5E0") @@ -80,11 +79,8 @@ samp.depth.border.col=my.cols[2], abline.col=my.cols[1], crn.lwd=1.5,spline.lwd=3, - abline.lwd=1) - # a raw ring-width chronology - data(ca533) - ca533.raw.crn <- chron(ca533, prefix = "CAM") - crn.plot(ca533.raw.crn,abline.pos=NULL,ylab='mm') + abline.lwd=1, + xlab="Year", ylab="RWI") } } \keyword{ hplot } From noreply at r-forge.r-project.org Wed Dec 31 09:35:52 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 31 Dec 2014 09:35:52 +0100 (CET) Subject: [Dplr-commits] r930 - in pkg/dplR: . inst/unitTests Message-ID: <20141231083552.5DC41187962@r-forge.r-project.org> Author: mvkorpel Date: 2014-12-31 09:35:50 +0100 (Wed, 31 Dec 2014) New Revision: 930 Modified: pkg/dplR/DESCRIPTION pkg/dplR/inst/unitTests/runit.dplR.R Log: Adjusted the tests of corr.series.seg(), hoping to fix the failure on solaris-sparc. Version 1.6.2 Modified: pkg/dplR/DESCRIPTION =================================================================== --- pkg/dplR/DESCRIPTION 2014-12-23 23:12:16 UTC (rev 929) +++ pkg/dplR/DESCRIPTION 2014-12-31 08:35:50 UTC (rev 930) @@ -2,8 +2,8 @@ Package: dplR Type: Package Title: Dendrochronology Program Library in R -Version: 1.6.1 -Date: 2014-12-23 +Version: 1.6.2 +Date: 2014-12-31 Authors at R: c(person("Andy", "Bunn", role = c("aut", "cph", "cre", "trl"), email = "andy.bunn at wwu.edu"), person("Mikko", "Korpela", role = c("aut", "trl")), person("Franco", "Biondi", Modified: pkg/dplR/inst/unitTests/runit.dplR.R =================================================================== --- pkg/dplR/inst/unitTests/runit.dplR.R 2014-12-23 23:12:16 UTC (rev 929) +++ pkg/dplR/inst/unitTests/runit.dplR.R 2014-12-31 08:35:50 UTC (rev 930) @@ -476,24 +476,22 @@ checkTrue(!isTRUE(all.equal(res7$spearman.rho, res8$spearman.rho)), msg="Segment correlations differ between methods (test 3)") - tmp7 <- na.omit(res7$moving.rho[, "rho"]) + tmp7 <- as.vector(na.omit(res7$moving.rho[, "rho"])) checkTrue(length(tmp7) == 451, msg = "Number of non-NA correlations (test 1)") - uniqueRho7 <- unique(tmp7) - checkTrue(length(uniqueRho7) == 1, - msg = "Correlation when segment length matches the common cycle of rwl and series") + checkEquals(rep(mean(tmp7), 451), tmp7, + msg = "Correlation when segment length matches the common cycle of rwl and series") tmp9 <- na.omit(res9$moving.rho[, "rho"]) checkTrue(length(tmp9) == 453, msg = "Number of non-NA correlations (test 2)") uniqueRho9 <- unique(tmp9) checkTrue(length(uniqueRho9) == 50, msg = "Correlations for rwl and series with a common cycle, shorter segments") - tmp10 <- na.omit(res10$moving.rho[, "rho"]) + tmp10 <- as.vector(na.omit(res10$moving.rho[, "rho"])) checkTrue(length(tmp10) == 401, msg = "Number of non-NA correlations (test 3)") - uniqueRho10 <- unique(tmp10) - checkTrue(length(uniqueRho10) == 1, - msg = "Correlation when segment length is a multiple of the length of the common cycle of rwl and series") + checkEquals(rep(mean(tmp10), 401), tmp10, + msg = "Correlation when segment length is a multiple of the length of the common cycle of rwl and series") tmp11 <- na.omit(res11$moving.rho[, "rho"]) checkTrue(length(tmp11) == 359, msg = "Number of non-NA correlations (test 4)")