Re: [R] Cook's distance for least absolute deviation (lad) regressions

2022-03-20 Thread Jim Lemon
Hi Kelly,
Perhaps the best place to look is the "car" package. There is a
somewhat confusing reference in the "cookd" function help page to the
"cooks.distance" function in the "base" package that doesn't seem to
be there.  Whether this is the case or not, I think you can still use
the "cookd" alias.

Jim

On Mon, Mar 21, 2022 at 11:57 AM Kelly Thompson  wrote:
>
> I'm wanting to calculate Cook's distance for least absolute deviation
> (lad) regressions.
>
> Which R packages and functions offer this?
>
> Thanks!
>
> __
> 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] Naming files within R code

2022-03-20 Thread Rui Barradas

Hello,

You can read in the files in a `lapply` loop, assign the result to a 
list, say df_list, and


names(df_list) <- c("tay","forth","don")
list2env(df_list, envir = globalenv())


This creates 3 data.frames with those names in the global environment.

Hope this helps,

Rui Barradas

Às 22:02 de 20/03/2022, Nick Wray escreveu:

HelloI have data from various Scottish river catchments in the form of
csv files.  I want to be able to download the files in turn and refer to
each one by an assigned name from a vector of names, but within R.  So, for
example, if my vector of names is c("tay","forth","don") I want to tell R
to refer to the sequences of dataframes as a variable name, ie the table
uploaded from the first csv becomes the object tay *within* R and so on, so
that I could the do things like write print(tay[,1]) etc,rather than having
to refer to a list eg print(riverlist[[1]][,1])  I don't know whether this
is possible but if it is I'd be grateful for any pointers
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.


__
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] Bug in R-install -- sysdata.rda

2022-03-20 Thread Jeff Newmiller
Please don't post to multiple lists at once... this is widely frowned on by 
many mailing lists. If you simply read the Posting Guide it will inform you 
that you should post questions "related to compiling" on r-devel.

I also recommend that you read the R Administration and Installation manual, 
because I don't think cygwin is actually a supported platform... the Rtools 
development tool chain is the supported approach for building on Windows.

