Re: [R] Problem with compatible library versions

2023-10-13 Thread Sabine Braun
Thank you very much :-)), this worked! Now the loaded libraries are 
compatible with each other.

Best regards

Sabine Braun

Am 11.10.2023 um 14:08 schrieb Richard O'Keefe:
> There is a fairly straightforward way to load older versions
> of packages, and that is to use the 'groundhog' package.
> As the first sentence of https://groundhogr.com/ puts it:
>    Make your R scripts reproducible by replacing library(pkg)
>    with groundhog.library(pkg, date).
>
> pkg can be a vector of package names or a single name.
>
> On Wed, 11 Oct 2023 at 20:58, Uwe Ligges 
>  wrote:
> >
> >
> > On 10.10.2023 17:34, Sabine Braun wrote:
> > > On the github website I have reported several bugs with new 
> versions of
> > > the tidyverse group (probably dplyr) which prevent me from using R
> > > normally. I wanted to go back to older versions but this seems not 
> bo be
> > > easy. I downloaded R 4.1.2. and Rtools 40 but the library versions
> >
> > So this is on Windows.
> >
> > Actually, if you install R-4.1.2 and use a clean library and install
> > binaries, then you should get binary installation from CRAN that fit to
> > the R-4.1.x series.
> >
> > If you want to install older package versions, then you have to install
> > these one by one from sources, unfortunately.
> >
> > Best,
> > Uwe Ligges
> >
> >
> >
> > > installed are still the newest ones. I was able to install dplyr 
> 1.0.7.
> > > manually but there are error messages on incompatibility when loading
> > > this version. Is there a possibility to load older library versions
> > > which alre compatible ?
> > >
> > > Thank you very much!
> > >
> > > Best regards
> > >
> > > Sabine Braun
> > >
> > >
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
-- 


Dr. Sabine Braun
Leitung

www.iap.ch 

Institut für Angewandte Pflanzenbiologie (IAP) AG
Benkenstrasse 254a
CH-4108 Witterswil
++41 (0)61 485 50 71
++41 (0)79 696 69 85

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] [Rd] R 4.3.2 scheduled for October 31

2023-10-13 Thread Peter Dalgaard via R-help
Full schedule available on developer.r-project.org in a short while.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] if-else that returns vector

2023-10-13 Thread Christofer Bogaso
This is very interesting. Thanks for sharing.

On Fri, Oct 13, 2023 at 10:25 AM Richard O'Keefe  wrote:
>
> ?ifelse
> 'ifelse' returns a value with the same shape as 'test' which is
>  filled with elements selected from either 'yes' or 'no' depending
>  on whether the element of 'test' is 'TRUE' or 'FALSE'.
>
> This is actually rather startling, because elsewhere in the
> S (R) language, operands are normally replicated to the length
> of the longer.  Thus
> c(1,2,3)*10 + c(5,6)
> first (notionally) replicates 10 to c(10,10,10)
> and then c(5,6) to c(5,6,5), yielding c(15,26,35).
> And this *does* happen, sort of.
> > ifelse(c(F,T,F), c(1,2,3), c(5,6))
> => 5 2 5.
> But it *doesn't* apply to the test.
>
> There's another surprise.  Years ago I expected that
> all three arguments would be evaluated, then length
> adjusted, and then processing would be done.
> But the 2nd argument is evaluated (in full) if and only
> if some element of the test is true,
> and the 3rd argument is evaluated (in full) if and oly
> if some element of the test is false.
> ifelse(c(NA,NA), stop("true"), stop("false"))
> => c(NA,NA).
>
> At any rate, what you want is if ()  else 
>
>
>
> On Fri, 13 Oct 2023 at 09:22, Christofer Bogaso  
> wrote:
>>
>> Hi,
>>
>> Following expression returns only the first element
>>
>> ifelse(T, c(1,2,3), c(5,6))
>>
>> However I am looking for some one-liner expression like above which
>> will return the entire vector.
>>
>> Is there any way to achieve this?
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] rnrfa package problems

2023-10-13 Thread Ivan Krylov
On Fri, 13 Oct 2023 09:11:25 +0100
Nick Wray  wrote:

> But when I try to run the example codes there are various problems
> 
> The code is lifted directly from the document btw it’s not mine
> 
> This bit to convert gives an error message:
> 
> # Option a: from OS grid reference to WGS84 >
> 
> osg_parse(gridRef = "NC581062", CoordSystem = "WGS84")

