[R-sig-Geo] Bivand book chapter 2 Auckland example

Roger Bivand Roger.Bivand at nhh.no
Thu Feb 20 16:40:09 CET 2014


On Thu, 20 Feb 2014, rotundo wrote:

> Hello Mathias,
>
> Thanks a lot for your response. I tried what you suggested but it didn´t
> work.

I don't think that you did. Do:

list.files(pattern="auckland_mapgen")

before:

auck_shore <- MapGen2SL("auckland_mapgen.dat", llCRS)

If you see:

> list.files(pattern="auckland_mapgen")
character(0)

then the file is not in your working directory. If you cannot resolve this 
by pointing the R session at the correct directory (see ?setwd), simply 
run R outside RStudio, which is getting between you and the data.

The general advice is that if anything doesn't work in RStudio, use R, not 
RStudio. All of the code from the book is available for download from 
www.asdar-book.org and is run nightly to check for problems arising from 
updates of packages.

Roger

>
> I don´t think the error is in the file path, since I am using R studio, and
> the file auckland_mapgen.dat is already imported to the workspace. So,
> after loading the file, I run three different  codes, but still have the
> same error message:
>
> library(maps)
> library(maptools)
>
> #Example Page 41 as in the book
> llCRS <- CRS("+proj=longlat +ellps=WGS84")
> auck_shore <- MapGen2SL("auckland_mapgen.dat", llCRS)
>
> # without .dat
> llCRS <- CRS("+proj=longlat +ellps=WGS84")
> auck_shore <- MapGen2SL("auckland_mapgen", llCRS)
>
> # Creating another data set
> llCRS <- CRS("+proj=longlat +ellps=WGS84")
> auck_data <-auckland_mapgen
> auck_shore <- MapGen2SL("auck_data", llCRS)
>
> I attached a print screen of the R workplace so you can see what I did.
>
> Thanks a lot for your help.
>
> Jose
>
>
>
> 2014-02-20 10:13 GMT-03:00 matsei [via R-sig-geo] <
> ml-node+s2731867n7585805h93 at n2.nabble.com>:
>
>> Hello Jose,
>>
>> This error message indicates, that you used the wrong file path. Check
>> this and correct the path you're using.
>>
>> Alternatively, try this:
>> yourfilepath <- "C:/Master_Bivand/auckland_mapgen.dat" # adapt this to
>> your file path
>> auckshore <- read.table(yourfilepath)
>>
>> If this does not solve you problem, please first have a thorough look at
>> the posting guide.
>> http://www.r-project.org/posting-guide.html
>>
>> Best regards,
>> Mathias
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://r-sig-geo.2731867.n2.nabble.com/Bivand-book-chapter-2-Auckland-example-tp7585802p7585805.html
>>  To unsubscribe from Bivand book chapter 2 Auckland example, click here<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=7585802&code=cm90dW5kby5qb3NlQGdtYWlsLmNvbXw3NTg1ODAyfC0xMjQ4MzI2Mzk=>
>> .
>> NAML<http://r-sig-geo.2731867.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> -- 
>
>
> José L. Rotundo
> CONICET
> Facultad de Ciencias Agrarias
> Univ. Nacional de Rosario
> Zavalla, Santa Fe
> Argentina
>
>
> Print screen example Bivand Book2.pdf (174K) <http://r-sig-geo.2731867.n2.nabble.com/attachment/7585806/0/Print%20screen%20example%20Bivand%20Book2.pdf>
>
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Bivand-book-chapter-2-Auckland-example-tp7585802p7585806.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list