Re: [R] dataRetrieval query error

2020-09-05 Thread Bill Dunlap
Name all your arguments (the vignette gets this wrong), including
siteNumber=siteNumbers.

Also, the vignette uses 'statCd', not 'statCD'.

dataAvailable <- whatNWISdata(siteNumber=siteNumbers, service="all",
statCd="all")

gives some results.

-Bill

On Sat, Sep 5, 2020 at 4:44 PM Rich Shepard 
wrote:

> I'm learning the dataRetrieval package. Following the example in Section
> 1.1.2 of the vignette (whatNWISdata) I prepared this script:
> --
> library("dataRetrieval")
>
> siteNumbers <-
> c("14207920","14208000","14208200","14208300","14208500","14208600","14208700","14208850","14209000","14209100","14209250","14209500","14209600","14209670","14209700","14209710","14209750","14209775","14209790","14209900","1421","14210005","14210020","14210025","14210030","14210100","14210150","14210152","14210160","14210200","14210255","14210400","14210480","14210490","14210500","14210530","14210535","14210600","14210650","14210676","14210750","14210760","14210765","14210800","14210830","14210850","14210900","14211000","14211004","14211005","14211006","14211008","14211010","14211023","14211494")
>
> dataAvailable <- whatNWISdata(siteNumbers, service="all",
> parameterCD="all", statCD="all")
> -
>
> The vignette says that for service, parameterCD, and statCD the default is
> "all", but the package wants that explicitly. So that's what I did. Yet, my
> syntax is still off:
>
> > source("R-scripts/get-site-data-list.R")
> Error: All components of query must be named
>
> Please show me what I'm missing.
>
> Rich
>
> __
> 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.
>

[[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] dataRetrieval query error

2020-09-05 Thread David Winsemius

This worked:


> dataAvailable <- whatNWISdata(siteNumber=siteNumbers)
> str(dataAvailable)
'data.frame':    2565 obs. of  24 variables:
 $ agency_cd : chr  "USGS" "USGS" "USGS" "USGS" ...
 $ site_no   : chr  "14207920" "14208000" "14208000" "14208000" ...
 $ station_nm    : chr  "POOP CREEK NEAR BIG BOTTOM, OR" "CLACKAMAS 
RIVER AT BIG BOTTOM, OREG." "CLACKAMAS RIVER AT BIG BOTTOM, OREG." 
"CLACKAMAS RIVER AT BIG BOTTOM, OREG." ...

 $ site_tp_cd    : chr  "ST" "ST" "ST" "ST" ...
 $ dec_lat_va    : num  45 45 45 45 44.9 ...
 $ dec_long_va   : num  -122 -122 -122 -122 -122 ...
 $ coord_acy_cd  : chr  "U" "U" "U" "U" ...
 $ dec_coord_datum_cd: chr  "NAD83" "NAD83" "NAD83" "NAD83" ...
 $ alt_va    : chr  " 2760.00" " 2040.00" " 2040.00" " 2040.00" ...
 $ alt_acy_va    : chr  " 20" " 20" " 20" " 20" ...
 $ alt_datum_cd  : chr  "NGVD29" "NGVD29" "NGVD29" "NGVD29" ...
 $ huc_cd    : chr  "17090011" "17090011" "17090011" "17090011" ...
 $ data_type_cd  : chr  "pk" "dv" "pk" "sv" ...
 $ parm_cd   : chr  NA "00060" NA NA ...
 $ stat_cd   : chr  NA "3" NA NA ...
 $ ts_id : num  0 114288 0 0 0 ...
 $ loc_web_ds    : chr  NA NA NA NA ...
 $ medium_grp_cd : chr  "wat" "wat" "wat" "wat" ...
 $ parm_grp_cd   : chr  NA NA NA NA ...
 $ srs_id    : num  0 1645423 0 0 0 ...
 $ access_cd : num  0 0 0 0 0 0 0 0 0 0 ...
 $ begin_date    : Date, format: "1966-05-05" "1920-04-01" 
"1921-01-03" ...
 $ end_date  : Date, format: "1983-01-06" "1970-09-29" 
"1970-01-23" ...

 $ count_nu  : num  17 18444 50 26 10 ...
 - attr(*, "comment")= chr  "#" "#" "# US Geological Survey" "# 
retrieved: 2020-09-05 20:18:46 -04:00\t(caas01)" ...

 - attr(*, "queryTime")= POSIXct, format: "2020-09-05 17:18:46"
 - attr(*, "url")= chr 
"https://waterservices.usgs.gov/nwis/site/?seriesCatalogOutput=true=14207920,14208000,14208200,14208300,14;| 
__truncated__

 - attr(*, "header")=List of 12
  ..$ date   : chr "Sun, 06 Sep 2020 00:18:45 GMT"
  ..$ server : chr "Apache-Coyote/1.1"
  ..$ strict-transport-security  : chr "max-age=31536000"
  ..$ vary   : chr "Accept-Encoding"
  ..$ content-encoding   : chr "gzip"
  ..$ content-type   : chr "text/plain;charset=UTF-8"
  ..$ cache-control  : chr "max-age=900"
  ..$ expires    : chr "Sun, 06 Sep 2020 00:33:46 GMT"
  ..$ x-ua-compatible    : chr "IE=edge,chrome=1"
  ..$ access-control-allow-origin: chr "*"
  ..$ x-frame-options    : chr "deny"
  ..$ transfer-encoding  : chr "chunked"
  ..- attr(*, "class")= chr  "insensitive" "list"


--

David.


On 9/5/20 4:44 PM, Rich Shepard wrote:


I'm learning the dataRetrieval package. Following the example in Section
1.1.2 of the vignette (whatNWISdata) I prepared this script:
--
library("dataRetrieval")

siteNumbers <- 
c("14207920","14208000","14208200","14208300","14208500","14208600","14208700","14208850","14209000","14209100","14209250","14209500","14209600","14209670","14209700","14209710","14209750","14209775","14209790","14209900","1421","14210005","14210020","14210025","14210030","14210100","14210150","14210152","14210160","14210200","14210255","14210400","14210480","14210490","14210500","14210530","14210535","14210600","14210650","14210676","14210750","14210760","14210765","14210800","14210830","14210850","14210900","14211000","14211004","14211005","14211006","14211008","14211010","14211023","14211494")


dataAvailable <- whatNWISdata(siteNumbers, service="all", 
parameterCD="all", statCD="all")

-

The vignette says that for service, parameterCD, and statCD the 
default is
"all", but the package wants that explicitly. So that's what I did. 
Yet, my

syntax is still off:

source("R-scripts/get-site-data-list.R") 

Error: All components of query must be named

Please show me what I'm missing.

Rich

__
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] dataRetrieval query error

