[R] nearest lower and higher integers to a multiple of another integer

Stefano Sofia @te|@no@@o||@ @end|ng |rom reg|one@m@rche@|t
Mon Apr 6 11:31:47 CEST 2020


Thank you very much.
Stefano

         (oo)
--oOO--( )--OOo----------------
Stefano Sofia PhD
Civil Protection - Marche Region
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona
Uff: 071 806 7743
E-mail: stefano.sofia using regione.marche.it
---Oo---------oO----------------

________________________________________
Da: Jeff Newmiller [jdnewmil using dcn.davis.ca.us]
Inviato: lunedì 6 aprile 2020 10.45
A: r-help using r-project.org; Stefano Sofia; r-help using r-project.org
Oggetto: Re: [R] nearest lower and higher integers to a multiple of another integer

x <- -2
xi <- x %/% 4
xmin <- 4 * xi
xmax <- 4 * ( 1 + xi )

On April 6, 2020 1:29:30 AM PDT, Stefano Sofia <stefano.sofia using regione.marche.it> wrote:
>Dear R list members,
>given an integer x, I would need to find the nearest lower and higher
>integers (xmin and xmax) to a multiple of another integer n.
>
>Example: if x is -2 and n is 4, xmin becomes -4 and xmax is 0.
>
>I tried to manage it with simple "if" statements, but this is not
>efficient at all.
>Could please somebody help me to find an easy way to implement it?
>
>Thank you for your attention and your help
>Stefano Sofia
>
>         (oo)
>--oOO--( )--OOo----------------
>Stefano Sofia PhD
>Civil Protection - Marche Region
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona
>Uff: 071 806 7743
>E-mail: stefano.sofia using regione.marche.it
>---Oo---------oO----------------
>
>________________________________
>
>AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
>informazioni confidenziali, pertanto è destinato solo a persone
>autorizzate alla ricezione. I messaggi di posta elettronica per i
>client di Regione Marche possono contenere informazioni confidenziali e
>con privilegi legali. Se non si è il destinatario specificato, non
>leggere, copiare, inoltrare o archiviare questo messaggio. Se si è
>ricevuto questo messaggio per errore, inoltrarlo al mittente ed
>eliminarlo completamente dal sistema del proprio computer. Ai sensi
>dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità
>ed urgenza, la risposta al presente messaggio di posta elettronica può
>essere visionata da persone estranee al destinatario.
>IMPORTANT NOTICE: This e-mail message is intended to be received only
>by persons entitled to receive the confidential information it may
>contain. E-mail messages to clients of Regione Marche may contain
>information that is confidential and legally privileged. Please do not
>read, copy, forward, or store this message unless you are an intended
>recipient of it. If you have received this message in error, please
>forward it to the sender and delete it completely from your computer
>system.
>
>--
>Questo messaggio  stato analizzato da Libra ESVA ed  risultato non
>infetto.
>This message was scanned by Libra ESVA and is believed to be clean.
>
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://urlsand.esvalabs.com/?u=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&e=52342f8a&h=d46bc785&f=y&p=y
>PLEASE do read the posting guide
> https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html&e=52342f8a&h=9b25bfd5&f=y&p=y
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

--

Questo messaggio  stato analizzato con Libra ESVA ed  risultato non infetto.


________________________________

AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system.

--
Questo messaggio  stato analizzato da Libra ESVA ed  risultato non infetto.
This message was scanned by Libra ESVA and is believed to be clean.



More information about the R-help mailing list