Re: [R] interactively getting alist of functions for a given package?

2021-06-24 Thread Greg Minshall
Jake and Deepayan,

both very nice and useful solutions.  thank you.

Greg

__
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] checksums for R src file

2021-06-24 Thread kap4lin
Perfect, Thank you!

On Thu, Jun 24, 2021, 1:43 PM peter dalgaard  wrote:

> Yes, these are in the release announcements. They are deliberately not
> kept with the actual files due to security considerations. The easiest
> source is
>
> https://stat.ethz.ch/pipermail/r-announce/2021/date.html
>
> (because that mailing list doesn't contain much other than release
> announcements).
>
> - Peter D.
>
> > On 24 Jun 2021, at 17:47 , kap4lin  wrote:
> >
> > When I download the file,
> > https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz (or anything
> > similar) is there a checksum for the file I can compare it to?
> >
> > Thanks
> > PK
> >
> >   [[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.
>
> --
> 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
>
>

[[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.


Re: [R] checksums for R src file

2021-06-24 Thread peter dalgaard
Yes, these are in the release announcements. They are deliberately not kept 
with the actual files due to security considerations. The easiest source is

https://stat.ethz.ch/pipermail/r-announce/2021/date.html

(because that mailing list doesn't contain much other than release 
announcements).

- Peter D.

> On 24 Jun 2021, at 17:47 , kap4lin  wrote:
> 
> When I download the file,
> https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz (or anything
> similar) is there a checksum for the file I can compare it to?
> 
> Thanks
> PK
> 
>   [[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.

-- 
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-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] checksums for R src file

2021-06-24 Thread kap4lin
When I download the file,
https://cran.r-project.org/src/base/R-4/R-4.1.0.tar.gz (or anything
similar) is there a checksum for the file I can compare it to?

Thanks
PK

[[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.


Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Rui Barradas

Hello,

Inline.

Às 15:27 de 24/06/21, Stefano Sofia escreveu:

Thank you Jeff and thank you Andrew

1) Yes, I understand that it is a vector, even though is.vector(c(day1, day2)) 
is FALSE. Andrew explained to me why: it has attributes 'class' and 'tzone'.
2) I understand now that I created a data frame with only one row, and I am trying to fit a vector of length 2. I thought that, once created an empty data frame, 


But the data.frame is not empty, it has one row with perfectly valid NA's.


mydf
#  data_POSIX value
#1   NA



You can rbind an empty df with another with the new values.


mydf2 <- data.frame()
mydf2
#data frame with 0 columns and 0 rows

rbind(mydf2, data.frame(data_POSIX = c(day1, day2), value = NA))
#  data_POSIX value
#1 2018-02-01NA
#2 2018-02-02NA


But once again assignment will fail, and for the same reason.


Hope this helps,

Rui Barradas




I could fit any vector without specifying the length since the beginning.


Now I will think about it.
Thank you
Stefano

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


Da: Jeff Newmiller [jdnew...@dcn.davis.ca.us]
Inviato: giovedì 24 giugno 2021 15.46
A: r-help@r-project.org; Stefano Sofia; r-help mailing list
Oggetto: Re: [R] empty data frame and POSIXct data types

1) It _is_ a vector. Why do you think it is not a vector?

2) Your data frame has one row, with an NA in the date_POSIX column. You cannot 
fit a vector of length 2 as a column into a data frame with only 1 row.

What are you trying to do? Do you really want to end up with a 2-row data frame 
or a 3 row data frame?

On June 24, 2021 6:34:31 AM PDT, Stefano Sofia 
 wrote:

Dear R users,
I know that this question is silly (I am not a R newby) but I already
wasted quite a lot of energies trying to fill in an empty data frame
(with "POSIXct" "POSIXt" data type).

Suppose I create
mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA))
day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M",
tz="Etc/GMT-1")
day2 <- as.POSIXct("2018-02-02-00-00", format="%Y-%m-%d-%H-%M",
tz="Etc/GMT-1")

then
mydf$data_POSIX <- c(day1, day2)

does not work, it gives me:
"Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600,
1517612400 :
  replacement has 2 rows, data has 1"

There are few basic concepts that I am missing.
Why c(day1, day2) is not a vector?
Why I am not able to populate my data frame?

Could somebody please give me the right hints?
Thank you for your precious help
Stefano


 (oo)