2020-09-05 Thread Bert Gunter
You failed to name the first parameter, siteNumbers?


Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Sep 5, 2020 at 4:44 PM Rich Shepard 
wrote:

> I'm learning the dataRetrieval package. Following the example in Section
> 1.1.2 of the vignette (whatNWISdata) I prepared this script:
> --
> library("dataRetrieval")
>
> siteNumbers <-
> c("14207920","14208000","14208200","14208300","14208500","14208600","14208700","14208850","14209000","14209100","14209250","14209500","14209600","14209670","14209700","14209710","14209750","14209775","14209790","14209900","1421","14210005","14210020","14210025","14210030","14210100","14210150","14210152","14210160","14210200","14210255","14210400","14210480","14210490","14210500","14210530","14210535","14210600","14210650","14210676","14210750","14210760","14210765","14210800","14210830","14210850","14210900","14211000","14211004","14211005","14211006","14211008","14211010","14211023","14211494")
>
> dataAvailable <- whatNWISdata(siteNumbers, service="all",
> parameterCD="all", statCD="all")
> -
>
> The vignette says that for service, parameterCD, and statCD the default is
> "all", but the package wants that explicitly. So that's what I did. Yet, my
> syntax is still off:
>
> > source("R-scripts/get-site-data-list.R")
> Error: All components of query must be named
>
> Please show me what I'm missing.
>
> Rich
>
> __
> 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.
>

[[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] dataRetrieval query error

2020-09-05 Thread Rich Shepard

I'm learning the dataRetrieval package. Following the example in Section
1.1.2 of the vignette (whatNWISdata) I prepared this script:
--
library("dataRetrieval")

siteNumbers <- 
c("14207920","14208000","14208200","14208300","14208500","14208600","14208700","14208850","14209000","14209100","14209250","14209500","14209600","14209670","14209700","14209710","14209750","14209775","14209790","14209900","1421","14210005","14210020","14210025","14210030","14210100","14210150","14210152","14210160","14210200","14210255","14210400","14210480","14210490","14210500","14210530","14210535","14210600","14210650","14210676","14210750","14210760","14210765","14210800","14210830","14210850","14210900","14211000","14211004","14211005","14211006","14211008","14211010","14211023","14211494")

dataAvailable <- whatNWISdata(siteNumbers, service="all", parameterCD="all", 
statCD="all")
-

The vignette says that for service, parameterCD, and statCD the default is
"all", but the package wants that explicitly. So that's what I did. Yet, my
syntax is still off:

source("R-scripts/get-site-data-list.R") 

Error: All components of query must be named

Please show me what I'm missing.

Rich

__
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] Tabla con dibujo en R Markdown

2020-09-05 Thread Juan Carlos Lopez Mesa
Hola,

Tal vez esta pagina te sirva
https://cran.r-project.org/web/packages/kableExtra/vignettes/awesome_table_in_html.html


Saludos



El sáb., 5 sept. 2020 a las 0:45, Carlos Ortega ()
escribió:

> Hola,
>
> Sí, mira esta referencia:
>
>
> https://stackoverflow.com/questions/50108763/how-to-insert-images-into-table-in-r-markdown
>
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
> El sáb., 5 sept. 2020 a las 1:37, Samura . ()
> escribió:
>
>>
>> Hola a tod@s!!
>>
>> Se podría crear en R Markdown una tabla de este estilo?
>>
>>
>>
>>
>> A las malas se puede poner la tabla entera como una imagen, pero me
>> gustaría saber si R Markdown
>> permite meter imágenes dentro de tablas.
>>
>> Gracias.
>>
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] fusion of two matrices (numerical and logical)