When reporting problems, it's best to list (1) your actions, (2) their
expected result and (3) their actual result:
https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

In particular, it's best to report error messages together with the
code that causes them. This is what I get:

osg_parse(gridRef = "NC581062", CoordSystem = "WGS84")
# Ошибка в osg_parse(gridRef = "NC581062", CoordSystem = "WGS84") :
#   неиспользованные аргументы (gridRef = "NC581062", CoordSystem =
#   "WGS84")

Presumably, your error message looks a bit differently, but the
underlying cause is the same: the package has evolved since the R
Journal article has been published. In particular, the argument names
have been changed in 2018 with a giant commit commented "lint free":
https://github.com/ilapros/rnrfa/commit/258f11d89726c1031cb5bfa73e2f819d984914f3#diff-acbd0646da1333775e213e83567eaf53cb9e791ff7ba1200d462005e65fd7694L24-R30

I think you can use the argument name grid_refs instead of gridRef
and coord_system instead of CoordSystem:

osg_parse(grid = "NC581062", coo = "WGS84")
# $lon
# [1] -4.404049
# 
# $lat
# [1] 58.0

Same goes for your catalogue() problems, which can be easily resolved
by calling help() on the respective functions to look up their new
argument names.

> The ggmap code following gives an error – this may be because the bbox
> data is empty but I’m not sure  The needed packages are loaded:

> m <- get_map(location = as.numeric(bbox), maptype = 'terrain')

Is this the error you get?

>> Error in `get_googlemap()`:
>> ! Google now requires an API key; see `ggmap::register_google()`.

Does it help to follow the instructions in help(register_google,
package = ggmap)? Google inflected this change on the world in 2018,
approximately 1.5 years after the article had been published.

OpenStreetMap support is broken in ggmap
, but passing the source =
'stamen' argument to ggmap::get_map seems to work. Well, partially. I
also get half an error message rendered right into the map telling me
something about "these basemap[s]... no longer... as of October..." and
asking me to upgrade by visiting stamen.com.

This is more or less inevitable when a package depends on an external
service to keep providing map data (you can't bundle the whole map of
the world into a CRAN package, after all), so unless someone steps up
and implements OpenStreetMap's stable API support in ggmap, your best
bet is to ask Google for an API key and pray they won't alter the deal
any further.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] rnrfa package problems

2023-10-13 Thread Nick Wray
R help email

Hello  I’m trying to work my way through the rnrfa package

RJ-2016-036.pdf (r-project.org)


I’ve got it loaded OK and can access the data by the catalogue() command -
gives me a tibble with names, grid refs etc

allStations <- catalogue()

allStations

This works OK



But when I try to run the example codes there are various problems

The code is lifted directly from the document btw it’s not mine

This bit to convert gives an error message:

# Option a: from OS grid reference to WGS84 >

osg_parse(gridRef = "NC581062", CoordSystem = "WGS84")

 # Option b: from OS grid reference to BNG

osg_parse(gridRef = "NC581062", CoordSystem = "BNG")

##

osg_parse seems to be built into the rnrfa package so I don’t know why it
doesn’t work…




Then this bounding box code works but doesn’t seem to capture any stations
although rubric says that it should capture stations in mid Wales - the
tibble is empty

# Define a bounding box.

bbox <- list(lonMin = -3.76, latMin = 52.43, lonMax = -3.67, latMax = 52.48)




The ggmap code following gives an error – this may be because the bbox data
is empty but I’m not sure  The needed packages are loaded:

library(ggmap)

library(ggrepel)

m <- get_map(location = as.numeric(bbox), maptype = 'terrain')

ggmap(m) + geom_point(data = someStations, aes(x = lon, y = lat),

+ col = "red", size = 3, alpha = 0.5) +

geom_text_repel(data = someStations, aes(x = lon, y = lat, label = name),

+ size = 3, col = "red")




I thought that I’d try the next bit to see anyway:

# Select stations with more than 100 years of recordings.

s100Y <- catalogue(minRec = 100, all = FALSE)

# Print s100Y to the screen.

s100Y

But again I get an error message

I haven’t gone any further through the article because there doesn’t seem
much point unless I can sort things.  I am puzzled as to why the examples
don’t work – I’ve got all the needed packages loaded etc

If anyone can help/explain I’d be v grateful

Thanks Nick Wray

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.