Re: [R] How to make a deep copy of a list?

2022-11-12 Thread Ivan Krylov
В Sat, 12 Nov 2022 20:04:57 +
Giovanni Petris  пишет:

> The problem is that the C code modifies elements of the list so that,
> after the R function returns, I end up with a modified version of the
> list argument. I believe passing to the function a deep copy of the
> list argument would solve my problem.

Is it an option to change the C code? I think that the fault lies with
it, not with its caller. Except when using reference types, it should
be safe to make the assumption that variables in R are passed as if by
copy.

In the interest of getting a quick workaround, does
unserialize(serialize(L, NULL)) help? I would expect that to work unless
your list contains something like environments.

-- 
Best regards,
Ivan

__
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] How to make a deep copy of a list?

2022-11-12 Thread Jeff Newmiller
Or modifying the C code to conform with the usual functional copy-on-write 
paradigm used throughout most of R.

On November 12, 2022 12:04:57 PM PST, Giovanni Petris  wrote:
>Hello everybody,
>
>Does anybody know how to obtain a deep copy of a list?
>
>The context is the following. I am passing a list to a function which, in 
>turn, passes it to compiled C code via .Call. The problem is that the C code 
>modifies elements of the list so that, after the R function returns, I end up 
>with a modified version of the list argument. I believe passing to the 
>function a deep copy of the list argument would solve my problem.
>
>Thank you in advance for the help!
>
>Giovanni
>
>--
>Giovanni Petris
>Professor and Director of Statistics
>Department of Mathematical Sciences
>University of Arkansas
>Fayetteville, AR 72701
>USA
>
>
>
>   [[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] How to make a deep copy of a list?

2022-11-12 Thread Giovanni Petris
Hello everybody,

Does anybody know how to obtain a deep copy of a list?

The context is the following. I am passing a list to a function which, in turn, 
passes it to compiled C code via .Call. The problem is that the C code modifies 
elements of the list so that, after the R function returns, I end up with a 
modified version of the list argument. I believe passing to the function a deep 
copy of the list argument would solve my problem.

Thank you in advance for the help!

Giovanni

--
Giovanni Petris
Professor and Director of Statistics
Department of Mathematical Sciences
University of Arkansas
Fayetteville, AR 72701
USA



[[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] Logistic regression for large data

2022-11-12 Thread Ebert,Timothy Aaron
Hi George,
   I did not get an attachment.
   My first step would be to try simplifying things. Do all of these work?

fit_1=glm(Base[,2]~Base[,1],family=binomial(link="logit"))
fit_1=glm(Base[,2]~Base[,10],family=binomial(link="logit"))
fit_1=glm(Base[,2]~Base[,11],family=binomial(link="logit"))
fit_1=glm(Base[,2]~Base[,12],family=binomial(link="logit"))
fit_1=glm(Base[,2]~Base[,13],family=binomial(link="logit"))

This is not a large dataset. That said, if your computer is nearly out of 
memory, even a small dataset might be too much. It might have plenty of 
physical memory, but also lots of (open files, cookies, applications, other 
stuff) that eat memory.

Regards,
Tim



-Original Message-
From: R-help  On Behalf Of George Brida
Sent: Friday, November 11, 2022 4:17 PM
To: r-help@r-project.org
Subject: [R] Logistic regression for large data

[External Email]

Dear R users,

I have a database  called Base.csv   (attached to this email) which
contains 13 columns and 8257 rows and whose the first 8 columns are dummy 
variables which take 1 or 0. The problem is when I wrote the following 
instructions to do a logistic regression , R runs for hours and hours without 
giving an output:

Base=read.csv("C:\\Users\\HP\\Desktop\\New\\Base.csv",header=FALSE,sep=";")
fit_1=glm(Base[,2]~Base[,1]+Base[,10]+Base[,11]+Base[,12]+Base[,13],family=binomial(link="logit"))

Apparently, there is not enough memory to have the requested output. Is there 
any other function for logistic regression that handle large data and return 
output in reasonable time.

Many thanks

Kind regards

George
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-helpdata=05%7C01%7Ctebert%40ufl.edu%7Cb0af80b8620648fcc1ab08dac47fb19e%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638038350110240752%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7Csdata=oxeFwGCpH%2B9Ha%2BDFaWRygEcvOJ2O6AngSKNhMwE%2FczI%3Dreserved=0
PLEASE do read the posting guide 
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.htmldata=05%7C01%7Ctebert%40ufl.edu%7Cb0af80b8620648fcc1ab08dac47fb19e%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638038350110240752%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7Csdata=FtLW709kbnkMLzylkRRtR1Y%2Fw5oehodb0dmS8DqwGig%3Dreserved=0
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.


[ESS] flymake + lintr do not work as expected on emacs 27.2 linux Mint

2022-11-12 Thread Ottorino via ESS-help

Hi all, here is Ottorino from Florence, Italy.

After many years of emacs+ESS I'm not able to switch to RStudio, and I
won't, even if all my students and PhDs like it:  you can't teach an old 
dog new tricks


After neglecting my init files for some years, and loosing some
hotkeys, I'm now determined to restore all the functionalities I had
some time ago.

My current problem is that flymake + lintr do not work as expected on
my desktop, while they do on my laptop.

On both systems I have:
Linux Mint 20.3 una
ess-version: 18.10.3snapshot [elpa: 20221108.1714] (loaded from 
/home/user/.emacs.d/elpa/ess-20221108.1714/)

R version 4.2.2 (2022-10-31)

While on my laptop I have
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 
2021-12-14

while
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 
2020-03-26, modified by Debian

is on my desktop.

The desktop was not working and it was on Mint Tricia 19.03. so before
writing this mail, I upgraded it during last night to 20.3 una (both 
based on Ubuntu focal).


In both systems, .emacs.d is in common under GIT, so the configuration 
files are exactly the same.


Two similar copies of .lintr files are under the working dir

linters: linters_with_defaults(
    line_length_linter(120),
    object_name_linter(styles = c("dotted.case", "symbols"))
  )

and under my home

linters: linters_with_defaults(
    line_length_linter(119),
    object_name_linter(styles = c("snake_case", "symbols"))
  )

Well: it seems that emacs 27.2 do not cooperate well with flymake + lintr.
Any suggestion, beside downgrading emacs to 26.3 ?

Thanks
Ottorino

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help