--oOO--( )--OOo--
Stefano Sofia PhD
Civil Protection - Marche Region - Italy
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona (AN)
Uff: +39 071 806 7743
E-mail: stefano.so...@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 Libraesva ESG ed  risultato non
infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


   [[alternative HTML version deleted]]

__
R-help@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=5a635173=06ff70f3=y=y
PLEASE do read the posting guide
https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html=5a635173=e12f63e8=y=y
and provide 

Re: [R] interactively getting alist of functions for a given package?

2021-06-24 Thread Deepayan Sarkar
On Thu, Jun 24, 2021 at 2:10 PM Greg Minshall  wrote:
>
> Duncan,
>
> > Bert gave you an answer that depends on ls().  Whether there's
> > something like "set" that can return "asset" probably depends on
> > your front end, and may be customizable using the facilities described
> > in ?rcompgen.
>
> thanks.  i am just using command line R on linux.  i tried setting
> `rc.setting(fuzzy=TRUE, func=TRUE, ipck=TRUE)`, but
> `data.table::set` still only shows names that start with "set".
> Bert's `ls` answer works, but did you have an idea of how else this
> might be made to work with rcompgen?

That's not currently supported. It would not be difficult to get the
completion mechanism to return these matches; e.g.,

utils:::findMatches("set", ls(getNamespace("data.table")))

You can even experiment a bit with something like (only for normal completions)

complete.partial <- function(.CompletionEnv)
{
text <- .CompletionEnv[["token"]]
comps <- apropos(text)
.CompletionEnv[["comps"]] <- comps
}

rc.options(custom.completer = complete.partial)

The problem is that readline's interface doesn't really allow you to
choose one of these completions easily, and you will need to
explicitly type out at least the prefix.

Another problem with namespace completion in particular is that
readline will first complete to a non-trivial common prefix, if any.
This means that if

data.table::set

gives multiple completions, all starting with "data.table::", readline
will delete the "set" part, and subsequent attempts will just try to
complete "data.table::".

So adding an option to allow apropos-type matches is not difficult,
but given that RStudio has its own completion, and the limited
functionality of readline, not sure it's worth the effort.

Best,
-Deepayan


> cheers, Greg
>
> __
> 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.


[R-es] escritura

2021-06-24 Thread Javier Marcuzzi
Estimados

A raíz de un correo que recibí se me creó una duda, posiblemente se pueda
pero yo lo desconozco.

Supongamos que escribo un modelo en R, pero lógicamente el lenguaje
matemático o científico no es R, lo que motiva tener que escribir
correctamente lo que hace R.

Copio y pego un ejemplo cualquiera de una página de internet, seguramente
saldrá algo "despatarrado" pero se comprenderá perfectamente, el escribir
desde R a lenguaje adecuado. ¿Hay alguna forma que R lo genere?, ¿Que hizo
R?, R hizo esto.

Model formulation
Level 1YijLevel 2β0j=β0j+Rij=γ00+U0j

with,
U0j∼N(0, τ002),

and
Rij∼N(0, σ2)

To fit this model we run
COPYHIDE

# lme4
lmer(y ~ 1 + (1 | subjects), data=data)
# nlme
lme(y ~ 1, random = ~ 1 | subjects, data=data)


Desde ya muchas gracias.

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
Thank you Jeff and thank you Andrew

1) Yes, I understand that it is a vector, even though is.vector(c(day1, day2)) 
is FALSE. Andrew explained to me why: it has attributes 'class' and 'tzone'.
2) I understand now that I created a data frame with only one row, and I am 
trying to fit a vector of length 2. I thought that, once created an empty data 
frame, I could fit any vector without specifying the length since the beginning.

Now I will think about it.
Thank you
Stefano

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


Da: Jeff Newmiller [jdnew...@dcn.davis.ca.us]
Inviato: giovedì 24 giugno 2021 15.46
A: r-help@r-project.org; Stefano Sofia; r-help mailing list
Oggetto: Re: [R] empty data frame and POSIXct data types

1) It _is_ a vector. Why do you think it is not a vector?

2) Your data frame has one row, with an NA in the date_POSIX column. You cannot 
fit a vector of length 2 as a column into a data frame with only 1 row.

What are you trying to do? Do you really want to end up with a 2-row data frame 
or a 3 row data frame?