On March 20, 2022 12:54:59 AM PDT, Manu goswami  wrote:
>Dear R Developers,
>
>Building R from source has never been straight forward but now it has become 
>impossible. Even when one compiles and links all files
>Still below error is stopping completing build process. This certainly is 
>deplorably mischievous. Please support to resolve immediately.
>
>Cygwin  + win 10 -> error installing sysdata.rda , 64 BIT.
>
>
>make[4]: Entering directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
>installing 'sysdata.rda'
>
>*** caught segfault ***
>address 0x18, cause 'memory not mapped'
>
>Traceback:
>1: .Call(PS_sigs, 1L)
>2: eval(exprs[i], envir)
>3: eval(exprs[i], envir)
>4: sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = 
>keep.parse.data)
>5: doTryCatch(return(expr), name, parentenv, handler)
>6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
>7: tryCatchList(expr, classes, parentenv, handlers)
>8: tryCatch(expr, error = function(e) {call <- conditionCall(e)if 
>(!is.null(call)) {if (identical(call[[1L]], quote(doTryCatch)))
> call <- sys.call(-4L)dcall <- deparse(call, nlines = 1L)
>prefix <- paste("Error in", dcall, ": ")LONG <- 75Lsm <- 
>strsplit(conditionMessage(e), "\n")[[1L]]w <- 14L + nchar(dcall, type 
>= "w") + nchar(sm[1L], type = "w")if (is.na(w)) w <- 14L + 
>nchar(dcall, type = "b") + nchar(sm[1L], type = "b")if 
>(w > LONG) prefix <- paste0(prefix, "\n  ")}else prefix <- 
>"Error : "msg <- paste0(prefix, conditionMessage(e), "\n")
>.Internal(seterrmessage(msg[1L]))if (!silent && 
>isTRUE(getOption("show.error.messages"))) {cat(msg, file = outFile)
>.Internal(printDeferredWarnings())}invisible(structure(msg, class 
>= "try-error", condition = e))})
>9: try(sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = 
>keep.parse.data))
>10: loadNamespace(x)
>An irrecoverable exception occurred. R is aborting now ...
>/bin/sh: line 1: 52047 Doneecho 
>"tools:::sysdata2LazyLoadDB(\"./R/sysdata.rda\",\"../../../library/tools/R\")"
> 52048 Segmentation fault  (core dumped) | R_DEFAULT_PACKAGES=NULL 
> LC_ALL=C R_ENABLE_JIT=0 TZ=UTC ../../../bin/R --vanilla --no-echo
>make[4]: *** [../../../share/make/basepkg.mk:151: sysdata] Error 139
>make[4]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
>make[3]: *** [Makefile:36: all] Error 2
>make[3]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
>make[2]: *** [Makefile:37: R] Error 1
>make[2]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library'
>make[1]: *** [Makefile:28: R] Error 1
>make[1]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src'
>make: *** [Makefile:61: R] Error 1
>
>Warm Regards,
>Manu
>Sent from Mail for Windows
>
>
>
>   [[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] Naming files within R code

2022-03-20 Thread Nick Wray
HelloI have data from various Scottish river catchments in the form of
csv files.  I want to be able to download the files in turn and refer to
each one by an assigned name from a vector of names, but within R.  So, for
example, if my vector of names is c("tay","forth","don") I want to tell R
to refer to the sequences of dataframes as a variable name, ie the table
uploaded from the first csv becomes the object tay *within* R and so on, so
that I could the do things like write print(tay[,1]) etc,rather than having
to refer to a list eg print(riverlist[[1]][,1])  I don't know whether this
is possible but if it is I'd be grateful for any pointers
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.


Re: [R] Bug in R-install -- sysdata.rda

2022-03-20 Thread Manu goswami
Dear R Developers,

Building R from source has never been straight forward but now it has become 
impossible. Even when one compiles and links all files
Still below error is stopping completing build process. This certainly is 
deplorably mischievous. Please support to resolve immediately.

Cygwin  + win 10 -> error installing sysdata.rda , 64 BIT.


make[4]: Entering directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
installing 'sysdata.rda'

*** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
1: .Call(PS_sigs, 1L)
2: eval(exprs[i], envir)
3: eval(exprs[i], envir)
4: sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = 
keep.parse.data)
5: doTryCatch(return(expr), name, parentenv, handler)
6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
7: tryCatchList(expr, classes, parentenv, handlers)
8: tryCatch(expr, error = function(e) {call <- conditionCall(e)if 
(!is.null(call)) {if (identical(call[[1L]], quote(doTryCatch))) 
call <- sys.call(-4L)dcall <- deparse(call, nlines = 1L)
prefix <- paste("Error in", dcall, ": ")LONG <- 75Lsm <- 
strsplit(conditionMessage(e), "\n")[[1L]]w <- 14L + nchar(dcall, type = 
"w") + nchar(sm[1L], type = "w")if (is.na(w)) w <- 14L + 
nchar(dcall, type = "b") + nchar(sm[1L], type = "b")if 
(w > LONG) prefix <- paste0(prefix, "\n  ")}else prefix <- 
"Error : "msg <- paste0(prefix, conditionMessage(e), "\n")
.Internal(seterrmessage(msg[1L]))if (!silent && 
isTRUE(getOption("show.error.messages"))) {cat(msg, file = outFile) 
   .Internal(printDeferredWarnings())}invisible(structure(msg, class = 
"try-error", condition = e))})
9: try(sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = 
keep.parse.data))
10: loadNamespace(x)
An irrecoverable exception occurred. R is aborting now ...
/bin/sh: line 1: 52047 Doneecho 
"tools:::sysdata2LazyLoadDB(\"./R/sysdata.rda\",\"../../../library/tools/R\")"
 52048 Segmentation fault  (core dumped) | R_DEFAULT_PACKAGES=NULL 
LC_ALL=C R_ENABLE_JIT=0 TZ=UTC ../../../bin/R --vanilla --no-echo
make[4]: *** [../../../share/make/basepkg.mk:151: sysdata] Error 139
make[4]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
make[3]: *** [Makefile:36: all] Error 2
make[3]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library/tools'
make[2]: *** [Makefile:37: R] Error 1
make[2]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src/library'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/cygdrive/c/ons_1/e2/4.1.2/src'
make: *** [Makefile:61: R] Error 1

Warm Regards,
Manu
Sent from Mail for Windows