2020-09-05 Thread Bert Gunter
A is not a matrix. I presume you meant B. If so:

> B[!C] <- 0
> B
 [,1] [,2] [,3] [,4]
[1,]1600
[2,]2000
[3,]3000
[4,]400   19
[5,]5000

Cheers,
Bert





On Sat, Sep 5, 2020 at 11:18 AM Vivek Sutradhara 
wrote:

> Hi
> I would like to get help in combining two matrices. Here is my example:
> A <- 1:20
> B <- matrix(A,nrow=5,ncol=4)
> # B is a numerical matrix
> C <- B<7
> C[4,4] <- TRUE
> # C is a logical matrix
> # if I combine A and C, I get a vector
> D1 <- A[C==TRUE]
> D1
> D2 <- A[C==FALSE]
> D2
>
> I want to get a matrix with the same dimensions as matrix A. At the
> coordinates given by the vector D1, I want to retain the values in
> matrix A. At the locations in D2, I want a zero value.
> I want to know if I can do this without using any loops.
> Thanks, Vivek
>
> [[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.
>

[[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] fusion of two matrices (numerical and logical)

2020-09-05 Thread Vivek Sutradhara
The result that I want to get is this:
for (i in 1:5) {
  for (j in 1:4) {
B[i,j] <- ifelse(C[i,j]==FALSE,0,B[i,j])
  }
}
I would like to know if I can do this without loops.

Den lör 5 sep. 2020 kl 20:18 skrev Vivek Sutradhara :

> Hi
> I would like to get help in combining two matrices. Here is my example:
> A <- 1:20
> B <- matrix(A,nrow=5,ncol=4)
> # B is a numerical matrix
> C <- B<7
> C[4,4] <- TRUE
> # C is a logical matrix
> # if I combine A and C, I get a vector
> D1 <- A[C==TRUE]
> D1
> D2 <- A[C==FALSE]
> D2
>
> I want to get a matrix with the same dimensions as matrix A. At the
> coordinates given by the vector D1, I want to retain the values in
> matrix A. At the locations in D2, I want a zero value.
> I want to know if I can do this without using any loops.
> Thanks, Vivek
>

[[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] fusion of two matrices (numerical and logical)

2020-09-05 Thread Vivek Sutradhara
Hi
I would like to get help in combining two matrices. Here is my example:
A <- 1:20
B <- matrix(A,nrow=5,ncol=4)
# B is a numerical matrix
C <- B<7
C[4,4] <- TRUE
# C is a logical matrix
# if I combine A and C, I get a vector
D1 <- A[C==TRUE]
D1
D2 <- A[C==FALSE]
D2

I want to get a matrix with the same dimensions as matrix A. At the
coordinates given by the vector D1, I want to retain the values in
matrix A. At the locations in D2, I want a zero value.
I want to know if I can do this without using any loops.
Thanks, Vivek

[[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] Vulnerabilidad

2020-09-05 Thread Javier Marcuzzi
Muchas gracias

El vie., 4 sept. 2020 a las 19:06, Carlos Ortega ()
escribió:

> Hola,
>
> Sí, en varias grandes empresas cuando me ha tocado participar en la puesta
> en marcha de un entorno con R/RStudio enseguida aparece la necesidad de
> instalar paquetes.
>
> Los responsables de IT aceptan la instalación de paquetes desde CRAN,
> prohiben tajantemente los que solo están en fase de desarrollo en GitHub.
> Pero es que incluso al os que vienen de CRAN buscan garantizar de alguna
> manera que éstos están libres de posibles vulnerabilidades, puntos débiles
> que puedan usar hackers para crear problemas en estos entornos de
> desarrollo (por mucho que se les comenta todo el proceso de comprobaciones,
> checks por los que un nuevo paquete pasa.
>
> La siguiente vez que me toque recomendar el uso de un entorno de R en un
> entorno empresarial, y vuelva a aparecer esta duda sobre las
> vulnerabilidades de los paquetes de CRAN, el usar este paquete aplicado
> sobre los nuevos que se quieran descargar será otro argumento (de peso)
> para dar tranquilidad a los de IT/Seguridad.
>
> Gracias,
> Carlos Ortega
> www.qualityexcellence.es
>
> El vie., 4 sept. 2020 a las 22:16, Javier Marcuzzi (<
> javier.ruben.marcu...@gmail.com>) escribió:
>
>> Estimado Carlos Ortega, veo que usted comenta algo sobre el siguiente
>> artículo
>> https://www.jumpingrivers.com/blog/r-package-vulnerabilities-security/ en
>> su LinkedIn.
>>
>> ¿Podría compartir su impresión, comentario, sugerencia?
>>
>> Desde ya muchas gracias.
>>
>> Javier Rubén Marcuzzi
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.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