On June 24, 2021 6:34:31 AM PDT, Stefano Sofia 
 wrote:
>Dear R users,
>I know that this question is silly (I am not a R newby) but I already
>wasted quite a lot of energies trying to fill in an empty data frame
>(with "POSIXct" "POSIXt" data type).
>
>Suppose I create
>mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA))
>day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M",
>tz="Etc/GMT-1")
>day2 <- as.POSIXct("2018-02-02-00-00", format="%Y-%m-%d-%H-%M",
>tz="Etc/GMT-1")
>
>then
>mydf$data_POSIX <- c(day1, day2)
>
>does not work, it gives me:
>"Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600,
>1517612400 :
>  replacement has 2 rows, data has 1"
>
>There are few basic concepts that I am missing.
>Why c(day1, day2) is not a vector?
>Why I am not able to populate my data frame?
>
>Could somebody please give me the right hints?
>Thank you for your precious help
>Stefano
>
>
> (oo)
>--oOO--( )--OOo--
>Stefano Sofia PhD
>Civil Protection - Marche Region - Italy
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona (AN)
>Uff: +39 071 806 7743
>E-mail: stefano.so...@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 Libraesva ESG ed  risultato non
>infetto.
>This message was scanned by Libraesva ESG and is believed to be clean.
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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=5a635173=06ff70f3=y=y
>PLEASE do read the posting guide
> https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.html=5a635173=e12f63e8=y=y
>and provide commented, minimal, self-contained, reproducible code.

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

--

Questo messaggio  stato analizzato con Libraesva ESG 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 

Re: [R] interactively getting alist of functions for a given package?

2021-06-24 Thread Jake Elmstedt
Here's something which is perhaps a bit more sophisticated than what's 
been offered already.


Here's a function which classifies and returns all of the objects in the 
namespace of a package.


There are three advantages to this approach over something like 
ls("package:ggplot2").


1) You don't need to have the library loaded to be able to see the 
objects in the namespace (though it must be installed of course).
2) ls("package:ggplot2") does not distinguish between the types of 
objects, so you'll get things like "diamonds" coming out of it with no 
indication that it's a data object.
3) With the namespace approach you will also get the internal functions 
and S3 methods in the namespace.


package_objects <- function(pkg, pattern = "", only_functions = 
FALSE) {

  classify <- function(x, ns, all) {
obj <- get(x, envir = ns)
if (is.null(obj) || is.atomic(obj) && !is.object(obj)) {
  "values"
} else {
  mode(obj)
}
  }
  pkg <- as.character(substitute(pkg))
  ns <- asNamespace(pkg)
  ns_names <- ls(ns, all.names = TRUE, pattern = pattern)
  type <- sapply(ns_names, classify, ns = ns)
  if (only_functions) type[type != "function"] <- NA
  split(ns_names, type)
}

str(package_objects(ggplot2)) # All objects
#> List of 4
#>  $ environment: chr [1:121] ".__NAMESPACE__." 
".__S3MethodsTable__." "AxisSecondary" "Coord" ...
#>  $ function   : chr [1:859] "$.ggproto" "$.ggproto_parent" 
"$<-.uneval" "%||%" ...

#>  $ list   : chr [1:3] ".element_tree" ".store" ".zeroGrob"
#>  $ values : chr [1:13] ".__global__" ".all_aesthetics" 
".base_to_ggplot" ".packageName" ...


str(package_objects(ggplot2, "", TRUE)) # All functions
#> List of 1
#>  $ function: chr [1:859] "$.ggproto" "$.ggproto_parent" 
"$<-.uneval" "%||%" ...


package_objects(ggplot2, "^geom", TRUE) # Function starts with "geom"
#> $`function`
#>  [1] "geom_abline""geom_area" 
"geom_bar"
#>  [4] "geom_bin2d" "geom_blank" 
"geom_boxplot"
#>  [7] "geom_col"   "geom_column" 
"geom_contour"
#> [10] "geom_contour_filled""geom_count" 
"geom_crossbar"
#> [13] "geom_curve" "geom_density" 
"geom_density_2d"
#> [16] "geom_density_2d_filled" "geom_density2d" 
"geom_density2d_filled"
#> [19] "geom_dotplot"   "geom_errorbar" 
"geom_errorbarh"
#> [22] "geom_freqpoly"  "geom_function" 
"geom_hex"
#> [25] "geom_histogram" "geom_hline" 
"geom_jitter"
#> [28] "geom_label" "geom_line" 
"geom_linerange"
#> [31] "geom_map"   "geom_path" 
"geom_point"
#> [34] "geom_pointrange""geom_polygon"   "geom_qq" 