[[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] Can browseURL open a lynx browser?

2022-03-20 Thread Viechtbauer, Wolfgang (SP)
Dear Ashim,

If you really want to use lynx, then you need to open up a new terminal to make 
this work. For example, this will do:

browseURL("http://www.r-project.org","xterm -e lynx")

But this will open up a new terminal for each call to browseURL().

Best,
Wolfgang

>-Original Message-
>From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ashim Kapoor
>Sent: Sunday, 20 March, 2022 10:42
>To: Jeff Newmiller
>Cc: R Help
>Subject: Re: [R] Can browseURL open a lynx browser?
>
>Dear Sir,
>
>> You mention reading the ?browseURL help page, but seem to make no reference 
>> to
>the available options for invoking the browser of your choice. If the browser 
>you
>choose isn't behaving when you do this, then isn't this a question for a forum
>related to that browser?
>
>OK.
>
>Thank you,
>Ashim

__
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] Combining data.frames

2022-03-20 Thread Rui Barradas

Hello,

The two merge below give identical results.
Maybe there was something in your R session?


df3 <- merge(df1, df2, by = c("date", "geo_hash" ), all = TRUE)
df3b <- merge(df1, df2, all = TRUE)
identical(df3, df3b)
#[1] TRUE

Hope this helps,

Rui Barradas

Às 02:05 de 20/03/2022, Jeff Reichman escreveu:

Ok this seems to work correctly

df1 <- data.frame(date = 
as.factor(c("2021-1-1","2021-1-1","2021-1-1","2021-1-1","2021-1-1",

"2021-1-2","2021-1-2","2021-1-3","2021-1-3","2021-1-3",
"2021-1-4")),
   geo_hash = 
as.factor(c("abc123","abc123","abc456","abc789","abc246","abc123",
"asd123","abc789","abc890","abc123","z12345")),
   ad_id = 
as.factor(c("a12345","b12345","a12345","a12345","c12345",
 
"b12345","b12345","a12345","b12345","a12345","a12345")))
df2 <- data.frame(date = 
as.factor(c("2021-1-1","2021-1-1","2021-1-2","2021-1-3","2021-1-3","2021-1-4")),
   geo_hash = 
as.factor(c("abc123","abc456","abc123","abc789","abc890","w12345")),
   event = 
as.factor(c("shoting","ied","protest","riot","protest","killing")))

df1
df2

#df3 <- merge(df1, df2, all = TRUE)
df3 <- merge(df1, df2, by = c("date", "geo_hash" ), all = TRUE)
df3

-Original Message-
From: Jeff Newmiller 
Sent: Saturday, March 19, 2022 8:55 PM
To: reichm...@sbcglobal.net; Jeff Reichman ; 'Tom Woolman' 

Cc: r-help@r-project.org
Subject: Re: [R] Combining data.frames

by = c("date", "geo_hash" )

On March 19, 2022 6:31:19 PM PDT, Jeff Reichman  wrote:

Yes I'm reading that presently

The closest I've gotten has been

df3 <- merge(df1, df2, all = TRUE)

-Original Message-
From: Tom Woolman 
Sent: Saturday, March 19, 2022 8:27 PM
To: reichm...@sbcglobal.net
Cc: r-help@r-project.org
Subject: Re: [R] Combining data.frames

You can also do "SQL-like" joins in the tidyverse with dplyr.


On 2022-03-19 21:23, Jeff Reichman wrote:

Evening Tom

Yest I've been playing with the merge function.  But haven't been
able to achieve what I need. Could maybe the way to to and it might
be my syntax

-Original Message-
From: Tom Woolman 
Sent: Saturday, March 19, 2022 8:20 PM
To: reichm...@sbcglobal.net
Cc: r-help@r-project.org
Subject: Re: [R] Combining data.frames

Have you looked at the merge function in base R?

https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/me
r
ge


On 2022-03-19 21:15, Jeff Reichman wrote:

R-Help Community

I'm trying to combine two data.frames which each containing 10
columns of which they each share two common fields. Here are two
small test datasets.

