### SlideShare for iOS

by Linkedin Corporation

FREE - On the App Store

Loading…

Flash Player 9 (or above) is needed to view presentations.

We have detected that you do not have it on your computer. To install it, go here.

The following presentation contains some basic introduction materials for R beginners.

The following presentation contains some basic introduction materials for R beginners.

- Total Views
- 4,770
- Views on SlideShare
- 4,763
- Embed Views

- Likes
- 3
- Downloads
- 131
- Comments
- 0

http://www.linkedin.com | 4 |

https://www.linkedin.com | 3 |

- 1. R crash course T. Hengl & R.S. Bivand R crash course Overview Course programme (for people who pick up new methods/tools quickly Why R? Software installation and have a high motivation to learn) Scripting in R Do’s and don’ts R code editors Working with T. Hengl1 & R.S. Bivand2 spatial data Spatial classes Spatial methods 1 Instituut voor Biodiversiteit en Ecosysteem Dynamica R+SAGA R+FWTools Universiteit van Amsterdam Export to Google Earth 2 Department of Economics Literature Norwegian School of Economics and Business administration June 19, 2010
- 2. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 3. Programme R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Installation and ﬁrst (baby) steps (intro.R). Do’s and don’ts R code editors Building, running and editing models in R. Working with spatial data Working with spatial data. Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 4. Crash course R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation A “crash course” is a compressed version of a training course for Scripting in R people that already have full agendas. It is really intended for Do’s and don’ts R code editors people who pick up new methods/tools quickly and have a high Working with motivation to learn (PhD students?). This means no long spatial data Spatial classes questions, no going back, no long discussion, no complains Spatial methods about the speed/programme of the course. . . and of course: no R+SAGA R+FWTools promises that you will manage to learn R in such a short time. Export to Google Earth Literature
- 5. The course programme R crash course Basic concepts (self-study) T. Hengl & R.S. Bivand R basic and add-on packages; Overview R syntax; R objects and ’methods’; Course programme Why R? R FAQs; getting help and the most important literature; Software installation Scripting in R Scripting in R Do’s and don’ts R code editors data management; creating and debugging scripts Working with (scripting editors: Tinn-R); spatial data Spatial classes automating analysis — making functions and packages; Spatial methods R+SAGA publication quality outputs (using R+Sweave); R+FWTools Export to Google Earth Advanced topics Literature GDAL and R; spatial classes and packages; calling external applications from R (SAGA GIS, FWTools, Python, Matlab; export of maps to Google Earth;
- 6. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 7. Getting the right motivation (inspiration) R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation What is R, and why should you invest time to learn it? Scripting in R Do’s and don’ts What can it do? (and what it can’t do?) R code editors Working with How does the R community works (what are its shared spatial data principles)? Spatial classes Spatial methods R+SAGA Is R suited for spatio-temporal data analysis? R+FWTools Export to Google Earth Literature
- 8. Some important assumptions R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation R is (increasingly) sexy. Scripting in R Do’s and don’ts R is hell. R code editors You are all beginners (who need a gentle intro). Working with spatial data Spatial classes You are non-statisticians / computer scientists. Spatial methods R+SAGA I learned R myself. If I can do it, you can do it too. R+FWTools Export to Google Earth Literature
- 9. Some important assumptions R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation R is (increasingly) sexy. Scripting in R Do’s and don’ts R is hell. R code editors You are all beginners (who need a gentle intro). Working with spatial data Spatial classes You are non-statisticians / computer scientists. Spatial methods R+SAGA I learned R myself. If I can do it, you can do it too. R+FWTools Export to Google Earth Literature
- 10. Some important assumptions R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation R is (increasingly) sexy. Scripting in R Do’s and don’ts R is hell. R code editors You are all beginners (who need a gentle intro). Working with spatial data Spatial classes You are non-statisticians / computer scientists. Spatial methods R+SAGA I learned R myself. If I can do it, you can do it too. R+FWTools Export to Google Earth Literature
- 11. Some important assumptions R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation R is (increasingly) sexy. Scripting in R Do’s and don’ts R is hell. R code editors You are all beginners (who need a gentle intro). Working with spatial data Spatial classes You are non-statisticians / computer scientists. Spatial methods R+SAGA I learned R myself. If I can do it, you can do it too. R+FWTools Export to Google Earth Literature
- 12. Some important assumptions R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation R is (increasingly) sexy. Scripting in R Do’s and don’ts R is hell. R code editors You are all beginners (who need a gentle intro). Working with spatial data Spatial classes You are non-statisticians / computer scientists. Spatial methods R+SAGA I learned R myself. If I can do it, you can do it too. R+FWTools Export to Google Earth Literature
- 13. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 14. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 15. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 16. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 17. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 18. What is R? R crash course T. Hengl & the open source implementation of the S language for R.S. Bivand statistical computing created by created by Ross Ihaka Overview and Robert Gentleman (now maintained by the R Course programme Why R? Development Core Team); Software installation Scripting in R why R?: the name “R” was selected for two reasons: (1) Do’s and don’ts precedence — “R” is a letter before “S”, and (2) coincidence R code editors Working with — both of the creators’ names start with a letter “R” ; spatial data Spatial classes it is a computer language developed to simplify statistical Spatial methods R+SAGA computing/programming; R+FWTools Export to Google it oﬀers many contributed packages, technical documents, Earth demos and examples; Literature widely recognized as one of the fastest growing and most comprehensive statistical computing tools; it is a movement;
- 19. R is “sexy” R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 20. Quote R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation “ R has really become the second language for people Scripting in R coming out of grad school now, and there’s an Do’s and don’ts R code editors amazing amount of code being written for it.” Working with spatial data Spatial classes Spatial methods Max Kuhn R+SAGA R+FWTools Export to Google Earth Literature
- 21. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 22. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 23. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 24. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 25. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 26. What it is NOT R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? it’s not a software with GUI and point-and-click control; Software installation there are practically no data analysis wizards; Scripting in R Do’s and don’ts it’s not an interactive system; R code editors Working with it comes with no warranties (but so does the commercial spatial data Spatial classes software too!!); Spatial methods R+SAGA there is practically no formal support; R+FWTools Export to Google Earth however. . . Literature
- 27. Why make scripts? R crash course T. Hengl & R.S. Bivand It’s easy to use: “Because S (and its implementation R) is a well-developed, simple and eﬀective programming Overview Course programme language which includes conditionals, loops, user-deﬁned Why R? Software installation recursive functions and input and output facilities, existing Scripting in R functions can be modiﬁed.” In R we all become Do’s and don’ts R code editors programmers (but much faster than with C++ or Java). Working with spatial data The basic approach to using R is to generate scripts that Spatial classes deﬁne the data processing steps (workﬂows?). Spatial methods R+SAGA R+FWTools Documenting the analysis process is a “good thing” so, Export to Google Earth programming scripts are not just a burden, certainly for Literature users doing original research and repetitive work, arguably for student classes too. Point-and-click operations are for amateurs.
- 28. Why make scripts? R crash course T. Hengl & R.S. Bivand It’s easy to use: “Because S (and its implementation R) is a well-developed, simple and eﬀective programming Overview Course programme language which includes conditionals, loops, user-deﬁned Why R? Software installation recursive functions and input and output facilities, existing Scripting in R functions can be modiﬁed.” In R we all become Do’s and don’ts R code editors programmers (but much faster than with C++ or Java). Working with spatial data The basic approach to using R is to generate scripts that Spatial classes deﬁne the data processing steps (workﬂows?). Spatial methods R+SAGA R+FWTools Documenting the analysis process is a “good thing” so, Export to Google Earth programming scripts are not just a burden, certainly for Literature users doing original research and repetitive work, arguably for student classes too. Point-and-click operations are for amateurs.
- 29. Why make scripts? R crash course T. Hengl & R.S. Bivand It’s easy to use: “Because S (and its implementation R) is a well-developed, simple and eﬀective programming Overview Course programme language which includes conditionals, loops, user-deﬁned Why R? Software installation recursive functions and input and output facilities, existing Scripting in R functions can be modiﬁed.” In R we all become Do’s and don’ts R code editors programmers (but much faster than with C++ or Java). Working with spatial data The basic approach to using R is to generate scripts that Spatial classes deﬁne the data processing steps (workﬂows?). Spatial methods R+SAGA R+FWTools Documenting the analysis process is a “good thing” so, Export to Google Earth programming scripts are not just a burden, certainly for Literature users doing original research and repetitive work, arguably for student classes too. Point-and-click operations are for amateurs.
- 30. Why make scripts? R crash course T. Hengl & R.S. Bivand It’s easy to use: “Because S (and its implementation R) is a well-developed, simple and eﬀective programming Overview Course programme language which includes conditionals, loops, user-deﬁned Why R? Software installation recursive functions and input and output facilities, existing Scripting in R functions can be modiﬁed.” In R we all become Do’s and don’ts R code editors programmers (but much faster than with C++ or Java). Working with spatial data The basic approach to using R is to generate scripts that Spatial classes deﬁne the data processing steps (workﬂows?). Spatial methods R+SAGA R+FWTools Documenting the analysis process is a “good thing” so, Export to Google Earth programming scripts are not just a burden, certainly for Literature users doing original research and repetitive work, arguably for student classes too. Point-and-click operations are for amateurs.
- 31. Do you speak R? R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R After some time you basically discovered that most of the things Do’s and don’ts R code editors you want to do, you can do in R, the only question is how. Working with spatial data Well, ﬁrst, you have to learn to how to speak’n’write R. Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 32. Why NOT Matlab? R crash course T. Hengl & R.S. Bivand R and Matlab are in fact very similar, except. . . : Overview (almost) everything you do in Matlab, you can do in R; Course programme Why R? R can be used to write homework (for Matlab you need a Software installation computer lab with software licences); Scripting in R Do’s and don’ts “R gradually pushes people towards better programming R code editors habits” (Tam´s K. Papp); a Working with spatial data Spatial classes Matlab has a limited support for processing spatial data (R Spatial methods R+SAGA is better); R+FWTools Export to Google Contributed packages in R are growing faster (R is better); Earth Literature We are in academia — we shouldn’t be developing toolboxes for some private company but for the people (and for ourselves);
- 33. A bit of history R crash course T. Hengl & R.S. Bivand R was ﬁrst time released in 1997; Overview majority of the development is (still) done by prof. Brian Course programme Why R? D. Ripley; Software installation Scripting in R a the moment (juni 19 2010 10:01), there are 2387 Do’s and don’ts contributed packages! R code editors Working with according to Google trends, R-project.org has a spatial data Spatial classes community of about 200–350k active users; Spatial methods R+SAGA in 2003, a group of researchers (International Workshop on R+FWTools Export to Google Distributed Statistical Computing) decided to add Spatial Earth functionality to R; Literature . . . now is time to use it more broadly (MSc level and PhD level modules, projects, reports and scientiﬁc documents);
- 34. Quote R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? “Once methodological problems start being perceived Software installation or even deﬁned in terms of what one’s favorite Scripting in R software does well, then the software has stopped Do’s and don’ts R code editors being a tool, and has become a crutch, and at worse a Working with spatial data shackle.” Spatial classes Spatial methods R+SAGA R+FWTools Simon Jackman Export to Google Earth Literature
- 35. The ASDA(R)-book.org R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 36. The ASDA(R) team R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 37. A Practical Guide to Geostatistical Mapping R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 38. Quote R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation “I created Quick-R for one simple reason. I wanted to Scripting in R learn R and I am a teacher at heart. The easiest way Do’s and don’ts R code editors for me to learn something is to teach it” Working with spatial data Spatial classes Spatial methods Robert I. Kabacoﬀ R+SAGA R+FWTools Export to Google Earth Literature
- 39. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 40. Software R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Not all software is required to follow the exercises Software installation Scripting in R R v2.11 (Windows OS) including a list of packages; Do’s and don’ts R code editors Tinn-R v2.3 (code editor); Working with spatial data Optional: FWTools v2.4 — a list of utilities to handle Spatial classes Spatial methods spatial data; SAGA GIS v2.0.4 — a light GIS excellent for R+SAGA educational purposes. R+FWTools Export to Google Earth Literature
- 41. Installing the add-on packages R crash course T. Hengl & R.S. Bivand Overview > install.packages("ctv") Course programme > library(ctv) Why R? Software installation > install.views("Spatial") Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods This will install all connected packages listed at R views Spatial. R+SAGA R+FWTools Export to Google Earth Literature
- 42. Check your installation R crash course T. Hengl & R.S. Bivand Overview > Sys.getenv(c("OS", "COMPUTERNAME", "R_HOME", "R_LIBS_USER", Course programme Why R? + "PROCESSOR_IDENTIFIER")) Software installation OS Scripting in R "Windows_NT" Do’s and don’ts R code editors COMPUTERNAME "PC-IBED193" Working with spatial data R_HOME Spatial classes "C:PROGRA~1RR-210~1.1" Spatial methods R_LIBS_USER R+SAGA "n:/R/win-library/2.10" R+FWTools Export to Google PROCESSOR_IDENTIFIER Earth "x86 Family 6 Model 15 Stepping 6, GenuineIntel" Literature
- 43. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 44. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 45. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 46. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 47. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 48. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 49. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 50. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 51. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 52. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 53. Making friends with R R crash course T. Hengl & 1 Use script editors such as as TINN-R or JGR (syntax R.S. Bivand highlighting, wrapping, search/replace etc.). Overview 2 The best way to learn R is to look at the existing scripts, Course programme Why R? then extend: Software installation Graphical Manual/Addicted to R — if you prefer to explore Scripting in R Do’s and don’ts examples graphically; R code editors Teach-your-self books e.g. “Statistics with R” or “An Working with Introduction to R” “Introduction to R for ITC students” ; spatial data Spatial classes Quick-R and/or R by example; Spatial methods R+SAGA 3 If your R script does not work, do not break your head, try R+FWTools Export to Google to get help: Earth local installation: > help.search("kriging"); Literature R-project: > RSiteSearch("krige dimensions do not match") www: Rseek.org R mailing lists;
- 54. Good practice R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Put comments in script (after #). Software installation Scripting in R Add some meta-information at the beginning of your Do’s and don’ts script. R code editors Working with Once you tested your script and saw that it works, tidy-up spatial data Spatial classes the code. Spatial methods R+SAGA Place the input data on-line (database) so you can R+FWTools Export to Google communicate only the script. Earth Literature
- 55. R mailing lists: Do’s and Don’ts! R crash course Do’s: T. Hengl & R.S. Bivand If you have not done so already, read the R posting guide. Use the existing pre-installed data sets (come together with Overview Course programme a certain package) to describe your problem; link your Why R? Software installation problem to some existing problems. Scripting in R Acknowledge the work (time spent) other people do to help Do’s and don’ts you. R code editors You can submit not only the problems you discover but also Working with spatial data the information that you think is interesting for the Spatial classes community. Spatial methods R+SAGA Don’ts: R+FWTools Export to Google Earth Do not send poorly formulated questions. Literature Do not send too much. Complaining to a mailing list about what frustrates you about R makes no sense. You are requesting that somebody does a work for you that you could do yourself!
- 56. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 57. Tinn-R R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 58. JaGuaR R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 59. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 60. Spatial objects R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? An advantage of R (as compared to e.g. Matlab) is that you Software installation can create your own formats and structures for data. But if Scripting in R Do’s and don’ts there are too many formats you can easily get lots. In addition, R code editors we want to have smooth links to external formats (R is open!). Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools To reduce this problem, Bivand et al. (2008) developed Export to Google Earth new-style classes to represent spatial data. Literature
- 61. Spatial class R crash course T. Hengl & R.S. Bivand Overview The foundation object is the Spatial class, with just two basic Course programme Why R? slots (new-style S classes have pre-deﬁned components called Software installation slots): Scripting in R Do’s and don’ts a bounding box — mostly used for setting up plots; R code editors Working with a CRS class object — deﬁning the coordinate reference spatial data Spatial classes system, and may be set to CRS(as.character(NA)); Spatial methods R+SAGA Operations on Spatial* objects should update or copy these R+FWTools Export to Google values to the new Spatial* objects being created. The most Earth Literature basic spatial data object is a point, which may have 2 or 3 dimensions.
- 62. Spatial classes R crash course T. Hengl & R.S. Bivand Overview Course programme for point features: SpatialPoints; Why R? Software installation SpatialPointsDataFrame; Scripting in R Do’s and don’ts for line features: SpatialLines, R code editors SpatialLinesDataFrame; Working with spatial data polygons: SpatialPolygons, Spatial classes Spatial methods SpatialPolygonsDataFrame; R+SAGA R+FWTools rasters: SpatialPixels, SpatialPixelsDataFrame, Export to Google Earth SpatialGrid, SpatialGridDataFrame; Literature
- 63. SpatialPoints R crash course T. Hengl & R.S. Bivand Overview > library(sp) Course programme Why R? > data(meuse) Software installation > coords <- SpatialPoints(meuse[, c("x", "y")]) Scripting in R > summary(coords) Do’s and don’ts R code editors Object of class SpatialPoints Coordinates: Working with spatial data min max Spatial classes x 178605 181390 Spatial methods y 329714 333611 R+SAGA Is projected: NA R+FWTools Export to Google proj4string : [NA] Earth Number of points: 155 Literature
- 64. SpatialPointsDataFrame R crash course T. Hengl & R.S. Bivand We can add the tabular data to make a Overview Course programme SpatialPointsDataFrame object: Why R? Software installation Scripting in R Do’s and don’ts > meuse1 <- SpatialPointsDataFrame(coords, meuse) R code editors > str(meuse1, max.level = 2) Working with spatial data Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots Spatial classes ..@ data :'data.frame': 155 obs. of 14 variables: Spatial methods ..@ coords.nrs : num(0) R+SAGA ..@ coords : num [1:155, 1:2] 181072 181025 181165 ... R+FWTools Export to Google .. ..- attr(*, "dimnames")=List of 2 Earth ..@ bbox : num [1:2, 1:2] 178605 329714 181390 333611 Literature .. ..- attr(*, "dimnames")=List of 2 ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
- 65. Point features R crash Spatial points classes and their slots course T. Hengl & R.S. Bivand ments Overview Course programme Why R? SpatialPointsDataFrame Spatial Software installation SpatialPoints bbox Scripting in R Do’s and don’ts coords.nrs proj4string R code editors data Working with spatial data SpatialPoints Spatial classes Spatial methods data.frame coords R+SAGA Spatial R+FWTools Export to Google Earth Literature Spatial lines and polygons
- 66. Line/polygon features Spatial Polygons classes and slots R crash course T. Hengl & SpatialLines Lines Line dge Bivand R.S. lines Lines coords ma Overview Spatial ID ns programme Course Why R? Software installation Scripting in R Do’s and don’ts SpatialPolygons Polygons Polygon R code editors Working with spatial data polygons Polygons labpt Spatial classes plotOrder plotOrder area Spatial methods R+SAGA Spatial labpt hole ID R+FWTools Export to Google ringDir area coords Earth Literature Spatial bbox proj4string
- 67. Grids R crash Spatial grid and pixels classes and their slots course e bank & T. Hengl R.S. Bivand he data SpatialGridDataFrame GridTopology m Overview the Course programme SpatialGrid SpatialGrid cellcentre.offset Why R? data grid cellsize Software installation grid.index cells.dim Scripting in R Do’s and don’ts SpatialPoints R code editors Spatial Working with SpatialPixelsDataFrame bbox spatial data SpatialPixels SpatialPixels proj4string Spatial classes Spatial methods data grid R+SAGA grid.index SpatialPoints R+FWTools Export to Google SpatialPoints coords Earth Spatial Literature data.frame Spatial classes provided by sp
- 68. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 69. Basic methods R crash course T. Hengl & R.S. Bivand spplot — plotting of spatial objects (maps); Overview Course programme spsample — sample points from a set of polygons, on a Why R? Software installation set of lines or from a gridded area; Scripting in R Do’s and don’ts bbox — get the bounding box; R code editors proj4string — get or set the projection (coordinate Working with spatial data reference system); Spatial classes Spatial methods R+SAGA coordinates — set or retrieve coordinates; R+FWTools Export to Google spTransform — transform coordinates from one CRS to Earth another; Literature overlay — combine two diﬀerent spatial objects;
- 70. Plotting a SpatialPoints object R crash course T. Hengl & R.S. Bivand > plot(as(meuse1, "Spatial"), axes = TRUE) > plot(meuse1, add = TRUE) Overview > plot(meuse1[meuse1$ffreq == 1, ], col = "green", add = TRUE) Course programme Why R? Software installation Scripting in R Do’s and don’ts 333000 R code editors Working with spatial data 332000 Spatial classes Spatial methods 331000 R+SAGA R+FWTools 330000 Export to Google Earth Literature 178000 179000 180000 181000 182000
- 71. Combining statistical and GIS operations R crash course T. Hengl & R.S. Bivand Because the Spatial*DataFrame family objects behave in Overview Course programme most cases like data frames, most of what we are used to Why R? Software installation doing with standard data frames just works (but no merge, Scripting in R etc., yet). Do’s and don’ts R code editors These objects are very similar to typical representations of Working with the same kinds of objects in geographical information spatial data Spatial classes systems, so they do not suit spatial data that is not Spatial methods R+SAGA geographical (like medical imaging) as such. R+FWTools Export to Google Earth Because now sp classes for GIS data exits, this opens the Literature door for fusing GIS and statistical operations (this has not been possible in e.g. 2002).
- 72. Spatial packages R crash course T. Hengl & R.S. Bivand Overview R now oﬀers a range of contributed packages in spatial Course programme Why R? statistics and increasing awareness of the importance of spatial Software installation data analysis in the broader community. Current contributed Scripting in R Do’s and don’ts packages with spatial applications: R code editors point patterns: spatstat, VR:spatial, splancs; Working with spatial data Spatial classes geostatistics: gstat, geoR, geoRglm, ﬁelds, spBayes, Spatial methods RandomFields, VR:spatial, sgeostat, vardiag; R+SAGA R+FWTools Export to Google lattice/area data: spdep, DCluster, spgwr, ade4; Earth Literature links to GIS: rgdal, spgrass, RPy, RSAGA;
- 73. Let’s create spatial objects! R crash course T. Hengl & R.S. Bivand Overview We can create spatial objects from scratch! For example a Course programme Why R? DEM: Software installation Scripting in R Do’s and don’ts R code editors > dem <- expand.grid(x = seq(100, 600, 100), y = seq(100, Working with + 600, 100)) spatial data > dem$Z <- as.vector(c(23, 24, 34, 38, 45, 51, 24, 20, Spatial classes + 20, 28, 18, 49, 22, 20, 19, 14, 38, 45, 19, 15, 13, Spatial methods + 21, 23, 25, 14, 11, 18, 11, 18, 19, 10, 16, 23, 16, R+SAGA R+FWTools + 9, 6)) Export to Google > gridded(dem) <- ~x + y Earth > dem <- as(dem, "SpatialGridDataFrame") Literature > str(dem)
- 74. A small DEM R crash course T. Hengl & R.S. Bivand > dem.plt <- spplot(dem[1], main = "DEM", scales = list(draw = FALSE), + col.regions = topo.colors(25)) Overview > print(dem.plt) Course programme > writeGDAL(dem, "dem6.sdat", "SAGA") Why R? Software installation DEM Scripting in R Do’s and don’ts 50 R code editors Working with 40 spatial data Spatial classes Spatial methods 30 R+SAGA R+FWTools Export to Google 20 Earth Literature 10
- 75. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 76. Controlling SAGA from R R crash course T. Hengl & R.S. Bivand Overview > library(RSAGA) Course programme > rsaga.env() Why R? Software installation $workspace Scripting in R [1] "." Do’s and don’ts R code editors $cmd Working with [1] "saga_cmd.exe" spatial data Spatial classes Spatial methods $path R+SAGA [1] "C:/PROGRA~1/R/R-210~1.1/library/RSAGA/saga_vc" R+FWTools Export to Google Earth $modules [1] "C:/PROGRA~1/R/R-210~1.1/library/RSAGA/saga_vc/modules" Literature
- 77. Getting list of modules R crash course T. Hengl & R.S. Bivand Overview Course programme > rsaga.get.modules("ta_channels") Why R? Software installation $ta_channels Scripting in R code name interactive Do’s and don’ts 1 0 Channel Network FALSE R code editors 2 1 Watershed Basins FALSE Working with 3 2 Watershed Basins (extended) FALSE spatial data Spatial classes 4 3 Vertical Distance to Channel Network FALSE Spatial methods 5 4 Overland Flow Distance to Channel Network FALSE R+SAGA 6 5 D8 Flow Analysis FALSE R+FWTools 7 6 Strahler Order FALSE Export to Google Earth Literature
- 78. Run stream extraction R crash course > rsaga.geoprocessor(lib = "ta_channels", module = 5, param = list(DEM = " T. Hengl & + DIRECTION = "channels.sgrd", CONNECTION = "route.sgrd", R.S. Bivand + NETWORK = "channels.shp")) Overview SAGA CMD 2.0.4 Course programme Why R? Software installation library path: C:/PROGRA~1/R/R-210~1.1/library/RSAGA/... library name: ta_channels Scripting in R module name : D8 Flow Analysis Do’s and don’ts R code editors author : (c) 2003 by O.Conrad Working with spatial data Load grid: dem6.sgrd... Spatial classes ready Spatial methods R+SAGA Parameters R+FWTools Export to Google Grid system: 100; 6x 6y; 100x 100y Earth DEM: dem6 Literature Flow Direction: Flow Direction Flow Connectivity: Flow Connectivity Flow Network: Flow Network Minimum Connectivity: 0 ...
- 79. Read back to R R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? > dem$route <- readGDAL("route.sdat")$band1 Software installation Scripting in R route.sdat has GDAL driver SAGA Do’s and don’ts and has 6 rows and 6 columns R code editors Working with > channels <- readOGR("channels.shp", "channels") spatial data Spatial classes OGR data source with driver: ESRI Shapefile Spatial methods Source: "channels.shp", layer: "channels" R+SAGA with 32 features and 2 fields R+FWTools Export to Google Feature type: wkbLineString with 2 dimensions Earth Literature
- 80. Plot the ﬁnal result R crash course T. Hengl & R.S. Bivand > dem.plt <- spplot(dem[1], main = "DEM", col.regions = topo.colors(25)) > channels.plt <- spplot(dem[2], col.regions = rev(gray(0:20/20)), Overview + main = "Flow connectivity", sp.layout = list("sp.lines", Course programme Why R? + channels, col = "red")) Software installation > print(dem.plt, split = c(1, 1, 2, 1), more = T) Scripting in R > print(channels.plt, split = c(2, 1, 2, 1), more = F) Do’s and don’ts DEM Flow connectivity R code editors 4.0 50 Working with 3.5 spatial data 40 Spatial classes 3.0 Spatial methods 2.5 R+SAGA 30 2.0 R+FWTools Export to Google 1.5 Earth 20 1.0 Literature 0.5 10 0.0
- 81. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 82. Preparing FWTools R crash course T. Hengl & R.S. Bivand Overview Course programme There is still no package to control FWTools from R, but we can Why R? Software installation simply send command lines using the system command. Before Scripting in R we can use FWTools from R, we need to locate it on our PC: Do’s and don’ts R code editors Working with spatial data Spatial classes > gdalwarp <- gsub("/", "", dir(path="C:/PROGRA~2/FWTOOL~1.7", Spatial methods + pattern="gdalwarp.exe", recursive=TRUE, full.names=TRUE)) R+SAGA > gdalwarp R+FWTools Export to Google [1] "C:PROGRA~2FWTOOL~1.7bingdalwarp.exe" Earth > workd <- paste(gsub("/", "", getwd()), "", sep="") Literature
- 83. MODIS data R crash course Now we can download some GIS data from web: T. Hengl & R.S. Bivand > MOD12Q1 <- "ftp://anonymous:test@e4ftl01u.ecs.nasa.gov/ + MOLT/MOD12Q1.004/2004.01.01/" Overview > download.file(paste(MOD12Q1, Course programme Why R? + "MOD12Q1.A2004001.h18v03.004.2006117173748.hdf", sep=""), Software installation + destfile=paste(getwd(), + "MOD12Q1.A2004001.h18v03.004.2006117173748.hdf", sep="/"), Scripting in R Do’s and don’ts + mode='wb', method='wget') R code editors Resolving e4ftl01u.ecs.nasa.gov... 152.61.4.83 Working with Connecting to e4ftl01u.ecs.nasa.gov|152.61.4.83|:21... connected. spatial data Spatial classes Logging in as anonymous ... Logged in! Spatial methods ==> SYST ... done. ==> PWD ... done. R+SAGA ==> TYPE I ... done. ==> CWD /MOLT/MOD12Q1.004/2004.01.01 ... done. R+FWTools Export to Google ==> SIZE MOD12Q1.A2004001.h18v03.004.2006117173748.hdf ... 23165983 Earth ==> PASV ... done. ==> RETR MOD12Q1.A2004... done. Literature Length: 23165983 (22M) 0K .......... .......... 0% 64.9K 5m48s ... 22550K .......... .......... 99% 501K 0s 22600K .......... 100% 503K=65s
- 84. Reprojecting grids R crash course T. Hengl & We can reproject/resample the map to our local coordinate R.S. Bivand system using the gdalwarp functionality (this combines several Overview Course programme processing steps in one function): Why R? Software installation > NL.prj <- "+proj=sterea +lat_0=52.15616055555555 Scripting in R + +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 Do’s and don’ts + +y_0=463000 +ellps=bessel +units=m +no_defs R code editors + +towgs84=565.237,50.0087,465.658, Working with + -0.406857,0.350733,-1.87035,4.0812" spatial data Spatial classes > system(paste(gdalwarp, " HDF4_EOS:EOS_GRID:"", workd, Spatial methods + "MOD12Q1.A2004001.h18v03.004.2006117173748.hdf" R+SAGA + :MOD12Q1:Land_Cover_Type_1 -t_srs "", NL.prj, "" R+FWTools Export to Google + IGBP2004NL.tif -r near -te 0 300000 280000 625000 Earth + -tr 500 500", sep="")) Literature Creating output file that is 560P x 650L. Processing input file HDF4_EOS:EOS_GRID:MOD12Q1.A2004001... Using internal nodata values (eg. 255) for image HDF4_EOS:EOS_... 0...10...20...30...40...50...60...70...80...90...100 - done.
- 85. Plot the ﬁnal result R crash course In this case we have produced a MODIS-based land cover map T. Hengl & for the whole Netherlands in resolution of 500 m (in local R.S. Bivand coordinate system). Overview Course programme Why R? Software installation Scripting in R Do’s and don’ts R code editors Working with spatial data Spatial classes Spatial methods R+SAGA R+FWTools Export to Google Earth Literature
- 86. Outline R crash course 1 Overview T. Hengl & R.S. Bivand Course programme Overview Why R? Course programme Software installation Why R? Software installation 2 Scripting in R Scripting in R Do’s and don’ts Do’s and don’ts R code editors R code editors Working with spatial data Spatial classes 3 Working with spatial data Spatial methods R+SAGA Spatial classes R+FWTools Export to Google Spatial methods Earth R+SAGA Literature R+FWTools Export to Google Earth 4 Literature
- 87. Writing spatial data to KML R crash course T. Hengl & R.S. Bivand Overview Course programme Why R? Software installation There are two possibilities to export maps to KML: (a) Scripting in R using existing packages, and (b) by writing KML ﬁles Do’s and don’ts R code editors “by-hand” . Working with To export point or line features to KML, use the writeOGR spatial data Spatial classes method that is available in R package rgdal. Spatial methods R+SAGA More ﬂexible way to writing KML ﬁles is by using loops. R+FWTools Export to Google Earth Literature
- 88. Literature R crash course T. Hengl & R.S. Bivand Overview Bivand, R., Pebesma, E., Rubio, V., 2008. Applied Spatial Course programme Data Analysis with R. Use R Series, Springer, Heidelberg, Why R? Software installation 378 p. Scripting in R Do’s and don’ts Hengl, T., 2009. A Practical Guide to Geostatistical R code editors Mapping, 2nd edition. University of Amsterdam, 291 p. Working with spatial data ISBN 978-90-9024981-0. Spatial classes Spatial methods Kabacoﬀ, R.I., 2009. Data Analysis and Graphics with R. R+SAGA R+FWTools Manning publications, 375 p. Export to Google Earth Literature Zuur, A. F., Ieno, E. N., Meesters, E. H. W. G., 2009. A Beginner’s Guide to R. Springer, Use R series, 228 p.

Full NameComment goes here.abhaymvyas1 year agoAlfonso Crisci, Ricercatore III at IBIMET CNR 1 year agoGiuseppe Calamita, PhD / Scientific research at Institute of Methdologies for Environmental Analysis - IMAA - CNR Tagsr is hell!2 years ago