Re: [R] R Script Modification Questions

2020-08-18 Thread Jim Lemon
Okay, I can't help much with the ggplot stuff so forget the "lty=" argument for that is base graphics. However, you may get away with ggtitle(paste0("COVID-19 Tests in Ohio \n(",date[length(date]),")"))+ I don't know whether the tidy* stuff handles indexing in the same way as base R. Jim On Wed

Re: [R] R Script Modification Questions

2020-08-18 Thread Rasmus Liland
Dear Stephen, I reply you inline: On 2020-08-18 11:09 -0700, Bert Gunter wrote: | On Tue, Aug 18, 2020 at 10:10 AM Stephen P. Molnar wrote: | | | | Thanks to the kind folks on this | | list, this is an elegant replacement | | for the clumsy R script that I that | | I wrote. | | | | | | | |

Re: [R] R Script Modification Questions

2020-08-18 Thread Bert Gunter
1. Generally you should make your posts self-contained -- I see no line 14's or 33's or whatever. Note that you did not continue the old thread either. I have no desire to go poking around in previous threads (others certainly may!). 2. Re: max of dates. max(as.Date(c("1976-04-07","1982-02-22"))

[R] R Script Modification Questions

2020-08-18 Thread Stephen P. Molnar
Thanks to the kind folks on this list, this is an elegant replacement for the clumsy R script that I that I wrote. However, I do have a few changes that I would like to make. The problem is that while I know how to make changes in Python, I am still bumbling around in R Code. The day-to-d

Re: [R] "patternbar_s" : show legend and other issues

2020-08-18 Thread PIKAL Petr
Hi Probably patternbar handles legend position in nonstandard way so lebend.position does not work as expected. Rotating % is done by axis.title.y ... theme(axis.text.x = element_text(angle = 90), axis.title.y = element_text(angle=0), aspect.ratio= 0.4) Legend has to be placed probably by legen

Re: [R] Calculating Minimum Absolute Difference of Two Numeric Vectors

2020-08-18 Thread PIKAL Petr
Hi maybe min(abs(outer(x,y, "-"))) If you want indices mm <- min(abs(outer(x,y, "-"))) which(abs(outer(x,y, "-"))== mm, arr.ind=TRUE) And in original vectors x[which(abs(outer(x,y, "-"))== mm, arr.ind=TRUE)[1]] y[which(abs(outer(x,y, "-"))== mm, arr.ind=TRUE)[2]] Cheers Petr > -Origina

Re: [R] an error message in getNOAA.bathy function

2020-08-18 Thread Rasmus Liland
On 2020-08-18 16:36 +0200, Rasmus Liland wrote: > On 2020-08-18 22:59 +0900, Joon-Taek Yoo wrote: > | Dear Helpers, > | I am trying to draw a map of East Asia > | using the getNOAA.bathy () > | function(package marmap) in R. I'v got > | a following error message. > | > | > dat <- getNOAA.bathy(

Re: [R] an error message in getNOAA.bathy function

2020-08-18 Thread Rasmus Liland
On 2020-08-18 22:59 +0900, Joon-Taek Yoo wrote: | Dear Helpers, | I am trying to draw a map of East Asia | using the getNOAA.bathy () | function(package marmap) in R. I'v got | a following error message. | | > dat <- getNOAA.bathy(110, 160, 20, 60, res=4, keep=T) | Querying NOAA database ... |

Re: [R] an error message in getNOAA.bathy function

2020-08-18 Thread Bert Gunter
I think you are more likely to get a helpful reply on the R-sig-geo list rather than here. If all else fails, try contacting the maintainer ( ?maintainer) . Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka

[R] an error message in getNOAA.bathy function

2020-08-18 Thread Joon-Taek Yoo
Dear Helpers, I am trying to draw a map of East Asia using the getNOAA.bathy () function(package marmap) in R. I'v got a following error message. > dat <- getNOAA.bathy(110, 160, 20, 60, res=4, keep=T) Querying NOAA database ... This may take seconds to minutes, depending on grid size Error in .lo

Re: [R] Plot math symbol with string and number

2020-08-18 Thread Rasmus Liland
On 2020-08-18 11:02 +1200, Paul Murrell wrote: | On 18/08/20 9:54 am, Bert Gunter wrote: | | On Mon, Aug 17, 2020 at 2:14 PM wrote: | | | | | | Plotmath seems to be the right way | | | to do it. But without reading | | | plotmath I'd have gone with this: | | | | | | plot(y, main=paste("data",

Re: [R] Best settings for RStudio video recording?

2020-08-18 Thread Rasmus Liland
On 2020-08-17 14:50 -0400, Duncan Murdoch wrote: | | Certainly you should be able to delete | Pandoc if you have permissions to | install it; that may break RMarkdown | if you don't have another copy | somewhere.) I use Rmarkdown outside of Rstudio, just with rmarkdown::render in an Rscript

Re: [R] Calculating Minimum Absolute Difference of Two Numeric Vectors

2020-08-18 Thread Jeff Newmiller
This looks more like a code challenge than a real problem, but anyway Rcpp seems unnecessary. x <- (2:5)^2/3 y <- (1:6)+0.1 ad <- function( a, b ) { abs( a - b ) } M <- outer( x, y, FUN=ad ) which( M==min(M), arr.ind = TRUE ) On August 18, 2020 12:00:09 AM PDT, Dario Strbenac wrote: >Good da

[R] Calculating Minimum Absolute Difference of Two Numeric Vectors

2020-08-18 Thread Dario Strbenac
Good day, What is a fast and efficient way to calculate the minimum absolute difference between two vectors of numbers? The two vectors have unequal length. I would also like to know the index of the first vector and the second vector which results in the minimum absolute difference. For exampl

Re: [R] Error message from "patternbar_s"

2020-08-18 Thread PIKAL Petr
Hi You probably do not have date in your data. Or date in R sense. What str(df_c_m) tells you about your date. I believe date is factor or character variable, which need to be converted do Date variable by appropriate way - e.g. strptime or as.Date. BTW, "dput" result is useful for exchanging