df1 <- data.frame(date =
c("2021-1-1","2021-1-1","2021-1-1","2021-1-1","2021-1-1",

"2021-1-2","2021-1-2","2021-1-3","2021-1-3","2021-1-3"),
   geo_hash =
c("abc123","abc123","abc456","abc789","abc246","abc123",
"asd123","abc789","abc890","abc123"),
   ad_id =
c("a12345","b12345","a12345","a12345","c12345",

"b12345","b12345","a12345","b12345","a12345"))
df2 <- data.frame(date =
c("2021-1-1","2021-1-1","2021-1-2","2021-1-3","2021-1-3"),
   geo_hash =
c("abc123","abc456","abc123","abc789","abc890"),
   event =
c("shoting","ied","protest","riot","protest"))

I'm trying to combine them such that I get a combined data.frames
such as

dategeo_hashad_id   event
1/1/2021abc123  a12345  shoting
1/1/2021abc123  b12345
1/1/2021abc456  a12345  ied
1/1/2021abc789  a12345
1/1/2021abc246  c12345

Jeff

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


--
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-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] Can browseURL open a lynx browser?

2022-03-20 Thread Ashim Kapoor
Dear Sir,

> You mention reading the ?browseURL help page, but seem to make no reference 
> to the available options for invoking the browser of your choice. If the 
> browser you choose isn't behaving when you do this, then isn't this a 
> question for a forum related to that browser?

OK.

Thank you,
Ashim

__
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] Can browseURL open a lynx browser?

2022-03-20 Thread Ashim Kapoor
Dear Sir,

> I haven't used lynx in a while, but
>
> browseURL("http://www.google.com;, browser = "elinks -remote")
>
> works for me as long as an elinks session is already running.

The above elinks incantation is working for me.

Many thanks,
Ashim

__
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] Can browseURL open a lynx browser?

2022-03-20 Thread Deepayan Sarkar
On Sun, Mar 20, 2022 at 12:39 PM Ashim Kapoor  wrote:
>
> Dear all,
>
> I wish to do :
>
> browseURL("http://www.google.com","lynx;)
>
> But this is not opening the lynx browser. I am able to open lynx from
> the Debian command line and lynx is on the PATH.

I haven't used lynx in a while, but

browseURL("http://www.google.com;, browser = "elinks -remote")

works for me as long as an elinks session is already running.

Best,
-Deepayan

> When I do :
>
> browseURL("http://www.google.com;)
>
> it does open up the url in Firefox.
>
> When I do ?browseURL it says:
>
>   If ‘browser’ supports remote control and R knows how to
>   perform it, the URL is opened in any already-running browser
>   or a new one if necessary.  This mechanism currently is
>   available for browsers which support the ‘"-remote
>   openURL(...)"’ interface (which includes Mozilla and Opera),
>   Galeon, KDE konqueror (_via_ kfmclient) and the GNOME
>   interface to Mozilla. (Firefox has dropped support, but
>   defaults to using an already-running browser.)  Note that the
>   type of browser is determined from its name, so this
>   mechanism will only be used if the browser is installed under
>   its canonical name.
>
> How can I find out if the -remote openURL interface is supported by lynx?
>
> Thank you,
> Ashim
>
> __
> 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] Can browseURL open a lynx browser?

2022-03-20 Thread Jeff Newmiller
You mention reading the ?browseURL help page, but seem to make no reference to 
the available options for invoking the browser of your choice. If the browser 
you choose isn't behaving when you do this, then isn't this a question for a 
forum related to that browser?

On March 20, 2022 12:09:05 AM PDT, Ashim Kapoor  wrote:
>Dear all,
>
>I wish to do :
>
>browseURL("http://www.google.com","lynx;)
>
>But this is not opening the lynx browser. I am able to open lynx from
>the Debian command line and lynx is on the PATH.
>
>When I do :
>
>browseURL("http://www.google.com;)
>
>it does open up the url in Firefox.
>
>When I do ?browseURL it says:
>
>  If ‘browser’ supports remote control and R knows how to
>  perform it, the URL is opened in any already-running browser
>  or a new one if necessary.  This mechanism currently is
>  available for browsers which support the ‘"-remote
>  openURL(...)"’ interface (which includes Mozilla and Opera),
>  Galeon, KDE konqueror (_via_ kfmclient) and the GNOME
>  interface to Mozilla. (Firefox has dropped support, but
>  defaults to using an already-running browser.)  Note that the
>  type of browser is determined from its name, so this
>  mechanism will only be used if the browser is installed under
>  its canonical name.
>
>How can I find out if the -remote openURL interface is supported by lynx?
>
>Thank you,
>Ashim
>
>__
>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.