* using log directory 'd:/Rcompile/CRANpkg/local/2.11/rangeMapper.Rcheck' * using R version 2.11.1 Patched (2010-07-29 r52657) * using session charset: ISO8859-1 * checking for file 'rangeMapper/DESCRIPTION' ... OK * this is package 'rangeMapper' version '0.0-6' * checking package name space information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking whether package 'rangeMapper' can be installed ... OK * checking package directory ... OK * checking for portable file names ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the name space can be loaded with stated dependencies ... OK * checking whether the name space can be unloaded cleanly ... OK * checking for unstated dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... NOTE .X.chooseFunction: no visible binding for global variable '.RangeMapper' .X.chooseSubset: no visible binding for global variable '.RangeMapper' .X.chooseSubset : OnOK: no visible binding for '<<-' assignment to 'Out' .X.chooseSubset: no visible binding for global variable 'Out' .X.chooseVariable: no visible binding for global variable '.RangeMapper' .X.close: no visible binding for global variable '.RangeMapper' .X.exists: no visible binding for global variable '.RangeMapper' .X.get: no visible binding for global variable '.RangeMapper' .X.put: no visible binding for global variable '.RangeMapper' .X.rangeMap.rm: no visible binding for global variable 'out' .X.tkColorPalette: no visible binding for global variable '.RangeMapper' .X.tkComboEntryBox: no visible binding for global variable '.RangeMapper' .X.tkdbBrowse.active.proj: no visible binding for global variable 'out' bio.merge: no visible binding for global variable 'dbcon' bio.merge : : no visible binding for global variable 'dbcon' rangeMap.export: no visible binding for global variable 'CON' tkMakeColorPalette: no visible binding for '<<-' assignment to 'out' tkMakeColorPalette : PickColor: no visible binding for '<<-' assignment to 'out' tkMakeColorPalette : PickColor: no visible binding for global variable 'out' tkMakeColorPalette : onOK: no visible binding for global variable 'out' tkMakeColorPalette : onOK: no visible binding for '<<-' assignment to 'out' tkMakeColorPalette: no visible binding for global variable 'out' * checking Rd files ... WARNING checkRd: (5) RMQuery.Rd:6: \title content must be plain text checkRd: (5) bioSave.Rd:8: \title content must be plain text checkRd: (5) gridSize.Rd:5: \title content must be plain text checkRd: (5) rangeMapExport.Rd:9-10: \title content must be plain text checkRd: (5) rangeMapFetch.Rd:7: \title content must be plain text * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking data for non-ASCII characters ... OK * checking examples ... ERROR Running examples in 'rangeMapper-Ex.R' failed. The error most likely occurred in: > ### * rangeMapper > > flush(stderr()); flush(stdout()) > > ### Name: rangeMapper > ### Title: rangeMapper: A platform for the study of macroecology of life > ### history traits. > ### Aliases: rangeMapper > ### Keywords: package spatial macroecology spatial gui tcltk > > ### ** Examples > > ######################################### > > require(rangeMapper) > > # Start or open a project > wd = tempdir() > > # open the GUI, messages will be re-directed here > if(interactive() ) rangeMapper() > > dbcon = rangeMap.start(file = "wrens.sqlite", + overwrite = TRUE, dir = tempdir() ) »» New session 2011-04-13 22:06:08 »» PROJECT: wrens.sqlite DIRECTORY: d:\temp\Rtmp4yVWJ3 > > # To connect latter to the project created with rangeMap.start use > dbcon = rangeMap.open(path = + paste(tempdir(), "wrens.sqlite" , sep = .Platform$file.sep) ) »» 2011-04-13 22:06:08 > > # Project summary > summary(new("rangeMap", CON = dbcon) ) »» class : rangeMap Project_location : d:\temp\Rtmp4yVWJ3/wrens.sqlite SQLite_version : 3.7.3 empty_project : Empty rangeMapper project. > > # Breeding range vector files location > f = system.file(package = "rangeMapper", + "extdata", "wrens", "vector") > > # There are several alternatives to save the global bounding box, > # a few are exemplified below > # The default creates a global unprojected bounding box > global.bbox.save(con = dbcon) »» Using unprojected global bouging box [ -180,180,-90,90 ]... »» Bounding box uploaded. PROJ4STRING set to +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs > > # Creating a global bbox using the breeding range vector files > > # manually remove all data from the bbox and proj4string table > RMQuery(dbcon, 'DELETE from bbox') NULL > RMQuery(dbcon, 'DELETE from proj4string') NULL > > global.bbox.save(con = dbcon, bbox = f) »» computing global bouding box for 84 ranges... »» Checking for proj4 string differences... »» Done! »» Bounding box uploaded. PROJ4STRING set to +proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs > > plot( global.bbox.fetch(dbcon) , axes = TRUE) > > # Creating a global bbox using the breeding range vector files > # and re-projecting > # manually remove all data from the bbox table > RMQuery(dbcon, 'DELETE from bbox') NULL > RMQuery(dbcon, 'DELETE from proj4string') NULL > > global.bbox.save(con = dbcon,bbox = f, + p4s = + CRS(" +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs")) »» computing global bouding box for 84 ranges... »» Checking for proj4 string differences... »» Done! »» Converting to +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs »» Bounding box uploaded. PROJ4STRING set to +proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs > > > # upload grid size using the default > gridSize.save(dbcon) »» Default grid size used! »» Grid size set to 124352.875601879 map units. > > # upload grid size to 100000 sqm > RMQuery(dbcon, 'DELETE from gridSize') NULL > gridSize.save(dbcon, gridSize = 100000) »» Grid size set to 1e+05 map units. > > # save canvas > canvas.save(dbcon) »» Canvas uploaded. > summary(canvas.fetch(dbcon) ) Object of class SpatialPixelsDataFrame Coordinates: min max x -15894530 -3494530 y -6063326 6436674 Is projected: TRUE proj4string : [+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs] Number of points: 15500 Grid attributes: cellcentre.offset cellsize cells.dim x -15844530 1e+05 124 y -6013326 1e+05 125 Data attributes: Min. 1st Qu. Median Mean 3rd Qu. Max. 1 3876 7750 7750 11630 15500 > > # Process ranges & BIO tables > > # first define a new range structure function > > APratio = function(x) { + # returns 1 for a circle polygon + # area + A = sapply(slot(x, "polygons"), + function(x) slot(x, "area") ) + + # perimeter + a = lapply(slot(x, "polygons"), + function(x) slot(x, "Polygons") ) + b = do.call(c, a) + a1 = lapply(b, function(x) + Line(coordinates(x))) + L = sapply(a1, LineLength) + + # A-P ratio + 2*(sqrt(pi*sum(A)))/sum(L) + + } > > > # the APratio function will also be computed together with the pre-defined functions > processRanges(dir = f, con = dbcon, metadata = TRUE, APratio) »» Processsing ranges, please wait!... Range: Campylorhynchus_albobrunneus 1.19 % done Elapsed time: 0 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_brunneicapillus 2.38 % done Elapsed time: 0 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_chiapensis 3.57 % done Elapsed time: 0 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_fasciatus 4.76 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_griseus 5.95 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_gularis 7.14 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_jocosus 8.33 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_megalopterus 9.52 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_nuchalis 10.71 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_rufinucha 11.9 % done Elapsed time: 0.1 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_turdinus 13.1 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_yucatanicus 14.29 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Campylorhynchus_zonatus 15.48 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Catherpes_mexicanus 16.67 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Cinnycerthia_fulva 17.86 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Cinnycerthia_olivascens 19.05 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Cinnycerthia_peruana 20.24 % done Elapsed time: 0.2 mins »» Processsing ranges, please wait!... Range: Cinnycerthia_unirufa 21.43 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cistothorus_apolinari 22.62 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cistothorus_meridae 23.81 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cistothorus_palustris 25 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cistothorus_platensis 26.19 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cyphorhinus_aradus 27.38 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cyphorhinus_phaeocephalus 28.57 % done Elapsed time: 0.3 mins »» Processsing ranges, please wait!... Range: Cyphorhinus_thoracicus 29.76 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Ferminia_cerverai 30.95 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Henicorhina_leucophrys 32.14 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Henicorhina_leucoptera 33.33 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Henicorhina_leucosticta 34.52 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Henicorhina_negreti 35.71 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Hylorchilus_navai 36.9 % done Elapsed time: 0.4 mins »» Processsing ranges, please wait!... Range: Hylorchilus_sumichrasti 38.1 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Microcerculus_bambla 39.29 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Microcerculus_marginatus 40.48 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Microcerculus_philomela 41.67 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Microcerculus_ustulatus 42.86 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Odontorchilus_branickii 44.05 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Odontorchilus_cinereus 45.24 % done Elapsed time: 0.5 mins »» Processsing ranges, please wait!... Range: Salpinctes_obsoletus 46.43 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryomanes_bewickii 47.62 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryorchilus_browni 48.81 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryothorus_albinucha 50 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryothorus_atrogularis 51.19 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryothorus_coraya 52.38 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryothorus_eisenmanni 53.57 % done Elapsed time: 0.6 mins »» Processsing ranges, please wait!... Range: Thryothorus_euophrys 54.76 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_fasciatoventris 55.95 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_felix 57.14 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_genibarbis 58.33 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_griseus 59.52 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_guarayanus 60.71 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_leucopogon 61.9 % done Elapsed time: 0.7 mins »» Processsing ranges, please wait!... Range: Thryothorus_leucotis 63.1 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_longirostris 64.29 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_ludovicianus 65.48 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_maculipectus 66.67 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_modestus 67.86 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_mystacalis 69.05 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_nicefori 70.24 % done Elapsed time: 0.8 mins »» Processsing ranges, please wait!... Range: Thryothorus_nigricapillus 71.43 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_pleurostictus 72.62 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_rufalbus 73.81 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_rutilus 75 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_sclateri 76.19 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_semibadius 77.38 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_sinaloa 78.57 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_spadix 79.76 % done Elapsed time: 0.9 mins »» Processsing ranges, please wait!... Range: Thryothorus_superciliaris 80.95 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Thryothorus_thoracicus 82.14 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Thryothorus_zeledoni 83.33 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Troglodytes_aedon 84.52 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Troglodytes_beani 85.71 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Troglodytes_brunneicollis 86.9 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Troglodytes_cobbi 88.1 % done Elapsed time: 1 mins »» Processsing ranges, please wait!... Range: Troglodytes_monticola 89.29 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_musculus 90.48 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_ochraceus 91.67 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_rufociliatus 92.86 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_rufulus 94.05 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_sissonii 95.24 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_solstitialis 96.43 % done Elapsed time: 1.1 mins »» Processsing ranges, please wait!... Range: Troglodytes_tanneri 97.62 % done Elapsed time: 1.2 mins »» Processsing ranges, please wait!... Range: Troglodytes_troglodytes 98.81 % done Elapsed time: 1.2 mins »» Processsing ranges, please wait!... Range: Uropsila_leucogastra 100 % done Elapsed time: 1.2 mins »» 84 ranges updated to database; Elapsed time: 1.2 mins > > > # Manage BIO tables > csvfile = system.file(package="rangeMapper", "data", "wrens.csv") > bio.save(con = dbcon, loc = csvfile , ID = "sci_name") »» Table wrens_csv saved as a BIO_ table > > rm.rangeMapper(con = dbcon, tablePrefix = "BIO") »» BIO_wrens_csv removed > > data(wrens) > bio.save(con = dbcon, loc = wrens, ID = "sci_name") »» Table wrens saved as a BIO_ table > > # metadata_ranges table can be merged with the wrens table > metadata2bio(dbcon) »» Table metadata_ranges saved as a BIO_ table > bio.merge(dbcon, tableNam = "wrensRanges", + "wrens", "metadata_ranges") NULL > > > # Save MAPs > rangeMap.save(dbcon) #species richness is the default > > #Using sqlite aggregate functions > .sqlAggregate() _ avg avg stdev stdev variance variance mode mode median median lower_quartile lower_quartile upper_quartile upper_quartile sum total max max min min count total > rangeMap.save(dbcon, FUN = "median" , biotab = "wrens", + biotrait = "body_size", tableName = "body_size") [1] TRUE > > rangeMap.save(dbcon, FUN = "median" , + biotab = "metadata_ranges", biotrait = "V1", tableName = "APratio") [1] TRUE > > #Using an R function which does not require a formula argument > rangeMap.save(dbcon, FUN = mean , biotab = "wrens", + biotrait = "clutch_size", tableName = "clutch_size", + na.rm = TRUE, overwrite = TRUE) [1] TRUE > > #Using an user defined R function which has a formula argument > lmSlope = function (formula, data) { + fm = try(lm(formula, data = data), silent = TRUE) + if (inherits(fm, "try-error")) + res = NA else + res = coef(fm)[2] + as.numeric(res) + } > > # Map of log(body_mass) ~ clutch_size only for species richness > 10 > rangeMap.save(dbcon, FUN = lmSlope, biotab = "wrens", + biotrait = "body_mass", + tableName = "slope_body_mass_clutchSize", + formula = log(body_mass) ~ clutch_size , overwrite = TRUE, + list(MAP_species_richness = "species_richness > 5") + ) [1] TRUE > > > # rangeMap.save can be also used to import raster maps the current project > r = system.file(package = "rangeMapper", + "extdata", "etopo1", "etopo1_Americas.tif") > > rangeMap.save(dbcon, path = r, tableName = 'meanAltitude', + FUN = mean , overwrite = TRUE) Loading required package: raster raster version 1.8-12 (11-April-2011) Attaching package: 'raster' The following object(s) are masked from 'package:e1071': interpolate »» Converting canvas to polygons... »» Loading external MAP data... »» Extracting Layer 1... »» Performing overlay: canvas polygons over etopo1_Americas.tif ... »» Agregating data... »» Creating table and indexes... »» 'etopo1_Americas.tif' imported > > # rangeMap.save takes a subset argument on both > # metadata_ranges, MAP and BIO tables > > # clutch size of the highland species > rangeMap.save(dbcon, biotab = "wrens", biotrait = "clutch_size", + tableName = "highlandClutch", overwrite = TRUE, + subset = list(MAP_meanAltitude = "meanAltitude > 2000") ) > > # clutch size of restricted range lowland species > rangeMap.save(dbcon, biotab = "wrens", biotrait = "clutch_size", + tableName = "endemicsLowlandClutch", overwrite = TRUE, + subset = list(MAP_meanAltitude = "meanAltitude < 1000", + metadata_ranges = "Area < 100000000000") ) > > > # Fetch and plot Maps > > plot(rangeMap.fetch(dbcon, 'species_richness') ,n = 10, style = "fisher") > > plot(rangeMap.fetch(dbcon, "APratio"), style = "equal" ) > plot(rangeMap.fetch(dbcon, 'meanAltitude'), style = "quantile") > > clutch = rangeMap.fetch(dbcon, + c('clutch_size', 'slope_body_mass_clutchSize', 'body_size') ) > plot(clutch, style = "fisher") > > plot(rangeMap.fetch(dbcon, 'highlandClutch'), n = 4) > > > image(rangeMap.fetch(dbcon, 'meanAltitude') ) Error in image.default(rangeMap.fetch(dbcon, "meanAltitude")) : argument must be matrix-like Calls: image -> image -> image.default Execution halted