#> [37] "geom_qq_line"   "geom_quantile" 
"geom_raster"
#> [40] "geom_rect"  "geom_ribbon" 
"geom_rug"
#> [43] "geom_segment"   "geom_sf" 
"geom_sf_label"
#> [46] "geom_sf_text"   "geom_smooth" 
"geom_spoke"
#> [49] "geom_step"  "geom_text" 
"geom_tile"

#> [52] "geom_violin""geom_vline"

package_objects(ggplot2, "geom", TRUE) # Function contains "geom"
#> $`function`
#>  [1] "geom_abline""geom_area" 
"geom_bar"
#>  [4] "geom_bin2d" "geom_blank" 
"geom_boxplot"
#>  [7] "geom_col"   "geom_column" 
"geom_contour"
#> [10] "geom_contour_filled""geom_count" 
"geom_crossbar"
#> [13] "geom_curve" "geom_density" 
"geom_density_2d"
#> [16] "geom_density_2d_filled" "geom_density2d" 
"geom_density2d_filled"
#> [19] "geom_dotplot"   "geom_errorbar" 
"geom_errorbarh"
#> [22] "geom_freqpoly"  "geom_function" 
"geom_hex"
#> [25] "geom_histogram" "geom_hline" 
"geom_jitter"
#> [28] "geom_label" "geom_line" 
"geom_linerange"
#> [31] "geom_map"   "geom_path" 
"geom_point"
#> [34] "geom_pointrange""geom_polygon"   "geom_qq" 

#> [37] "geom_qq_line"   "geom_quantile" 
"geom_raster"
#> [40] "geom_rect"  "geom_ribbon" 
"geom_rug"
#> [43] "geom_segment"   "geom_sf" 
"geom_sf_label"
#> [46] "geom_sf_text"   "geom_smooth" 
"geom_spoke"
#> [49] "geom_step"  "geom_text" 
"geom_tile"
#> [52] "geom_violin""geom_vline" 
"guide_geom"
#> [55] "guide_geom.axis""guide_geom.bins" 
"guide_geom.colorbar"
#> [58] "guide_geom.guide_none"  "guide_geom.legend" 
"guides_geom"

#> [61] "update_geom_defaults"

# Has "geom" or "Geom" anywhere in the object name
package_objects(ggplot2, "[gG]eom")
#> $environment
#>  [1] "Geom""GeomAbline" 
"GeomAnnotationMap"
#>  [4] "GeomArea""GeomBar" "GeomBlank" 

#>  [7] "GeomBoxplot" "GeomCol" "GeomContour" 

#> [10] "GeomContourFilled"   

Re: [R] empty data frame and POSIXct data types

2021-06-24 Thread Olivier Crouzet
Hi Stefano,

my guess is that you're expecting data recycling to apply but your
data frame is only one row long... therefore you can't insert a 2-row
vector into a 1-row vector. Recycling won't help.

You should specify the number of rows that will be required in your
data frame using (e.g) rep().

(here I use 10 rows as an example)

mydf <- data.frame(data_POSIX=rep(as.POSIXct(NA), 10),
value=as.numeric(NA)) 

Olivier.

On Thu, 24 Jun 2021 13:34:31
+ Stefano Sofia  wrote:

> Dear R users,
> I know that this question is silly (I am not a R newby) but I already
> wasted quite a lot of energies trying to fill in an empty data frame
> (with "POSIXct" "POSIXt" data type).
> 
> Suppose I create
> mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA))
> day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M",
> tz="Etc/GMT-1") day2 <- as.POSIXct("2018-02-02-00-00",
> format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1")
> 
> then
> mydf$data_POSIX <- c(day1, day2)
> 
> does not work, it gives me:
> "Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600,
> 1517612400 : replacement has 2 rows, data has 1"
> 
> There are few basic concepts that I am missing.
> Why c(day1, day2) is not a vector?
> Why I am not able to populate my data frame?
> 
> Could somebody please give me the right hints?
> Thank you for your precious help
> Stefano
> 
> 
>  (oo)
> --oOO--( )--OOo--
> Stefano Sofia PhD
> Civil Protection - Marche Region - Italy
> Meteo Section
> Snow Section
> Via del Colle Ameno 5
> 60126 Torrette di Ancona, Ancona (AN)
> Uff: +39 071 806 7743
> E-mail: stefano.so...@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 Libraesva ESG ed  risultato non
> infetto. This message was scanned by Libraesva ESG and is believed to
> be clean.
> 
> 
>   [[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.


-- 
  Olivier Crouzet, PhD
  http://olivier.ghostinthemachine.space
  /Maître de Conférences/
  @LLING - Laboratoire de Linguistique de Nantes
UMR6310 CNRS / Université de Nantes

__
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] empty data frame and POSIXct data types

2021-06-24 Thread Jeff Newmiller
1) It _is_ a vector. Why do you think it is not a vector?

2) Your data frame has one row, with an NA in the date_POSIX column. You cannot 
fit a vector of length 2 as a column into a data frame with only 1 row.

What are you trying to do? Do you really want to end up with a 2-row data frame 
or a 3 row data frame?

On June 24, 2021 6:34:31 AM PDT, Stefano Sofia 
 wrote:
