syntactical meaning of fullstop in R functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

syntactical meaning of fullstop in R functions

Kay Cichini
hello,

what is the meaning of a fullstop in the below R-Ffunction (like in '.GADM')

> library(dismo)
Lade nötiges Paket: raster
Warnmeldungen:
1: Paket ‘dismo’ wurde unter R Version 2.15.3 erstellt
2: Paket ‘raster’ wurde unter R Version 2.15.3 erstellt
> getData
function (name = "GADM", download = TRUE, path = "", ...)
{
    path <- .getDataPath(path)
    if (name == "GADM") {
        .GADM(..., download = download, path = path)
    }
    else if (name == "SRTM") {
        .SRTM(..., download = download, path = path)
    }
    else if (name == "alt") {
        .raster(..., name = name, download = download, path = path)
    }
    else if (name == "worldclim") {
        .worldclim(..., download = download, path = path)
    }
    else if (name == "ISO3") {
        .ISO()[, c(2, 1)]
    }
    else if (name == "countries") {
        .countries(download = download, path = path, ...)
    }
    else {
        stop(name, " not recognized as a valid name.")
    }
}
<bytecode: 0x10f6e5ac>
<environment: namespace:raster>

thanks in advance,
kay

--

Kay Cichini, MSc Biol

Grubenweg 22, 6071 Aldrans

Tel.: 0650 9359101

E-Mail: [hidden email]

Web: www.theBioBucket.blogspot.co.at<http://www.thebiobucket.blogspot.co.at/><http://www.theBioBucket.blogspot.co.at>
--

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: syntactical meaning of fullstop in R functions

Kay Cichini
just found it myself:

in '.GADM' the leading period designates an internal function - the source
can be viewed with:
getAnywhere('.GADM')



2013/7/12 Kay Cichini <[hidden email]>

> hello,
>
> what is the meaning of a fullstop in the below R-Ffunction (like in
> '.GADM')
>
> > library(dismo)
> Lade nötiges Paket: raster
> Warnmeldungen:
> 1: Paket ‘dismo’ wurde unter R Version 2.15.3 erstellt
> 2: Paket ‘raster’ wurde unter R Version 2.15.3 erstellt
> > getData
> function (name = "GADM", download = TRUE, path = "", ...)
> {
>     path <- .getDataPath(path)
>     if (name == "GADM") {
>         .GADM(..., download = download, path = path)
>     }
>     else if (name == "SRTM") {
>         .SRTM(..., download = download, path = path)
>     }
>     else if (name == "alt") {
>         .raster(..., name = name, download = download, path = path)
>     }
>     else if (name == "worldclim") {
>         .worldclim(..., download = download, path = path)
>     }
>     else if (name == "ISO3") {
>         .ISO()[, c(2, 1)]
>     }
>     else if (name == "countries") {
>         .countries(download = download, path = path, ...)
>     }
>     else {
>         stop(name, " not recognized as a valid name.")
>     }
> }
> <bytecode: 0x10f6e5ac>
> <environment: namespace:raster>
>
> thanks in advance,
> kay
>
> --
>
> Kay Cichini, MSc Biol
>
> Grubenweg 22, 6071 Aldrans
>
> Tel.: 0650 9359101
>
> E-Mail: [hidden email]
>
> Web: www.theBioBucket.blogspot.co.at<http://www.thebiobucket.blogspot.co.at/><http://www.theBioBucket.blogspot.co.at>
> --
>


--

Kay Cichini, MSc Biol

Grubenweg 22, 6071 Aldrans

Tel.: 0650 9359101

E-Mail: [hidden email]

Web: www.theBioBucket.blogspot.co.at<http://www.thebiobucket.blogspot.co.at/><http://www.theBioBucket.blogspot.co.at>
--

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: syntactical meaning of fullstop in R functions

Rolf Turner-3
On 13/07/13 08:57, Kay Cichini wrote:
> just found it myself:
>
> in '.GADM' the leading period designates an internal function - the source
> can be viewed with:
> getAnywhere('.GADM')

I think that's a bit misleading.  In general, the names of functions (or
other objects) which
are "internal" to a package need *not* begin with a full stop.  That is
just a convention that
the author of the "dismo" package is using.  What makes an object
"internal" really is
not being exported in the NAMESPACE of the package.

The general impact of beginning the name of an object with a full stop
is to make that
object "invisible" to ls().  I.e. if you do an ls() of the environment
in which that object
"lives" then you will *not* see the name of that object unless you do

     ls(.....,all.names=TRUE)

See help(ls).

     cheers,

         Rolf Turner

______________________________________________
[hidden email] 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.