>Dear R users,
>I know that this question is silly (I am not a R newby) but I already
>wasted quite a lot of energies trying to fill in an empty data frame
>(with "POSIXct" "POSIXt" data type).
>
>Suppose I create
>mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA))
>day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M",
>tz="Etc/GMT-1")
>day2 <- as.POSIXct("2018-02-02-00-00", format="%Y-%m-%d-%H-%M",
>tz="Etc/GMT-1")
>
>then
>mydf$data_POSIX <- c(day1, day2)
>
>does not work, it gives me:
>"Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600,
>1517612400 :
>  replacement has 2 rows, data has 1"
>
>There are few basic concepts that I am missing.
>Why c(day1, day2) is not a vector?
>Why I am not able to populate my data frame?
>
>Could somebody please give me the right hints?
>Thank you for your precious help
>Stefano
>
>
> (oo)
>--oOO--( )--OOo--
>Stefano Sofia PhD
>Civil Protection - Marche Region - Italy
>Meteo Section
>Snow Section
>Via del Colle Ameno 5
>60126 Torrette di Ancona, Ancona (AN)
>Uff: +39 071 806 7743
>E-mail: stefano.so...@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 Libraesva ESG ed  risultato non
>infetto.
>This message was scanned by Libraesva ESG and is believed to be clean.
>
>
>   [[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.

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

__
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] empty data frame and POSIXct data types

2021-06-24 Thread Stefano Sofia
Dear R users,
I know that this question is silly (I am not a R newby) but I already wasted 
quite a lot of energies trying to fill in an empty data frame (with "POSIXct" 
"POSIXt" data type).

Suppose I create
mydf <- data.frame(data_POSIX=as.POSIXct(NA), value=as.numeric(NA))
day1 <- as.POSIXct("2018-02-01-00-00", format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1")
day2 <- as.POSIXct("2018-02-02-00-00", format="%Y-%m-%d-%H-%M", tz="Etc/GMT-1")

then
mydf$data_POSIX <- c(day1, day2)

does not work, it gives me:
"Error in `$<-.data.frame`(`*tmp*`, data_POSIX, value = c(1517439600, 
1517612400 :
  replacement has 2 rows, data has 1"

There are few basic concepts that I am missing.
Why c(day1, day2) is not a vector?
Why I am not able to populate my data frame?

Could somebody please give me the right hints?
Thank you for your precious help
Stefano


 (oo)
--oOO--( )--OOo--
Stefano Sofia PhD
Civil Protection - Marche Region - Italy
Meteo Section
Snow Section
Via del Colle Ameno 5
60126 Torrette di Ancona, Ancona (AN)
Uff: +39 071 806 7743
E-mail: stefano.so...@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 Libraesva ESG ed  risultato non infetto.
This message was scanned by Libraesva ESG and is believed to be clean.


[[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.


Re: [R-es] shiny cargar valores a objetos en formulario

2021-06-24 Thread Emilio L. Cano
Hola Patricio,

Para poder “llenar” dinámicamente los inputs, tienes que hacerlo en el server, 
y utilizar en el ui controles uiOutput.

No es difícil, te recomiendo el capítulo 10 del libro de Hadley: 
https://mastering-shiny.org/action-dynamic.html 
. En el apartado 10.3 tienes 
ejemplos.

Un saludo,

Emilio L. Cano
http://emilio.lcano.com 




> El 24 jun 2021, a las 9:25, patricio fuenmayor  
> escribió:
> 
> Hola con todos
> He realizado una aplicación a modo de formulario que al final guarda los
> valores en base de datos.
> Me han solicitado la funcionalidad de que se puedan cargar los valores
> desde la base de datos al formulario. No tengo inconvenientes en los
> objetos que son outputs pero no logro cargar los objetos inputs (textInput).
> Usando reactiveValuesToList(input), al parecer estos objetos no se crean en
> el *input* si el sidebarmenu del formulario no está activo. Como el menú de
> búsqueda está en otro panel, no se inician estos valores. Les ha pasado
> esto ??? saben cómo se puede crear manualmente este tipo de objetos en el
> input y asignarles un valor?. El updateTextInput no funciona ... y tampoco
> el input$variable <- valor
> 
> Saludos
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] interactively getting alist of functions for a given package?

2021-06-24 Thread Greg Minshall
Duncan,

> Bert gave you an answer that depends on ls().  Whether there's
> something like "set" that can return "asset" probably depends on
> your front end, and may be customizable using the facilities described
> in ?rcompgen.

thanks.  i am just using command line R on linux.  i tried setting
`rc.setting(fuzzy=TRUE, func=TRUE, ipck=TRUE)`, but
`data.table::set` still only shows names that start with "set".
Bert's `ls` answer works, but did you have an idea of how else this
might be made to work with rcompgen?

cheers, Greg

__
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-es] shiny cargar valores a objetos en formulario

2021-06-24 Thread patricio fuenmayor
Hola con todos
He realizado una aplicación a modo de formulario que al final guarda los
valores en base de datos.
Me han solicitado la funcionalidad de que se puedan cargar los valores
desde la base de datos al formulario. No tengo inconvenientes en los
objetos que son outputs pero no logro cargar los objetos inputs (textInput).
Usando reactiveValuesToList(input), al parecer estos objetos no se crean en
el *input* si el sidebarmenu del formulario no está activo. Como el menú de
búsqueda está en otro panel, no se inician estos valores. Les ha pasado
esto ??? saben cómo se puede crear manualmente este tipo de objetos en el
input y asignarles un valor?. El updateTextInput no funciona ... y tampoco
el input$variable <- valor

Saludos

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Mean absolute error from data matrix

2021-06-24 Thread PIKAL Petr
Hi.

First, please do not post in HTML. It usually scrambles any posted code.

Second, as you did not post any code or data your message was not scrambled 
but I wonder what are columns and what are rows and what do you actually 
calculates.

From

Suppose the ist column of the
> second matrix is Sunday then we choose each column of the first matrix
> having Sunday

I deduct that you have 24 rows and 1827 or 365 columns.

It sems to me that you will have easier situation if you transpose matrix, set 
column with dates. From that you can choose all dates fulfilling criteria 
(being Sunday)
See help page for Date
weekdays(.leap.seconds)

and you can do any calculation for each row
See tapply, aggregate, ...

Cheers
Petr


> -Original Message-
> From: R-help  On Behalf Of Faheem Jan via
> R-help
> Sent: Wednesday, June 23, 2021 8:03 PM
> To: R-help Mailing List 
> Subject: [R] Mean absolute error from data matrix
>
> I have data matrix of order 24*2192 where 2192 are the days and 24 are
> hour's of a single day,so simple words I have 2192 days and each day having
> 24 observations.the data matrix is divided into two matrix,the ist matrix is 
> of
> order 24*1827 and second is of order 24*365. Suppose the ist column of the
> second matrix is Sunday then we choose each column of the first matrix
> having Sunday. The takeing the first column of data matrix is converted into
> vector and all the Sunday columns are converted into vectors. Then we
> calculate mean absolute errors for different pairs of the first vector of 
> the
> second matrix with each vector of first matrix. Similarly process is 
> repeated
> for the rest of the week days. It clear that such process is quite time
> consuming and hard if perform manually. Can any one provides the easiest
> way to do such problem.Regard
>
> Sent from Yahoo Mail on Android
>   [[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-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.