Re: [R] help on date objects...

2024-07-28 Thread Rui Barradas

Às 05:23 de 28/07/2024, akshay kulkarni escreveu:

Dear members,
  WHy is the following code returning NA instead of 
the date?



as.Date("2022-01-02", origin = "1900-01-01",  format = "%y%d%m")

[1] NA


Thanking you,
Yours sincerely,
AKSHAY M KULKARNI

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

Hello,

There are several reasons for your result.

1. You have 4 digits year but format %y (lower case = 2 digits year) It 
should be %Y

2. Your date has '-' as separator but your format doesn't have a separator.

Also, though less important:

1. You don't need argument origin. This is only needed with numeric to 
date coercion.

2. Are you sure the format is -DD-MM, year-day-month?


as.Date("2022-01-02", format = "%Y-%d-%m")
#> [1] "2022-02-01"

# note the origin is not your posted origin date,
# see the examples on Windows and Excel
# dates in help("as.Date")
as.Date(19024, origin = "1970-01-01")
#> [1] "2022-02-01"


Hope this helps,

Rui Barradas


--
Este e-mail foi analisado pelo software antivírus AVG para verificar a presença 
de vírus.
www.avg.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.


Re: [R] help on date objects...

2024-07-27 Thread Eric Berger
as.Date("2022-01-02", origin="1900-01-01", format="%Y-%d-%m")

On Sun, Jul 28, 2024 at 7:24 AM akshay kulkarni 
wrote:

> Dear members,
>  WHy is the following code returning NA
> instead of the date?
>
>
> > as.Date("2022-01-02", origin = "1900-01-01",  format = "%y%d%m")
> [1] NA
>
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[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] Help trying to understand R documentation on libraries paths

2024-06-17 Thread peter dalgaard
I am not going to search the sources for it (your problem, your work ;-) ), but 
the wording would be consistent with a call like

.libPaths(c(Sys.getenv("R_LIBS"), Sys.getenv("R_LIBS_USER")))

-pd

> On 17 Jun 2024, at 13:40 , Iago Giné Vázquez  wrote:
> 
> Thanks,
> 
> Regarding .libPaths, I am asking for the call to `.libPaths()`, so I 
> understand there is no `new` in the call, as in the documentation I cited.
> 
> Iago
> 
> De: peter dalgaard 
> Enviat el: dilluns, 17 de juny de 2024 13:26
> Per a: Iago Giné Vázquez 
> A/c: r-help@r-project.org 
> Tema: Re: [R] Help trying to understand R documentation on libraries paths
>  
> (Inline)
> 
> > On 17 Jun 2024, at 09:51 , Iago Giné Vázquez  wrote:
> > 
> > Hi,
> > 
> > 1 - On help(".libPaths", help_type = "text") one can read:
> > 
> > First, '.Library.site' is initialized from 'R_LIBS_SITE'.
> > 
> > However, I have
> > 
> >> Sys.getenv("R_LIBS_SITE")
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/site-library"
> >> .Library.site
> > character(0)
> > 
> > Is this consistent?
> 
> It is implied that R_LIBS_SITE should point to an existing directory. I see 
> the same thing on Mac:
> 
> > .Library.site
> character(0)
> > Sys.getenv("R_LIBS_SITE")
> [1] "/Library/Frameworks/R.framework/Resources/site-library"
> > list.files(Sys.getenv("R_LIBS_SITE"))
> character(0)
> 
> I.e., R_LIBS_SITE is where a site library _if any_ should live. If it is not 
> there, there is no poin in searching it. Unless you actually have a 
> site-library, I don't think there is a problem.
> 
> > 
> > 2 - Next, on the same help document, one can read:
> > 
> > Then, '.libPaths()' is called with the combination
> > of the directories given by 'R_LIBS' and 'R_LIBS_USER'.
> > 
> > 
> > This time, I get
> >> Sys.getenv("R_LIBS")
> > [1] ""
> >> Sys.getenv("R_LIBS_USER")
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library"
> >> .libPaths()
> > [1] "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library" 
> > "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> > 
> > 
> > Later is written:
> > 
> > Function '.libPaths' always uses the values of '.Library' and
> > '.Library.site' in the base namespace.
> > 
> > and indeed
> > 
> >> .Library
> > [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> > 
> > 
> > Then, shouldn't be this specified above together with "directories given by 
> > 'R_LIBS' and 'R_LIBS_USER'"?
> > 
> 
> The logic of .libPath() is 
> 
> > .libPaths
> function (new, include.site = TRUE) 
> {
> if (!missing(new)) {
> new <- Sys.glob(path.expand(new))
> paths <- c(new, if (include.site) .Library.site, .Library)
> paths <- paths[dir.exists(paths)]
> .lib.loc <<- unique(normalizePath(paths, "/"))
> }
> else .lib.loc
> }
> 
> so if you "call it with" new=something, then (.Library.site, .Library) is 
> automagically appended, unless you expressly tell it not to. 
> 
> -pd
> 
> > 
> > Am I understanding it wrongly? Otherwise, what do you think on the current 
> > way this help page is explained?
> > 
> > Thank you for your help and time.
> > 
> > Best regards,
> > 
> > Iago
> > 
> >[[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

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


Re: [R] Help trying to understand R documentation on libraries paths

2024-06-17 Thread Iago Giné Vázquez
Thanks,

Regarding .libPaths, I am asking for the call to `.libPaths()`, so I understand 
there is no `new` in the call, as in the documentation I cited.

Iago


De: peter dalgaard 
Enviat el: dilluns, 17 de juny de 2024 13:26
Per a: Iago Gin� V�zquez 
A/c: r-help@r-project.org 
Tema: Re: [R] Help trying to understand R documentation on libraries paths

(Inline)

> On 17 Jun 2024, at 09:51 , Iago Gin� V�zquez  wrote:
>
> Hi,
>
> 1 - On help(".libPaths", help_type = "text") one can read:
>
> First, '.Library.site' is initialized from 'R_LIBS_SITE'.
>
> However, I have
>
>> Sys.getenv("R_LIBS_SITE")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/site-library"
>> .Library.site
> character(0)
>
> Is this consistent?

It is implied that R_LIBS_SITE should point to an existing directory. I see the 
same thing on Mac:

> .Library.site
character(0)
> Sys.getenv("R_LIBS_SITE")
[1] "/Library/Frameworks/R.framework/Resources/site-library"
> list.files(Sys.getenv("R_LIBS_SITE"))
character(0)

I.e., R_LIBS_SITE is where a site library _if any_ should live. If it is not 
there, there is no poin in searching it. Unless you actually have a 
site-library, I don't think there is a problem.

>
> 2 - Next, on the same help document, one can read:
>
> Then, '.libPaths()' is called with the combination
> of the directories given by 'R_LIBS' and 'R_LIBS_USER'.
>
>
> This time, I get
>> Sys.getenv("R_LIBS")
> [1] ""
>> Sys.getenv("R_LIBS_USER")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library"
>> .libPaths()
> [1] "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library" 
> "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
>
>
> Later is written:
>
> Function '.libPaths' always uses the values of '.Library' and
> '.Library.site' in the base namespace.
>
> and indeed
>
>> .Library
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
>
>
> Then, shouldn't be this specified above together with "directories given by 
> 'R_LIBS' and 'R_LIBS_USER'"?
>

The logic of .libPath() is

> .libPaths
function (new, include.site = TRUE)
{
if (!missing(new)) {
new <- Sys.glob(path.expand(new))
paths <- c(new, if (include.site) .Library.site, .Library)
paths <- paths[dir.exists(paths)]
.lib.loc <<- unique(normalizePath(paths, "/"))
}
else .lib.loc
}

so if you "call it with" new=something, then (.Library.site, .Library) is 
automagically appended, unless you expressly tell it not to.

-pd

>
> Am I understanding it wrongly? Otherwise, what do you think on the current 
> way this help page is explained?
>
> Thank you for your help and time.
>
> Best regards,
>
> Iago
>
>[[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] Help trying to understand R documentation on libraries paths

2024-06-17 Thread peter dalgaard
(Inline)

> On 17 Jun 2024, at 09:51 , Iago Giné Vázquez  wrote:
> 
> Hi,
> 
> 1 - On help(".libPaths", help_type = "text") one can read:
> 
> First, '.Library.site' is initialized from 'R_LIBS_SITE'.
> 
> However, I have
> 
>> Sys.getenv("R_LIBS_SITE")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/site-library"
>> .Library.site
> character(0)
> 
> Is this consistent?

It is implied that R_LIBS_SITE should point to an existing directory. I see the 
same thing on Mac:

> .Library.site
character(0)
> Sys.getenv("R_LIBS_SITE")
[1] "/Library/Frameworks/R.framework/Resources/site-library"
> list.files(Sys.getenv("R_LIBS_SITE"))
character(0)

I.e., R_LIBS_SITE is where a site library _if any_ should live. If it is not 
there, there is no poin in searching it. Unless you actually have a 
site-library, I don't think there is a problem.

> 
> 2 - Next, on the same help document, one can read:
> 
> Then, '.libPaths()' is called with the combination
> of the directories given by 'R_LIBS' and 'R_LIBS_USER'.
> 
> 
> This time, I get
>> Sys.getenv("R_LIBS")
> [1] ""
>> Sys.getenv("R_LIBS_USER")
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library"
>> .libPaths()
> [1] "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.0/library" 
> "C:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> 
> 
> Later is written:
> 
> Function '.libPaths' always uses the values of '.Library' and
> '.Library.site' in the base namespace.
> 
> and indeed
> 
>> .Library
> [1] "c:/Users/i.gine/AppData/Local/Programs/R/R-4.4.1/library"
> 
> 
> Then, shouldn't be this specified above together with "directories given by 
> 'R_LIBS' and 'R_LIBS_USER'"?
> 

The logic of .libPath() is 

> .libPaths
function (new, include.site = TRUE) 
{
if (!missing(new)) {
new <- Sys.glob(path.expand(new))
paths <- c(new, if (include.site) .Library.site, .Library)
paths <- paths[dir.exists(paths)]
.lib.loc <<- unique(normalizePath(paths, "/"))
}
else .lib.loc
}

so if you "call it with" new=something, then (.Library.site, .Library) is 
automagically appended, unless you expressly tell it not to. 

-pd

> 
> Am I understanding it wrongly? Otherwise, what do you think on the current 
> way this help page is explained?
> 
> Thank you for your help and time.
> 
> Best regards,
> 
> Iago
> 
>   [[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.


Re: [R] help - Package: stats - function ar.ols

2024-02-23 Thread Ebert,Timothy Aaron
The data came through fine, the program was a miss. Can you paste the program 
into a ".txt" document like a notepad file and send that? You could also paste 
it into your email IF your email is configured to send text and NOT html.

TIm

-Original Message-
From: R-help  On Behalf Of Pedro Gavronski.
Sent: Friday, February 23, 2024 5:00 AM
To: Rui Barradas 
Cc: r-help@r-project.org; r-help-requ...@r-project.org
Subject: Re: [R] help - Package: stats - function ar.ols

[External Email]

Hello,

Thanks for the reply Rui and for pointing out that I forgot to attach my code. 
Please find attached in this email my code and data.

Thanks in advance.

Best regards, Pedro Gerhardt Gavronski.

On Fri, Feb 23, 2024 at 5:50 AM Rui Barradas  wrote:
>
> Às 16:34 de 22/02/2024, Pedro Gavronski. escreveu:
> > Hello,
> >
> > My name is Pedro and it is nice to meet you all. I am having trouble
> > understanding a message that I receive when use function ar.ols from
> > package stats, it says that "Warning message:
> > In ar.ols(x = dtb[2:6966, ], demean = FALSE, intercept = TRUE,
> > prewhite = TRUE) :
> >model order:  2 singularities in the computation of the
> > projection matrix results are only valid up to model order 1, which
> > I do not know what it means, if someone could clarify it, I would
> > really appreciate it.
> >
> > Attached to this email you will find my code and data I used to run
> > this formula.
> >
> > Thanks in advance.
> >
> > Best regards,  Pedro.
> >
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://st/
> > at.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C02%7Ctebert%40ufl
> > .edu%7C0afd65836d774adc099408dc349f53c7%7C0d4da0f84a314d76ace60a6233
> > 1e1b84%7C0%7C0%7C638443106144255449%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi
> > MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C
> > %7C&sdata=12OGc13jk3Lejmcvx5WH8Bko8JSpRxbtW3mzL3OIjyk%3D&reserved=0
> > PLEASE do read the posting guide
> > http://www/
> > .r-project.org%2Fposting-guide.html&data=05%7C02%7Ctebert%40ufl.edu%
> > 7C0afd65836d774adc099408dc349f53c7%7C0d4da0f84a314d76ace60a62331e1b8
> > 4%7C0%7C0%7C638443106144262387%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL
> > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&s
> > data=fAVz0iQ0zS5pmrxrzNeazRrrv%2FyjFdWvwMfgjhibdEA%3D&reserved=0
> > and provide commented, minimal, self-contained, reproducible code.
> Hello,
>
> Thanks for the data but the code is missing from the attachment.
> Can you please post your code? In an attachment or directly in the
> e-mail body.
>
> Rui Barradas
>
>
> --
> Este e-mail foi analisado pelo software antivírus AVG para verificar a 
> presença de vírus.
> http://www.a/
> vg.com%2F&data=05%7C02%7Ctebert%40ufl.edu%7C0afd65836d774adc099408dc34
> 9f53c7%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638443106144266047
> %7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I
> k1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=rdqEhXdZ5%2FThzbhuKgspNaBPyhf
> aC%2BWh7MFq4iq%2BxVE%3D&reserved=0
__
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] help - Package: stats - function ar.ols

2024-02-23 Thread Rui Barradas

Às 16:34 de 22/02/2024, Pedro Gavronski. escreveu:

Hello,

My name is Pedro and it is nice to meet you all. I am having trouble
understanding a message that I receive when use function ar.ols from
package stats, it says that "Warning message:
In ar.ols(x = dtb[2:6966, ], demean = FALSE, intercept = TRUE,
prewhite = TRUE) :
   model order:  2 singularities in the computation of the projection
matrix results are only valid up to model order 1, which I do not know
what it means, if someone could clarify it, I would really appreciate
it.

Attached to this email you will find my code and data I used to run
this formula.

Thanks in advance.

Best regards,  Pedro.


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

Hello,

Thanks for the data but the code is missing from the attachment.
Can you please post your code? In an attachment or directly in the 
e-mail body.


Rui Barradas


--
Este e-mail foi analisado pelo software antivírus AVG para verificar a presença 
de vírus.
www.avg.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.


Re: [R] Help

2024-02-22 Thread Ben Bolker

  I agree that the posting guide is due for updating.

  If the mailing list maintainers were willing I think r-consult might 
not be a terrible idea. I do think the center of gravity has moved to 
Cross Validated, and it might be minimally sufficient to point people 
there (or Math Overflow for probability/math questions) rather than 
starting a new group.


On 2024-02-21 12:53 p.m., Joakim Linde wrote:

Lisa, this seems to be fairly straight forward to do in R and I'm happy to help 
you get started. However, please be aware that you do have to have knowledge of 
statistics to do the analysis/modeling.

Rolf, Jeff, I do appreciate your view that this is not a R probelm. It's more a 'how to 
use R' / 'help me get started' problem. The posting guidelines point to "Usenet 
groups sci.stat.consult (applied statistics and consulting) and sci.stat.math 
(mathematical stat and probability)." Since Google announced [1] that Google groups 
will not support new usenet content starting tomorrow, would it make sense to have a 
r-consult mailing list or tag it [consult] on r-help?

Regards,
Joakim

[1]: https://support.google.com/groups/answer/11036538

On Wed, Feb 21, 2024, at 1:28 AM, Jeff Newmiller via R-help wrote:

Regarding 1 and 2, please read the Posting Guide mentioned at the
bottom of every R-help post. R does not equal statistics... and
education about statistics is way too ambitious to include in this
mailing list that is about a tool that happens to be useful for
statisticians.

There are forums online that do cater to statistical methods (e.g.
Cross Validated or many results from a search engine)... but such
conversations can be extensive so as Rolf suggests this is a good time
to learn what resources your educational institutions can provide...
online forums may be too limiting when your questions are so vague.

On February 20, 2024 2:14:58 PM PST, Rolf Turner  wrote:


On Mon, 19 Feb 2024 17:39:23 +0100
Lisa Hupfer via R-help  wrote:


I am writing my master thesis in which I compared two cultures . So
for my statistics I need to compare Age,Sex,Culture as well as have a
look at the tasks scores .

Anyone familiar with this ?
I’d love to share my script so you guide me where I did wrong .


(1) This post is far too vague to be appropriate for this list.

(2) You should learn some statistics; probably linear modelling.

(3) You should talk to your thesis advisor.

(4) Please see fortunes::fortune(285).

cheers,

Rolf Turner




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


__
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] Help

2024-02-22 Thread Joakim Linde
Lisa, this seems to be fairly straight forward to do in R and I'm happy to help 
you get started. However, please be aware that you do have to have knowledge of 
statistics to do the analysis/modeling.  

Rolf, Jeff, I do appreciate your view that this is not a R probelm. It's more a 
'how to use R' / 'help me get started' problem. The posting guidelines point to 
"Usenet groups sci.stat.consult (applied statistics and consulting) and 
sci.stat.math (mathematical stat and probability)." Since Google announced [1] 
that Google groups will not support new usenet content starting tomorrow, would 
it make sense to have a r-consult mailing list or tag it [consult] on r-help?

Regards, 
Joakim

[1]: https://support.google.com/groups/answer/11036538

On Wed, Feb 21, 2024, at 1:28 AM, Jeff Newmiller via R-help wrote:
> Regarding 1 and 2, please read the Posting Guide mentioned at the 
> bottom of every R-help post. R does not equal statistics... and 
> education about statistics is way too ambitious to include in this 
> mailing list that is about a tool that happens to be useful for 
> statisticians.
>
> There are forums online that do cater to statistical methods (e.g. 
> Cross Validated or many results from a search engine)... but such 
> conversations can be extensive so as Rolf suggests this is a good time 
> to learn what resources your educational institutions can provide... 
> online forums may be too limiting when your questions are so vague.
>
> On February 20, 2024 2:14:58 PM PST, Rolf Turner  
> wrote:
>>
>>On Mon, 19 Feb 2024 17:39:23 +0100
>>Lisa Hupfer via R-help  wrote:
>>
>>> I am writing my master thesis in which I compared two cultures . So
>>> for my statistics I need to compare Age,Sex,Culture as well as have a
>>> look at the tasks scores .
>>> 
>>> Anyone familiar with this ?
>>> I’d love to share my script so you guide me where I did wrong .
>>
>>(1) This post is far too vague to be appropriate for this list.
>>
>>(2) You should learn some statistics; probably linear modelling.
>>
>>(3) You should talk to your thesis advisor.
>>
>>(4) Please see fortunes::fortune(285).
>>
>>cheers,
>>
>>Rolf Turner
>>
>>
>
> -- 
> 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] Help

2024-02-20 Thread Jeff Newmiller via R-help
Regarding 1 and 2, please read the Posting Guide mentioned at the bottom of 
every R-help post. R does not equal statistics... and education about 
statistics is way too ambitious to include in this mailing list that is about a 
tool that happens to be useful for statisticians.

There are forums online that do cater to statistical methods (e.g. Cross 
Validated or many results from a search engine)... but such conversations can 
be extensive so as Rolf suggests this is a good time to learn what resources 
your educational institutions can provide... online forums may be too limiting 
when your questions are so vague.

On February 20, 2024 2:14:58 PM PST, Rolf Turner  wrote:
>
>On Mon, 19 Feb 2024 17:39:23 +0100
>Lisa Hupfer via R-help  wrote:
>
>> I am writing my master thesis in which I compared two cultures . So
>> for my statistics I need to compare Age,Sex,Culture as well as have a
>> look at the tasks scores .
>> 
>> Anyone familiar with this ?
>> I’d love to share my script so you guide me where I did wrong .
>
>(1) This post is far too vague to be appropriate for this list.
>
>(2) You should learn some statistics; probably linear modelling.
>
>(3) You should talk to your thesis advisor.
>
>(4) Please see fortunes::fortune(285).
>
>cheers,
>
>Rolf Turner
>
>

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


Re: [R] Help

2024-02-20 Thread Rolf Turner


On Mon, 19 Feb 2024 17:39:23 +0100
Lisa Hupfer via R-help  wrote:

> I am writing my master thesis in which I compared two cultures . So
> for my statistics I need to compare Age,Sex,Culture as well as have a
> look at the tasks scores .
> 
> Anyone familiar with this ?
> I’d love to share my script so you guide me where I did wrong .

(1) This post is far too vague to be appropriate for this list.

(2) You should learn some statistics; probably linear modelling.

(3) You should talk to your thesis advisor.

(4) Please see fortunes::fortune(285).

cheers,

Rolf Turner


-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
 +64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619

__
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] Help

2024-02-04 Thread Jibrin Alhassan
Hi Kimmo,
The code you sent has worked for me. Thank you very much.
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka


On Mon, Feb 5, 2024 at 7:40 AM Kimmo Elo  wrote:

> Hi,
>
> the command line with 'text' should be:
>
> text(-8,-8, expression(R^2 * " = 0.62,  r = 0.79, N = 161"), cex = 2 )
>
> Best,
>
> Kimmo
>
> su, 2024-02-04 kello 17:16 +0100, Jibrin Alhassan kirjoitti:
> > Here is the script I used to plot the graph indicating the text I
> > wanted to
> > insert. The line in the script that I have issues with is: text(-8,-
> > 8,
> > "R^2=  0.62",  r = 0.79, N = 161", cex = 2
> > R^2=  0.62 is not producing R squared = 0.62.
> > Thanks.
> > Sys.setenv( TZ="GMT" )
> > dt <- read.table("CLMXAPTY_sim", col.names = c("FDcli", "FDapt"))
> > FDcli=dt$FDcli
> > FDapt=dt$FDapt
> > setEPS()
> > postscript(file = "cliapt2.eps")
> > par(mar = c(4.3, 4.3, 1.3, 1.3), oma = c(1, 1, 1 , 1))
> > plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4, cex.main
> > = 0.8,
> > font.lab = 1.7, font.axis = 1.7,  col = "red",main = "Simultaneous
> > Events
> > at CLMX and APTY",ylab="CLMX",xlab="APTY")
> > text(-8,-8, "R^2=  0.62",  r = 0.79, N = 161", cex = 2 )
> > abline(lm(FDcli ~ FDapt, col="black"))
> > dev.off()
> > *Jibrin Adejoh Alhassan (Ph.D)*
> > Department of Physics and Astronomy,
> > University of Nigeria, Nsukka
> >
> >
> > On Sun, Feb 4, 2024 at 5:03 PM Jibrin Alhassan
> > 
> > wrote:
> >
> > > Hi Elo,
> > > It gave this error message:
> > > CR_plot2.R:14:37: unexpected string constant
> > > 13: plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4,
> > > cex.main =
> > > 0.8, font.lab = 1.7, font.axis = 1.7,  col = "red",main =
> > > "Simultaneous
> > > Events at CLMX and APTY",ylab="CLMX",xlab="APTY")
> > > 14: text(-8,-8, "expression(R^2*"=  0.62"),  r = 0.79, N = 161"
> > > ^
> > > *Jibrin Adejoh Alhassan (Ph.D)*
> > > Department of Physics and Astronomy,
> > > University of Nigeria, Nsukka
> > >
> > >
> > > On Sun, Feb 4, 2024 at 4:45 PM Jibrin Alhassan
> > > 
> > > wrote:
> > >
> > > > Thank you Zhao for the code. When I replotted the graph after
> > > > inserting
> > > > the code in my script, it gave me this error message without
> > > > plotting the
> > > > graph:
> > > > Warning message:
> > > > In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
> > > > :
> > > >  extra argument ‘col’ will be disregarded.
> > > > My regards.
> > > > *Jibrin Adejoh Alhassan (Ph.D)*
> > > > Department of Physics and Astronomy,
> > > > University of Nigeria, Nsukka
> > > >
> > > >
> > > > On Sun, Feb 4, 2024 at 3:21 PM Jinsong Zhao 
> > > > wrote:
> > > >
> > > > > ?plotmath
> > > > >
> > > > > expression(R^2==0.62)
> > > > >
> > > > > On 2024/2/4 18:10, Jibrin Alhassan wrote:
> > > > > > I have done a scatter plot in R. I want to insert the
> > > > > > coefficient of
> > > > > > determination R^2 = 0.62 as a text in the plot. I have tried
> > > > > > to write
> > > > > R^2
> > > > > > but could not produce R2. I would appreciate it if someone
> > > > > > could help
> > > > > me
> > > > > > with the syntax. I have tried:  expression(paste("", R^2,"=",
> > > > > > 0.62)),
> > > > > but
> > > > > > it did not produce R squared, rather it gave me error
> > > > > > messages. Thanks.
> > > > > > Jibrin Alhassan
> > > > > > *Jibrin Adejoh Alhassan (Ph.D)*
> > > > > > Department of Physics and Astronomy,
> > > > > > University of Nigeria, Nsukka
> > > > > >
> > > > > >   [[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.
> > > > >
> > > >
> >
> > [[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.or

Re: [R] Help

2024-02-04 Thread Kimmo Elo
Hi,

the command line with 'text' should be:

text(-8,-8, expression(R^2 * " = 0.62,  r = 0.79, N = 161"), cex = 2 )

Best,

Kimmo

su, 2024-02-04 kello 17:16 +0100, Jibrin Alhassan kirjoitti:
> Here is the script I used to plot the graph indicating the text I
> wanted to
> insert. The line in the script that I have issues with is: text(-8,-
> 8,
> "R^2=  0.62",  r = 0.79, N = 161", cex = 2
> R^2=  0.62 is not producing R squared = 0.62.
> Thanks.
> Sys.setenv( TZ="GMT" )
> dt <- read.table("CLMXAPTY_sim", col.names = c("FDcli", "FDapt"))
> FDcli=dt$FDcli
> FDapt=dt$FDapt
> setEPS()
> postscript(file = "cliapt2.eps")
> par(mar = c(4.3, 4.3, 1.3, 1.3), oma = c(1, 1, 1 , 1))
> plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4, cex.main
> = 0.8,
> font.lab = 1.7, font.axis = 1.7,  col = "red",main = "Simultaneous
> Events
> at CLMX and APTY",ylab="CLMX",xlab="APTY")
> text(-8,-8, "R^2=  0.62",  r = 0.79, N = 161", cex = 2 )
> abline(lm(FDcli ~ FDapt, col="black"))
> dev.off()
> *Jibrin Adejoh Alhassan (Ph.D)*
> Department of Physics and Astronomy,
> University of Nigeria, Nsukka
> 
> 
> On Sun, Feb 4, 2024 at 5:03 PM Jibrin Alhassan
> 
> wrote:
> 
> > Hi Elo,
> > It gave this error message:
> > CR_plot2.R:14:37: unexpected string constant
> > 13: plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4,
> > cex.main =
> > 0.8, font.lab = 1.7, font.axis = 1.7,  col = "red",main =
> > "Simultaneous
> > Events at CLMX and APTY",ylab="CLMX",xlab="APTY")
> > 14: text(-8,-8, "expression(R^2*"=  0.62"),  r = 0.79, N = 161"
> >     ^
> > *Jibrin Adejoh Alhassan (Ph.D)*
> > Department of Physics and Astronomy,
> > University of Nigeria, Nsukka
> > 
> > 
> > On Sun, Feb 4, 2024 at 4:45 PM Jibrin Alhassan
> > 
> > wrote:
> > 
> > > Thank you Zhao for the code. When I replotted the graph after
> > > inserting
> > > the code in my script, it gave me this error message without
> > > plotting the
> > > graph:
> > > Warning message:
> > > In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...)
> > > :
> > >  extra argument ‘col’ will be disregarded.
> > > My regards.
> > > *Jibrin Adejoh Alhassan (Ph.D)*
> > > Department of Physics and Astronomy,
> > > University of Nigeria, Nsukka
> > > 
> > > 
> > > On Sun, Feb 4, 2024 at 3:21 PM Jinsong Zhao 
> > > wrote:
> > > 
> > > > ?plotmath
> > > > 
> > > > expression(R^2==0.62)
> > > > 
> > > > On 2024/2/4 18:10, Jibrin Alhassan wrote:
> > > > > I have done a scatter plot in R. I want to insert the
> > > > > coefficient of
> > > > > determination R^2 = 0.62 as a text in the plot. I have tried
> > > > > to write
> > > > R^2
> > > > > but could not produce R2. I would appreciate it if someone
> > > > > could help
> > > > me
> > > > > with the syntax. I have tried:  expression(paste("", R^2,"=",
> > > > > 0.62)),
> > > > but
> > > > > it did not produce R squared, rather it gave me error
> > > > > messages. Thanks.
> > > > > Jibrin Alhassan
> > > > > *Jibrin Adejoh Alhassan (Ph.D)*
> > > > > Department of Physics and Astronomy,
> > > > > University of Nigeria, Nsukka
> > > > > 
> > > > >   [[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.
> > > > 
> > > 
> 
> [[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] Help

2024-02-04 Thread Jibrin Alhassan
Many thanks.

On Mon, Feb 5, 2024, 1:06 AM Rolf Turner  wrote:

>
> Please see fortunes::fortune(285).
>
> cheers,
>
> Rolf Turner
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Stats. Dep't. (secretaries) phone:
>  +64-9-373-7599 ext. 89622
> Home phone: +64-9-480-4619
>

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

2024-02-04 Thread Rolf Turner


Please see fortunes::fortune(285).

cheers,

Rolf Turner

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Stats. Dep't. (secretaries) phone:
 +64-9-373-7599 ext. 89622
Home phone: +64-9-480-4619

__
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] Help

2024-02-04 Thread Martin Møller Skarbiniks Pedersen
On Sun, 4 Feb 2024 at 17:26, Jibrin Alhassan  wrote:
>
> Here is the script I used to plot the graph indicating the text I wanted to
> insert. The line in the script that I have issues with is: text(-8,-8,
> "R^2=  0.62",  r = 0.79, N = 161", cex = 2
> R^2=  0.62 is not producing R squared = 0.62.
> Thanks.

This works for me:

curve(dnorm, from=-3, to=3, main="Normal Distribution")
text(x=0, y=0.1, cex=1.5, expression(R^2 == 0.62))

if you are used to write expression using LaTeX math , then maybe you
like the latex2exp package:
curve(dnorm, from=-3, to=3, main="Normal Distribution")
text(0, 0.1, latex2exp::TeX("$R^2 = 0.62$"))

Regards
Martin

__
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] Help

2024-02-04 Thread Jibrin Alhassan
Here is the script I used to plot the graph indicating the text I wanted to
insert. The line in the script that I have issues with is: text(-8,-8,
"R^2=  0.62",  r = 0.79, N = 161", cex = 2
R^2=  0.62 is not producing R squared = 0.62.
Thanks.
Sys.setenv( TZ="GMT" )
dt <- read.table("CLMXAPTY_sim", col.names = c("FDcli", "FDapt"))
FDcli=dt$FDcli
FDapt=dt$FDapt
setEPS()
postscript(file = "cliapt2.eps")
par(mar = c(4.3, 4.3, 1.3, 1.3), oma = c(1, 1, 1 , 1))
plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4, cex.main = 0.8,
font.lab = 1.7, font.axis = 1.7,  col = "red",main = "Simultaneous Events
at CLMX and APTY",ylab="CLMX",xlab="APTY")
text(-8,-8, "R^2=  0.62",  r = 0.79, N = 161", cex = 2 )
abline(lm(FDcli ~ FDapt, col="black"))
dev.off()
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka


On Sun, Feb 4, 2024 at 5:03 PM Jibrin Alhassan 
wrote:

> Hi Elo,
> It gave this error message:
> CR_plot2.R:14:37: unexpected string constant
> 13: plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4, cex.main =
> 0.8, font.lab = 1.7, font.axis = 1.7,  col = "red",main = "Simultaneous
> Events at CLMX and APTY",ylab="CLMX",xlab="APTY")
> 14: text(-8,-8, "expression(R^2*"=  0.62"),  r = 0.79, N = 161"
> ^
> *Jibrin Adejoh Alhassan (Ph.D)*
> Department of Physics and Astronomy,
> University of Nigeria, Nsukka
>
>
> On Sun, Feb 4, 2024 at 4:45 PM Jibrin Alhassan 
> wrote:
>
>> Thank you Zhao for the code. When I replotted the graph after inserting
>> the code in my script, it gave me this error message without plotting the
>> graph:
>> Warning message:
>> In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
>>  extra argument ‘col’ will be disregarded.
>> My regards.
>> *Jibrin Adejoh Alhassan (Ph.D)*
>> Department of Physics and Astronomy,
>> University of Nigeria, Nsukka
>>
>>
>> On Sun, Feb 4, 2024 at 3:21 PM Jinsong Zhao  wrote:
>>
>>> ?plotmath
>>>
>>> expression(R^2==0.62)
>>>
>>> On 2024/2/4 18:10, Jibrin Alhassan wrote:
>>> > I have done a scatter plot in R. I want to insert the coefficient of
>>> > determination R^2 = 0.62 as a text in the plot. I have tried to write
>>> R^2
>>> > but could not produce R2. I would appreciate it if someone could help
>>> me
>>> > with the syntax. I have tried:  expression(paste("", R^2,"=", 0.62)),
>>> but
>>> > it did not produce R squared, rather it gave me error messages. Thanks.
>>> > Jibrin Alhassan
>>> > *Jibrin Adejoh Alhassan (Ph.D)*
>>> > Department of Physics and Astronomy,
>>> > University of Nigeria, Nsukka
>>> >
>>> >   [[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.
>>>
>>

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

2024-02-04 Thread Jibrin Alhassan
Hi Elo,
It gave this error message:
CR_plot2.R:14:37: unexpected string constant
13: plot(FDapt,FDcli, pch = 16,  cex.lab = 1.6, cex.axis = 1.4, cex.main =
0.8, font.lab = 1.7, font.axis = 1.7,  col = "red",main = "Simultaneous
Events at CLMX and APTY",ylab="CLMX",xlab="APTY")
14: text(-8,-8, "expression(R^2*"=  0.62"),  r = 0.79, N = 161"
^
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka


On Sun, Feb 4, 2024 at 4:45 PM Jibrin Alhassan 
wrote:

> Thank you Zhao for the code. When I replotted the graph after inserting
> the code in my script, it gave me this error message without plotting the
> graph:
> Warning message:
> In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
>  extra argument ‘col’ will be disregarded.
> My regards.
> *Jibrin Adejoh Alhassan (Ph.D)*
> Department of Physics and Astronomy,
> University of Nigeria, Nsukka
>
>
> On Sun, Feb 4, 2024 at 3:21 PM Jinsong Zhao  wrote:
>
>> ?plotmath
>>
>> expression(R^2==0.62)
>>
>> On 2024/2/4 18:10, Jibrin Alhassan wrote:
>> > I have done a scatter plot in R. I want to insert the coefficient of
>> > determination R^2 = 0.62 as a text in the plot. I have tried to write
>> R^2
>> > but could not produce R2. I would appreciate it if someone could help me
>> > with the syntax. I have tried:  expression(paste("", R^2,"=", 0.62)),
>> but
>> > it did not produce R squared, rather it gave me error messages. Thanks.
>> > Jibrin Alhassan
>> > *Jibrin Adejoh Alhassan (Ph.D)*
>> > Department of Physics and Astronomy,
>> > University of Nigeria, Nsukka
>> >
>> >   [[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.
>>
>

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

2024-02-04 Thread Kimmo Elo
Hi,

maybe this works:

expression(R^2 * "= 0.62")

HTH,

Kimmo

4. helmik. 2024, 16.11, Jibrin Alhassan 
mailto:jibrin.alhas...@unn.edu.ng>> kirjoitti:

I have done a scatter plot in R. I want to insert the coefficient of
determination R^2 = 0.62 as a text in the plot. I have tried to write R^2
but could not produce R2. I would appreciate it if someone could help me
with the syntax. I have tried:  expression(paste("", R^2,"=", 0.62)), but
it did not produce R squared, rather it gave me error messages. Thanks.
Jibrin Alhassan
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka

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

2024-02-04 Thread Jibrin Alhassan
Thank you Zhao for the code. When I replotted the graph after inserting the
code in my script, it gave me this error message without plotting the graph:
Warning message:
In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
 extra argument ‘col’ will be disregarded.
My regards.
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka


On Sun, Feb 4, 2024 at 3:21 PM Jinsong Zhao  wrote:

> ?plotmath
>
> expression(R^2==0.62)
>
> On 2024/2/4 18:10, Jibrin Alhassan wrote:
> > I have done a scatter plot in R. I want to insert the coefficient of
> > determination R^2 = 0.62 as a text in the plot. I have tried to write R^2
> > but could not produce R2. I would appreciate it if someone could help me
> > with the syntax. I have tried:  expression(paste("", R^2,"=", 0.62)), but
> > it did not produce R squared, rather it gave me error messages. Thanks.
> > Jibrin Alhassan
> > *Jibrin Adejoh Alhassan (Ph.D)*
> > Department of Physics and Astronomy,
> > University of Nigeria, Nsukka
> >
> >   [[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.
>

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

2024-02-04 Thread Jinsong Zhao

?plotmath

expression(R^2==0.62)

On 2024/2/4 18:10, Jibrin Alhassan wrote:

I have done a scatter plot in R. I want to insert the coefficient of
determination R^2 = 0.62 as a text in the plot. I have tried to write R^2
but could not produce R2. I would appreciate it if someone could help me
with the syntax. I have tried:  expression(paste("", R^2,"=", 0.62)), but
it did not produce R squared, rather it gave me error messages. Thanks.
Jibrin Alhassan
*Jibrin Adejoh Alhassan (Ph.D)*
Department of Physics and Astronomy,
University of Nigeria, Nsukka

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2024-01-06 Thread Andy

Hi Tim

This is brilliant - thank you!!

I've had to tweak the basePath line a bit (I am on a Linux machine), but 
having done that, the code works as intended. This is a truly helpful 
contribution that gives me ideas about how to work it through for the 
missing fields, which is one of the major sticking points I kept bumping 
up against.


Thank you so much for this.

All the best
Andy

On 05/01/2024 13:59, Howard, Tim G (DEC) wrote:

Here's a simplified version of how I would do it, using `textreadr` but 
otherwise base functions. I haven't done it
all, but have a few examples of finding the correct row then extracting the 
right data.
I made a duplicate of the file you provided, so this loops through the two 
identical files, extracts a few parts,
then sticks those parts in a data frame.

#
library(textreadr)

# recommend not using setwd(), but instead just include the
# path as follows
basePath <- file.path("C:","temp")
files <- list.files(path=basePath, pattern = "docx$")

length(files)
# 2

# initialize a list to put the data in
myList <- vector(mode = "list", length = length(files))

for(i in 1:length(files)){
   fileDat <- read_docx(file.path(basePath, files[[i]]))
   # get the data you want, here one line per item to make it clearer
   # assume consistency among articles
   ttl <- fileDat[[1]]
   src <- fileDat[[2]]
   dt <- fileDat[[3]]
   aut <- fileDat[grepl("Byline:",fileDat)]
   aut <- trimws(sub("Byline:","",aut), whitespace = "[\\h\\v]")
   pg <- fileDat[grepl("Pg.",fileDat)]
   pg <- as.integer(sub(".*Pg. ([[:digit:]]+)","\\1",pg))
   len <- fileDat[grepl("Length:", fileDat)]
   len <- as.integer(sub("Length:.{1}([[:digit:]]+) .*","\\1",len))
   myList[[i]] <- data.frame("title"=ttl,
"source"=src,
"date"=dt,
"author"=aut,
"page"=pg,
"length"=len)
}

# roll up the list to a data frame. Many ways to do this.
myDF <- do.call("rbind",myList)

#

Hope that helps.
Tim




--

Date: Thu, 4 Jan 2024 12:59:59 +
From: Andy 
To: r-help@r-project.org
Subject: Re: [R]  Help request: Parsing docx files for key words and
 appending to a spreadsheet
Message-ID: 
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi folks

Thanks for your help and suggestions - very much appreciated.

I now have some working code, using this file I uploaded for public
access:
https://docs/.
google.com%2Fdocument%2Fd%2F1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVER
k%2Fedit%3Fusp%3Dsharing%26ouid%3D103065135255080058813%26rtpof%
3Dtrue%26sd%3Dtrue&data=05%7C02%7Ctim.howard%40dec.ny.gov%7C8f2
952a3ae474d4da14908dc0ddd95fd%7Cf46cb8ea79004d108ceb80e8c1c81ee7
%7C0%7C0%7C638400492578674983%7CUnknown%7CTWFpbGZsb3d8eyJWIj
oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
000%7C%7C%7C&sdata=%2BpYrk6cJA%2BDUn9szLbd2Y7R%2F30UNY2TFSJN
HcwkHa9Y%3D&reserved=0


The small code segment that now works is as follows:

###

# Load libraries
library(textreadr)
library(tcltk)
library(tidyverse)
#library(officer)
#library(stringr) #for splitting and trimming raw data
#library(tidyr) #for converting to wide format

# I'd like to keep this as it enables more control over the selected directories
filepath <- setwd(tk_choose.dir())

# The following correctly lists the names of all 9 files in my test directory 
files
<- list.files(filepath, ".docx") files
length(files)

# Ideally, I'd like to skip this step by being able to automatically read in the
name of each file, but one step at a time:
filename <- "Now they want us to charge our electric cars from litter
bins.docx"

# This produces the file content as output when run, and identifies the fields
that I want to extract.
read_docx(filename) %>%
str_split(",") %>%
unlist() %>%
str_trim()

###

What I'd like to try and accomplish next is to extract the data from selected
fields and append to a spreadsheet (Calc or Excel) under specific columns, or
if it is easier to write a CSV which I can then use later.

The fields I want to extract are illustrated with reference to the above file,
viz.:

The title: "Now they want us to charge our electric cars from litter bins"
The name of the newspaper: "Mail on Sunday (London)"
The publication date: "September 24, 2023" (in date format, preferably
separated into month and year (day is not important)) The section: "NEWS"
The page number(s): "16" (as numeric)
The length: "515" (as numeric)
The author: "Anna Mikhailova"
The subject: from the Subject 

Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet

2024-01-04 Thread Andy

Hi folks

Thanks for your help and suggestions - very much appreciated.

I now have some working code, using this file I uploaded for public 
access: 
https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing&ouid=103065135255080058813&rtpof=true&sd=true 



The small code segment that now works is as follows:

###

# Load libraries
library(textreadr)
library(tcltk)
library(tidyverse)
#library(officer)
#library(stringr) #for splitting and trimming raw data
#library(tidyr) #for converting to wide format

# I'd like to keep this as it enables more control over the selected 
directories

filepath <- setwd(tk_choose.dir())

# The following correctly lists the names of all 9 files in my test 
directory

files <- list.files(filepath, ".docx")
files
length(files)

# Ideally, I'd like to skip this step by being able to automatically 
read in the name of each file, but one step at a time:
filename <- "Now they want us to charge our electric cars from litter 
bins.docx"


# This produces the file content as output when run, and identifies the 
fields that I want to extract.

read_docx(filename) %>%
  str_split(",") %>%
  unlist() %>%
  str_trim()

###

What I'd like to try and accomplish next is to extract the data from 
selected fields and append to a spreadsheet (Calc or Excel) under 
specific columns, or if it is easier to write a CSV which I can then use 
later.


The fields I want to extract are illustrated with reference to the above 
file, viz.:


The title: "Now they want us to charge our electric cars from litter bins"
The name of the newspaper: "Mail on Sunday (London)"
The publication date: "September 24, 2023" (in date format, preferably 
separated into month and year (day is not important))

The section: "NEWS"
The page number(s): "16" (as numeric)
The length: "515" (as numeric)
The author: "Anna Mikhailova"
The subject: from the Subject section, but this is to match a value e.g. 
GREENWASHING >= 50% (here this value is 51% so would be included). A 
match moves onto select the highest value under the section "Industry" 
(here it is ELECTRIC MOBILITY (91%)) and appends this text and % value. 
If no match with 'Greenwashing', then appends 'Null' and moves onto the 
next file in the directory.


###

The theory I am working with is if I can figure out how to extract these 
fields and append correctly, then the rest should just be wrapping this 
up in a for loop.


However, I am struggling to get my head around the extraction and append 
part. If I can get it to work for one of these fields, I suspect that I 
can repeat the basic syntax to extract and append the remaining fields.


Therefore, if someone can either suggest a syntax or point me to a 
useful tutorial, that would be splendid.


Thank you in anticipation.

Best wishes
Andy



__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2024-01-03 Thread Dr Eberhard Lisse
If you do something like this

for i in  $(pandoc --list-output-formats);
do pandoc -f docx -t $i -o test.$i Now\ they\ want\ us\ to\ 
charge\
our\ electric\ cars\ from\ litter\ bins.docx;
done

you get approximately 65 formats, from which you can pick one which you can
write a little parser for. The dokuwiki one for example uses long lines
which
makes parsing easier.

el


On 2023-12-30 13:57 , Andy wrote:
> Good idea, El - thanks.
>
> The link is
> https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing&ouid=103065135255080058813&rtpof=true&sd=true
>
>  This is helpful.
>
> From the article, which is typical of Lexis+ output, I want to
> extract the following fields and append to a Calc/ Excel spreadsheet.
> Given the volume of articles I have to work through, if this can be
> iterative and semi-automatic, that would be a god send and I might be
> able to do some actual research on the articles before I reach my
> pensionable age. :-)
>
> Title Newspaper Date Section and page number Length Byline Subject
> (only if the threshold of coverage for a specific subject is
>> =50% is reached (e.g. Greenwashing (51%)) - if not, enter 'nil' and
>>
> move onto the next article in the folder
>
> This is the ambition. I am clearly a long way short of that though.
>
> Many thanks. Andy

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Ivan Krylov
В Sat, 30 Dec 2023 12:18:52 +
Andy  пишет:

> filepath <- setwd(tk_choose.dir())

Since you're using tcltk, you can get a file path in one step using
tk_choose.files(). (Use multi = FALSE to choose only one file.)

> full_filename <- paste(filepath, filename, sep="/")

There's also file.path(), which results in slightly more compact,
self-documenting code.

Nowadays, using '/' as the directory separator can be considered
portable, one notable exception being some Windows cmd.exe built-ins
(where '/' is interpreted as flag specifier). Perl5 documentation
mentions Classic MacOS using ':' as the directory separator (and many
other operating systems supporting or emulating Unix-style '/'
separators), but that hasn't been relevant for a long while.

> Error in x$doc_obj : $ operator is invalid for atomic vectors

Which line of code produces the error? What is the argument of
docx_summary() at this point?

Since you're learning R, I can recommend a couple of free books: Visual
Statistics [1] to study the basics of R and The R Inferno [2] for when
you get stuck.

-- 
Best regards,
Ivan

[1]
http://web.archive.org/web/20230415001551/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf

[2]
https://www.burns-stat.com/documents/books/the-r-inferno/

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
Sorry, I was being too quick.
You have to pay attention to the pipe operator

You were advised to do the following

content <- read_docx(full_filename) |>
docx_summary()

which should have worked but I think you left out the |> operator.

Alternatively

tmp <- read_docx(full_filename)
content <-  docx_summary(tmp)



On Sat, Dec 30, 2023 at 2:37 PM Andy  wrote:

> An update: Running this block of code:
>
> # Load libraries
> library(tcltk)
> library(tidyverse)
> library(officer)
>
> filepath <- setwd(tk_choose.dir())
>
> filename <- "Now they want us to charge our electric cars from litter
> bins.docx"
>
> #full_filename <- paste0(filepath, filename)
> full_filename <- paste(filepath, filename, sep="/")
>
> if (!file.exists(full_filename)) {
>message("File missing")
> } else {
>content <- read_docx(full_filename) |>
>  docx_summary()
># this reads docx for the full filename and
># passes it ( |> command) to the next line
># which summarises it.
># the result is saved in a data frame object
># called content which we shall show some
># heading into from
>
>head(content)
> }
>
>
> Results in this error now:Error in x$doc_obj : $ operator is invalid for
> atomic vectors
>
> Thank you.
>
>
>
> On 30/12/2023 12:12, Andy wrote:
> > Hi Eric
> >
> > Thanks for that. That seems to fix one problem (the lack of a
> > separator), but introduces a new one when I complete the function
> > Calum proposed:Error in docx_summary() : argument "x" is missing, with
> > no default
> >
> > The whole code so far looks like this:
> >
> >
> > # Load libraries
> > library(tcltk)
> > library(tidyverse)
> > library(officer)
> >
> > filepath <- setwd(tk_choose.dir())
> >
> > filename <- "Now they want us to charge our electric cars from litter
> > bins.docx"
> > #full_filename <- paste0(filepath, filename) # Calum's original
> suggestion
> >
> > full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix
> >
> > #lets double check the file does exist! # The rest here is Calum's
> > suggestion
> > if (!file.exists(full_filename)) {
> >   message("File missing")
> > } else {
> >   content <- read_docx(full_filename)
> >   docx_summary()
> >   # this reads docx for the full filename and
> >   # passes it ( |> command) to the next line
> >   # which summarises it.
> >   # the result is saved in a data frame object
> >   # called content which we shall show some
> >   # heading into from
> >
> >   head(content)
> > }
> >
> >
> > Running this, results in the error cited above.
> >
> > Thanks as always :-)
> >
> >
> >
> >
> > On 30/12/2023 11:58, Eric Berger wrote:
> >> full_filename <- paste(filepath, filename,sep="/")
> >
> >
>
> [[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Andy
An update: Running this block of code:

# Load libraries
library(tcltk)
library(tidyverse)
library(officer)

filepath <- setwd(tk_choose.dir())

filename <- "Now they want us to charge our electric cars from litter 
bins.docx"

#full_filename <- paste0(filepath, filename)
full_filename <- paste(filepath, filename, sep="/")

if (!file.exists(full_filename)) {
   message("File missing")
} else {
   content <- read_docx(full_filename) |>
     docx_summary()
   # this reads docx for the full filename and
   # passes it ( |> command) to the next line
   # which summarises it.
   # the result is saved in a data frame object
   # called content which we shall show some
   # heading into from

   head(content)
}


Results in this error now:Error in x$doc_obj : $ operator is invalid for 
atomic vectors

Thank you.



On 30/12/2023 12:12, Andy wrote:
> Hi Eric
>
> Thanks for that. That seems to fix one problem (the lack of a 
> separator), but introduces a new one when I complete the function 
> Calum proposed:Error in docx_summary() : argument "x" is missing, with 
> no default
>
> The whole code so far looks like this:
>
>
> # Load libraries
> library(tcltk)
> library(tidyverse)
> library(officer)
>
> filepath <- setwd(tk_choose.dir())
>
> filename <- "Now they want us to charge our electric cars from litter 
> bins.docx"
> #full_filename <- paste0(filepath, filename) # Calum's original suggestion
>
> full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix
>
> #lets double check the file does exist! # The rest here is Calum's 
> suggestion
> if (!file.exists(full_filename)) {
>   message("File missing")
> } else {
>   content <- read_docx(full_filename)
>   docx_summary()
>   # this reads docx for the full filename and
>   # passes it ( |> command) to the next line
>   # which summarises it.
>   # the result is saved in a data frame object
>   # called content which we shall show some
>   # heading into from
>
>   head(content)
> }
>
>
> Running this, results in the error cited above.
>
> Thanks as always :-)
>
>
>
>
> On 30/12/2023 11:58, Eric Berger wrote:
>> full_filename <- paste(filepath, filename,sep="/")
>
>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
docx_summary(content)

You should read documentation e.g. ?docx_summary and check the examples
section

On Sat, Dec 30, 2023 at 2:12 PM Andy  wrote:

> Hi Eric
>
> Thanks for that. That seems to fix one problem (the lack of a separator),
> but introduces a new one when I complete the function Calum proposed:
> Error in docx_summary() : argument "x" is missing, with no default
>
> The whole code so far looks like this:
>
>
> # Load libraries
> library(tcltk)
> library(tidyverse)
> library(officer)
>
> filepath <- setwd(tk_choose.dir())
>
> filename <- "Now they want us to charge our electric cars from litter
> bins.docx"
> #full_filename <- paste0(filepath, filename) # Calum's original suggestion
>
> full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix
>
> #lets double check the file does exist! # The rest here is Calum's
> suggestion
> if (!file.exists(full_filename)) {
>   message("File missing")
> } else {
>   content <- read_docx(full_filename)
>   docx_summary()
>   # this reads docx for the full filename and
>   # passes it ( |> command) to the next line
>   # which summarises it.
>   # the result is saved in a data frame object
>   # called content which we shall show some
>   # heading into from
>
>   head(content)
> }
>
>
> Running this, results in the error cited above.
>
> Thanks as always :-)
>
>
>
>
> On 30/12/2023 11:58, Eric Berger wrote:
>
> full_filename <- paste(filepath, filename,sep="/")
>
>
>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Andy
Hi Eric

Thanks for that. That seems to fix one problem (the lack of a 
separator), but introduces a new one when I complete the function Calum 
proposed:Error in docx_summary() : argument "x" is missing, with no default

The whole code so far looks like this:


# Load libraries
library(tcltk)
library(tidyverse)
library(officer)

filepath <- setwd(tk_choose.dir())

filename <- "Now they want us to charge our electric cars from litter 
bins.docx"
#full_filename <- paste0(filepath, filename) # Calum's original suggestion

full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix

#lets double check the file does exist! # The rest here is Calum's 
suggestion
if (!file.exists(full_filename)) {
   message("File missing")
} else {
   content <- read_docx(full_filename)
   docx_summary()
   # this reads docx for the full filename and
   # passes it ( |> command) to the next line
   # which summarises it.
   # the result is saved in a data frame object
   # called content which we shall show some
   # heading into from

   head(content)
}


Running this, results in the error cited above.

Thanks as always :-)




On 30/12/2023 11:58, Eric Berger wrote:
> full_filename <- paste(filepath, filename,sep="/")


[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
full_filename <- paste(filepath, filename,sep="/")

On Sat, Dec 30, 2023 at 1:45 PM Andy  wrote:

> Thanks Ivan and Calum
>
> I continue to appreciate your support.
>
> Calum, I entered the code snippet you provided, and it returns 'file
> missing'. Looking at this, while the object 'full_filename' exists, what
> is happening is that the path from getwd() is being appended to the
> title of the article, but without the '/' between the end of the path
> name (here 'TEST' and the name of the article. In other words,
> full_filename is reading "~/TESTNow they want us to charge our electric
> cars from litter bins.docx", so logically, this file doesn't exist. To
> work, the '/' needs to be inserted to differentiate between the end of
> the path name and the start of the article name. I've tried both paste0,
> as you suggested, and paste but neither do the trick.
>
> Is this a result of me using the tkinter folder selection that you
> remarked on? I wanted to keep that so that the selection is interactive,
> but if there are better ways of doing this I am open to suggestions.
>
> Thanks again, both.
>
> Best wishes
> Andrew
>
>
> On 29/12/2023 22:25, CALUM POLWART wrote:
> >
> >
> > help(read_docx) says that the function only imports one docx file. In
> > order to read multiple files, use a for loop or the lapply function.
> >
> >
> > I told you people will suggest better ways to loop!!
> >
> >
> >
> > docx_summary(read_docx("Now they want us to charge our electric cars
> > from litter bins.docx")) should work.
> >
> >
> > Ivan thanks for spotting my fail! Since the OP is new to all this I'm
> > going to suggest a little tweak to this code which we can then build
> > into a for loop:
> >
> > filepath <- getwd() #you will want to change this later. You are doing
> > something with tcl to pick a directory which seems rather fancy! But
> > keep doing it for now or set the directory here ending in a /
> >
> > filename <- "Now they want us to charge our electric cars from litter
> > bins.docx"
> >
> > full_filename <- paste0(filepath, filename)
> >
> > #lets double check the file does exist!
> > if (!file.exists(full_filename)) {
> >   message("File missing")
> > } else {
> >   content <- read_docx(full_filename) |>
> > docx_summary()
> > # this reads docx for the full filename and
> > # passes it ( |> command) to the next line
> > # which summarises it.
> > # the result is saved in a data frame object
> > # called content which we shall show some
> > # heading into from
> >
> >head(content)
> > }
> >
> > Let's get this bit working before we try and loop
> >
>
> [[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Andy

Good idea, El - thanks.

The link is 
https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing&ouid=103065135255080058813&rtpof=true&sd=true


This is helpful.

From the article, which is typical of Lexis+ output, I want to extract 
the following fields and append to a Calc/ Excel spreadsheet. Given the 
volume of articles I have to work through, if this can be iterative and 
semi-automatic, that would be a god send and I might be able to do some 
actual research on the articles before I reach my pensionable age. :-)


Title
Newspaper
Date
Section and page number
Length
Byline
Subject (only if the threshold of coverage for a specific subject is 
>=50% is reached (e.g. Greenwashing (51%)) - if not, enter 'nil' and 
move onto the next article in the folder


This is the ambition. I am clearly a long way short of that though.

Many thanks.
Andy


On 30/12/2023 00:08, Dr Eberhard W Lisse wrote:

Andy,

you can always open a public Dropbox or Google folder and post the link.

el

On 29/12/2023 22:37, Andy wrote:

Thanks - I'll have a look at these options too.

I'm happy to send over a sample document, but wasn't aware if
attachments are allowed. The documents come Lexis+, so require user
  credentials to log in, but I could upload the file somewhere if
that would help? Any ideas for a good location to do so?

[...]

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Andy
Thanks Ivan and Calum

I continue to appreciate your support.

Calum, I entered the code snippet you provided, and it returns 'file 
missing'. Looking at this, while the object 'full_filename' exists, what 
is happening is that the path from getwd() is being appended to the 
title of the article, but without the '/' between the end of the path 
name (here 'TEST' and the name of the article. In other words, 
full_filename is reading "~/TESTNow they want us to charge our electric 
cars from litter bins.docx", so logically, this file doesn't exist. To 
work, the '/' needs to be inserted to differentiate between the end of 
the path name and the start of the article name. I've tried both paste0, 
as you suggested, and paste but neither do the trick.

Is this a result of me using the tkinter folder selection that you 
remarked on? I wanted to keep that so that the selection is interactive, 
but if there are better ways of doing this I am open to suggestions.

Thanks again, both.

Best wishes
Andrew


On 29/12/2023 22:25, CALUM POLWART wrote:
>
>
> help(read_docx) says that the function only imports one docx file. In
> order to read multiple files, use a for loop or the lapply function.
>
>
> I told you people will suggest better ways to loop!!
>
>
>
> docx_summary(read_docx("Now they want us to charge our electric cars
> from litter bins.docx")) should work.
>
>
> Ivan thanks for spotting my fail! Since the OP is new to all this I'm 
> going to suggest a little tweak to this code which we can then build 
> into a for loop:
>
> filepath <- getwd() #you will want to change this later. You are doing 
> something with tcl to pick a directory which seems rather fancy! But 
> keep doing it for now or set the directory here ending in a /
>
> filename <- "Now they want us to charge our electric cars from litter 
> bins.docx"
>
> full_filename <- paste0(filepath, filename)
>
> #lets double check the file does exist!
> if (!file.exists(full_filename)) {
>   message("File missing")
> } else {
>   content <- read_docx(full_filename) |>
>     docx_summary()
>     # this reads docx for the full filename and
>     # passes it ( |> command) to the next line
>     # which summarises it.
>     # the result is saved in a data frame object
>     # called content which we shall show some
>     # heading into from
>
>    head(content)
> }
>
> Let's get this bit working before we try and loop
>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Dr Eberhard W Lisse
Andy,

you can always open a public Dropbox or Google folder and post the link.

el

On 29/12/2023 22:37, Andy wrote:
> Thanks - I'll have a look at these options too.
>
> I'm happy to send over a sample document, but wasn't aware if
> attachments are allowed. The documents come Lexis+, so require user
>  credentials to log in, but I could upload the file somewhere if
> that would help? Any ideas for a good location to do so?
[...]

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread CALUM POLWART
help(read_docx) says that the function only imports one docx file. In
> order to read multiple files, use a for loop or the lapply function.
>

I told you people will suggest better ways to loop!!


>
> docx_summary(read_docx("Now they want us to charge our electric cars
> from litter bins.docx")) should work.
>

Ivan thanks for spotting my fail! Since the OP is new to all this I'm going
to suggest a little tweak to this code which we can then build into a for
loop:

filepath <- getwd() #you will want to change this later. You are doing
something with tcl to pick a directory which seems rather fancy! But keep
doing it for now or set the directory here ending in a /

filename <- "Now they want us to charge our electric cars from litter
bins.docx"

full_filename <- paste0(filepath, filename)

#lets double check the file does exist!
if (!file.exists(full_filename)) {
  message("File missing")
} else {
  content <- read_docx(full_filename) |>
docx_summary()
# this reads docx for the full filename and
# passes it ( |> command) to the next line
# which summarises it.
# the result is saved in a data frame object
# called content which we shall show some
# heading into from

   head(content)
}

Let's get this bit working before we try and loop

>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Ivan Krylov
В Fri, 29 Dec 2023 20:17:41 +
Andy  пишет:

> doc_in <- read_docx(files)
> 
> Results in this error:Error in filetype %in% c("docx") && 
> grepl("^([fh]ttp)", file) :'length = 9' in coercion to 'logical(1)'

help(read_docx) says that the function only imports one docx file. In
order to read multiple files, use a for loop or the lapply function.

> content <- officer::docx_summary("Now they want us to charge our 
> electric cars from litter bins.docx") # A title of one of the articles
> 
> The error returned is:Error in x$doc_obj : $ operator is invalid for 
> atomic vectors

A similar problem here. help(docx_summary) says that the function
accepts "rdocx" objects returned by read_docx, not file paths. A string
in R is indeed an atomic vector of type character, length 1.

docx_summary(read_docx("Now they want us to charge our electric cars
from litter bins.docx")) should work.

-- 
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Andy

Thanks - I'll have a look at these options too.

I'm happy to send over a sample document, but wasn't aware if 
attachments are allowed. The documents come Lexis+, so require user 
credentials to log in, but I could upload the file somewhere if that 
would help? Any ideas for a good location to do so?



On 29/12/2023 20:25, Dr Eberhard W Lisse wrote:

I would also look at https://pandoc.org perhaps which can
export a number of formats...

And for spreadsheets https://github.com/jqnatividad/qsv is my
goto weapon.  Can also read and write XLSX and others.

A sample document or two would always be helpful...

el

On 29/12/2023 21:01, CALUM POLWART wrote:

It sounded like he looked at officeR but I would agree

content <- officer::docx_summary("filename.docx")

Would get the text content into an object called content.

That object is a data.frame so you can then manipulate it.
To be more specific, we might need an example of the DF

[...]

On Fri, Dec 29, 2023 at 10:14 AM Andy 
wrote:

[...]

I'd like to be able to accomplish the following:

(1) Append the title, the month, the author, the number of
words, and page number(s) to a spreadsheet

(2) Read each article and extract keywords (in the docs,
these are listed in 'Subject' section as a list of
keywords with a percentage showing the extent to which the
keyword features in the article (e.g., FAST FASHION (72%))
and to append the keyword and the % coverage to the same
row in the spreadsheet.  However, I want to ensure that
the keyword coverage meets the threshold of >= 50%; if
not, then pass onto the next article in the directory.
Rinse and repeat for the entire directory.

[...]

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Dr Eberhard W Lisse
I would also look at https://pandoc.org perhaps which can
export a number of formats...

And for spreadsheets https://github.com/jqnatividad/qsv is my
goto weapon.  Can also read and write XLSX and others.

A sample document or two would always be helpful...

el

On 29/12/2023 21:01, CALUM POLWART wrote:
> It sounded like he looked at officeR but I would agree
> 
> content <- officer::docx_summary("filename.docx")
> 
> Would get the text content into an object called content.
> 
> That object is a data.frame so you can then manipulate it.
> To be more specific, we might need an example of the DF
[...]
>> On Fri, Dec 29, 2023 at 10:14 AM Andy 
>> wrote:
[...]
>>> I'd like to be able to accomplish the following:
>>>
>>> (1) Append the title, the month, the author, the number of
>>> words, and page number(s) to a spreadsheet
>>>
>>> (2) Read each article and extract keywords (in the docs,
>>> these are listed in 'Subject' section as a list of
>>> keywords with a percentage showing the extent to which the
>>> keyword features in the article (e.g., FAST FASHION (72%))
>>> and to append the keyword and the % coverage to the same
>>> row in the spreadsheet.  However, I want to ensure that
>>> the keyword coverage meets the threshold of >= 50%; if
>>> not, then pass onto the next article in the directory.
>>> Rinse and repeat for the entire directory.
[...]

__
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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Andy
Hi Roy (& others)

Many thanks for the advice - well taken. Thanks also to the others who 
have responded so quickly - I thought I might have to wait days!! :-)

I'm on a Linux (Mint) machine. Below, I document three attempts, two 
using officer and the last now using textreadr

My attempts so far using 'officer':

##

(1) First Attempt:

# Load libraries
library(tcltk)
library(tidyverse)
library(officer)

setwd(tk_choose.dir())

doc_path <- list.files(getwd(), pattern = ".docx", full.names = TRUE)

files <- list.files(getwd(), ".docx")
files
length(files)

## This works to here - obtain a list of docx files in directory 'TEST 
with 9 files'. However, the next line
doc_in <- read_docx(files)

Results in this error:Error in filetype %in% c("docx") && 
grepl("^([fh]ttp)", file) :'length = 9' in coercion to 'logical(1)'

No idea how to debug that.

Even when trying Calum's suggestion with officer:

content <- officer::docx_summary("Now they want us to charge our 
electric cars from litter bins.docx") # A title of one of the articles

The error returned is:Error in x$doc_obj : $ operator is invalid for 
atomic vectors


##
(2) Second Attempt:

# Load libraries
library(tcltk)
library(tidyverse)
library(officer)

setwd(tk_choose.dir())

doc_path <- list.files(getwd(), pattern = ".docx", full.names = TRUE)

files <- list.files(getwd(), ".docx")
files
length(files)

docx_summary(doc_path, preserve = FALSE)
## At this point, the error is:Error in x$doc_obj : $ operator is 
invalid for atomic vectors

So, not sure how I am passing an atomic vector or if there is something 
I am supposed to set to make this something else?

##
(3) Third attempt - now trying with textreadr (Thanks for the help on 
installing this, Calum):

# Load libraries
library(tcltk)
library(tidyverse)
library(textreadr)

folder <- setwd(tk_choose.dir())

files <- list.files(folder, ".docx")
files
length(files)

doc <- read_docx("Now they want us to charge our electric cars from 
litter bins.docx") # One of the 9 files in the folder

read_docx(doc, skip = 0, remove.empty = TRUE, trim = TRUE) # To test 
against one file

## The last line returns the following error:Error in filetype %in% 
c("docx") && grepl("^([fh]ttp)", file) :'length = 38' in coercion to 
'logical(1)'

##
And so I am going around in circles and not at all clear on how I can 
make progress.

I am sure that there must be a way, but the suggestions on-line each 
lead to the above errors.

Thanks for any further help.

Best wishes, and thanks
Andy


On 29/12/2023 18:25, Roy Mendelssohn - NOAA Federal wrote:
> Hi Andy:
>
> I don’t have an answer but I do have what I hope is some friendly advice.  
> Generally the more information you can provide,  the more likely you will get 
> help that is useful.  In your case you say that you tried several packages 
> and they didn’t do what you wanted.  Providing that code,  as well as why 
> they didn’t do what you wanted (be specific)  would greatly facilitate things.
>
> Happy new year,
>
> -Roy
>
>
>> On Dec 29, 2023, at 10:14 AM, Andy  wrote:
>>
>> Hello
>>
>> I am trying to work through a problem, but feel like I've gone down a rabbit 
>> hole. I'd very much appreciate any help.
>>
>> The task: I have several directories of multiple (some directories, up to 
>> 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want 
>> to iterate through to append to a spreadsheet only those articles that 
>> satisfy a condition (i.e., a specific keyword is present for >= 50% coverage 
>> of the subject matter). Lexis+ has a very specific structure and keywords 
>> are given in the row "Subject".
>>
>> I'd like to be able to accomplish the following:
>>
>> (1) Append the title, the month, the author, the number of words, and page 
>> number(s) to a spreadsheet
>>
>> (2) Read each article and extract keywords (in the docs, these are listed in 
>> 'Subject' section as a list of keywords with a percentage showing the extent 
>> to which the keyword features in the article (e.g., FAST FASHION (72%)) and 
>> to append the keyword and the % coverage to the same row in the spreadsheet. 
>> However, I want to ensure that the keyword coverage meets the threshold of 
>> >= 50%; if not, then pass onto the next article in the directory. Rinse and 
>> repeat for the entire directory.
>>
>> So far, I've tried working through some Stack Overflow-based solutions, but 
>> most seem to use the textreadr package, which is now deprecated; others use 
>> either the officer or the officedown packages. However, these packages don't 
>> appear to do what I want the program to do, at least not in any of the 
>> examples I have found, nor in the vignettes and relevant package manuals 
>> I've looked at.
>>
>> The first point is, is what I am intending to do even possible using R? If 
>> it is, then where do I start with this? If these docx files were converted 
>> to UTF-8 plain text, would that ma

Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread CALUM POLWART
It sounded like he looked at officeR but I would agree

content <- officer::docx_summary("filename.docx")

Would get the text content into an object called content.

That object is a data.frame so you can then manipulate it.  To be more
specific, we might need an example of the DF

You can loop this easily with a for statement although there are people who
prefer a non-for approach to iteration in R. For can be slow. But if you
don't need to do this very quickly I'd stick with for if you are used to
programming

On Fri, 29 Dec 2023, 18:35 jim holtman,  wrote:

> checkout the 'officer' package
>
> Thanks
>
> Jim Holtman
> *Data Munger Guru*
>
>
> *What is the problem that you are trying to solve?Tell me what you want to
> do, not how you want to do it.*
>
>
> On Fri, Dec 29, 2023 at 10:14 AM Andy  wrote:
>
> > Hello
> >
> > I am trying to work through a problem, but feel like I've gone down a
> > rabbit hole. I'd very much appreciate any help.
> >
> > The task: I have several directories of multiple (some directories, up
> > to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that
> > I want to iterate through to append to a spreadsheet only those articles
> > that satisfy a condition (i.e., a specific keyword is present for >= 50%
> > coverage of the subject matter). Lexis+ has a very specific structure
> > and keywords are given in the row "Subject".
> >
> > I'd like to be able to accomplish the following:
> >
> > (1) Append the title, the month, the author, the number of words, and
> > page number(s) to a spreadsheet
> >
> > (2) Read each article and extract keywords (in the docs, these are
> > listed in 'Subject' section as a list of keywords with a percentage
> > showing the extent to which the keyword features in the article (e.g.,
> > FAST FASHION (72%)) and to append the keyword and the % coverage to the
> > same row in the spreadsheet. However, I want to ensure that the keyword
> > coverage meets the threshold of >= 50%; if not, then pass onto the next
> > article in the directory. Rinse and repeat for the entire directory.
> >
> > So far, I've tried working through some Stack Overflow-based solutions,
> > but most seem to use the textreadr package, which is now deprecated;
> > others use either the officer or the officedown packages. However, these
> > packages don't appear to do what I want the program to do, at least not
> > in any of the examples I have found, nor in the vignettes and relevant
> > package manuals I've looked at.
> >
> > The first point is, is what I am intending to do even possible using R?
> > If it is, then where do I start with this? If these docx files were
> > converted to UTF-8 plain text, would that make the task easier?
> >
> > I am not a confident coder, and am really only just getting my head
> > around R so appreciate a steep learning curve ahead, but of course, I
> > don't know what I don't know, so any pointers in the right direction
> > would be a big help.
> >
> > Many thanks in anticipation
> >
> > Andy
> >
> > __
> > 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.
>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread CALUM POLWART
textreadr would be the obvious approach.

When you say it is depreciated do you mean it's not available on cran?
Sometimes maintaining a package on cran in just a pain in the ass.

devtools::install_github("trinker/textreadr")


Should let you install it.

In theory docx files are actually just zip files (you can unzip them) and
you may find there is then a specific file in the zip that is readable with
on of R's General text file readers.

Alternatively, read_docx from:
https://www.rdocumentation.org/packages/qdapTools

May be worth a look.

What platform are you on. Certainly options to command line convert files
to txt and do from there.


On Fri, 29 Dec 2023, 18:25 Roy Mendelssohn - NOAA Federal via R-help, <
r-help@r-project.org> wrote:

> Hi Andy:
>
> I don’t have an answer but I do have what I hope is some friendly advice.
> Generally the more information you can provide,  the more likely you will
> get help that is useful.  In your case you say that you tried several
> packages and they didn’t do what you wanted.  Providing that code,  as well
> as why they didn’t do what you wanted (be specific)  would greatly
> facilitate things.
>
> Happy new year,
>
> -Roy
>
>
> > On Dec 29, 2023, at 10:14 AM, Andy  wrote:
> >
> > Hello
> >
> > I am trying to work through a problem, but feel like I've gone down a
> rabbit hole. I'd very much appreciate any help.
> >
> > The task: I have several directories of multiple (some directories, up
> to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I
> want to iterate through to append to a spreadsheet only those articles that
> satisfy a condition (i.e., a specific keyword is present for >= 50%
> coverage of the subject matter). Lexis+ has a very specific structure and
> keywords are given in the row "Subject".
> >
> > I'd like to be able to accomplish the following:
> >
> > (1) Append the title, the month, the author, the number of words, and
> page number(s) to a spreadsheet
> >
> > (2) Read each article and extract keywords (in the docs, these are
> listed in 'Subject' section as a list of keywords with a percentage showing
> the extent to which the keyword features in the article (e.g., FAST FASHION
> (72%)) and to append the keyword and the % coverage to the same row in the
> spreadsheet. However, I want to ensure that the keyword coverage meets the
> threshold of >= 50%; if not, then pass onto the next article in the
> directory. Rinse and repeat for the entire directory.
> >
> > So far, I've tried working through some Stack Overflow-based solutions,
> but most seem to use the textreadr package, which is now deprecated; others
> use either the officer or the officedown packages. However, these packages
> don't appear to do what I want the program to do, at least not in any of
> the examples I have found, nor in the vignettes and relevant package
> manuals I've looked at.
> >
> > The first point is, is what I am intending to do even possible using R?
> If it is, then where do I start with this? If these docx files were
> converted to UTF-8 plain text, would that make the task easier?
> >
> > I am not a confident coder, and am really only just getting my head
> around R so appreciate a steep learning curve ahead, but of course, I don't
> know what I don't know, so any pointers in the right direction would be a
> big help.
> >
> > Many thanks in anticipation
> >
> > Andy
> >
> > __
> > 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.
>

[[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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread jim holtman
checkout the 'officer' package

Thanks

Jim Holtman
*Data Munger Guru*


*What is the problem that you are trying to solve?Tell me what you want to
do, not how you want to do it.*


On Fri, Dec 29, 2023 at 10:14 AM Andy  wrote:

> Hello
>
> I am trying to work through a problem, but feel like I've gone down a
> rabbit hole. I'd very much appreciate any help.
>
> The task: I have several directories of multiple (some directories, up
> to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that
> I want to iterate through to append to a spreadsheet only those articles
> that satisfy a condition (i.e., a specific keyword is present for >= 50%
> coverage of the subject matter). Lexis+ has a very specific structure
> and keywords are given in the row "Subject".
>
> I'd like to be able to accomplish the following:
>
> (1) Append the title, the month, the author, the number of words, and
> page number(s) to a spreadsheet
>
> (2) Read each article and extract keywords (in the docs, these are
> listed in 'Subject' section as a list of keywords with a percentage
> showing the extent to which the keyword features in the article (e.g.,
> FAST FASHION (72%)) and to append the keyword and the % coverage to the
> same row in the spreadsheet. However, I want to ensure that the keyword
> coverage meets the threshold of >= 50%; if not, then pass onto the next
> article in the directory. Rinse and repeat for the entire directory.
>
> So far, I've tried working through some Stack Overflow-based solutions,
> but most seem to use the textreadr package, which is now deprecated;
> others use either the officer or the officedown packages. However, these
> packages don't appear to do what I want the program to do, at least not
> in any of the examples I have found, nor in the vignettes and relevant
> package manuals I've looked at.
>
> The first point is, is what I am intending to do even possible using R?
> If it is, then where do I start with this? If these docx files were
> converted to UTF-8 plain text, would that make the task easier?
>
> I am not a confident coder, and am really only just getting my head
> around R so appreciate a steep learning curve ahead, but of course, I
> don't know what I don't know, so any pointers in the right direction
> would be a big help.
>
> Many thanks in anticipation
>
> Andy
>
> __
> 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] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-29 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi Andy:

I don’t have an answer but I do have what I hope is some friendly advice.  
Generally the more information you can provide,  the more likely you will get 
help that is useful.  In your case you say that you tried several packages and 
they didn’t do what you wanted.  Providing that code,  as well as why they 
didn’t do what you wanted (be specific)  would greatly facilitate things.

Happy new year,

-Roy


> On Dec 29, 2023, at 10:14 AM, Andy  wrote:
> 
> Hello
> 
> I am trying to work through a problem, but feel like I've gone down a rabbit 
> hole. I'd very much appreciate any help.
> 
> The task: I have several directories of multiple (some directories, up to 
> 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want 
> to iterate through to append to a spreadsheet only those articles that 
> satisfy a condition (i.e., a specific keyword is present for >= 50% coverage 
> of the subject matter). Lexis+ has a very specific structure and keywords are 
> given in the row "Subject".
> 
> I'd like to be able to accomplish the following:
> 
> (1) Append the title, the month, the author, the number of words, and page 
> number(s) to a spreadsheet
> 
> (2) Read each article and extract keywords (in the docs, these are listed in 
> 'Subject' section as a list of keywords with a percentage showing the extent 
> to which the keyword features in the article (e.g., FAST FASHION (72%)) and 
> to append the keyword and the % coverage to the same row in the spreadsheet. 
> However, I want to ensure that the keyword coverage meets the threshold of >= 
> 50%; if not, then pass onto the next article in the directory. Rinse and 
> repeat for the entire directory.
> 
> So far, I've tried working through some Stack Overflow-based solutions, but 
> most seem to use the textreadr package, which is now deprecated; others use 
> either the officer or the officedown packages. However, these packages don't 
> appear to do what I want the program to do, at least not in any of the 
> examples I have found, nor in the vignettes and relevant package manuals I've 
> looked at.
> 
> The first point is, is what I am intending to do even possible using R? If it 
> is, then where do I start with this? If these docx files were converted to 
> UTF-8 plain text, would that make the task easier?
> 
> I am not a confident coder, and am really only just getting my head around R 
> so appreciate a steep learning curve ahead, but of course, I don't know what 
> I don't know, so any pointers in the right direction would be a big help.
> 
> Many thanks in anticipation
> 
> Andy
> 
> __
> 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] Help with plotting and date-times for climate data

2023-09-15 Thread Martin Møller Skarbiniks Pedersen
Change

 geom_point(aes(y = tmax_mean, color = "blue"))
to
 geom_point(aes(y = tmax_mean), color = "blue")
if you want blue points.

aes(color = ) does not set the color of the points.

aes(color = ) takes a column (best if it is a factor) and uses that for
different colors.


/Martin

On Tue, Sep 12, 2023, 22:50 Kevin Zembower via R-help 
wrote:

> Hello,
>
> I'm trying to calculate the mean temperature max from a file of climate
> date, and plot it over a range of days in the year. I've downloaded the
> data, and cleaned it up the way I think it should be. However, when I
> plot it, the geom_smooth line doesn't show up. I think that's because
> my x axis is characters or factors. Here's what I have so far:
> 
> library(tidyverse)
>
> data <- read_csv("Ely_MN_Weather.csv")
>
> start_day = yday(as_date("2023-09-22"))
> end_day = yday(as_date("2023-10-15"))
>
> d <- as_tibble(data) %>%
> select(DATE,TMAX,TMIN) %>%
> mutate(DATE = as_date(DATE),
>yday = yday(DATE),
>md = sprintf("%02d-%02d", month(DATE), mday(DATE))
>) %>%
> filter(yday >= start_day & yday <= end_day) %>%
> mutate(md = as.factor(md))
>
> d_sum <- d %>%
> group_by(md) %>%
> summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
>
> ## Here's the filtered data:
> dput(d_sum)
>
> > structure(list(md = structure(1:25, levels = c("09-21", "09-22",
> "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> "09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
> "10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
> "10-14", "10-15"), class = "factor"), tmax_mean = c(65,
> 62.2,
> 61.3, 63.9, 64.3, 60.1, 62.3, 60.5, 61.9,
> 61.2, 63.7, 59.5, 59.6, 61.6,
> 59.4, 58.8, 55.9, 58.125,
> 58, 55.7, 57, 55.4, 49.8,
> 48.75, 43.7)), class = c("tbl_df", "tbl", "data.frame"
> ), row.names = c(NA, -25L))
> >
> ggplot(data = d_sum, aes(x = md)) +
> geom_point(aes(y = tmax_mean, color = "blue")) +
> geom_smooth(aes(y = tmax_mean, color = "blue"))
> =
> My questions are:
> 1. Why isn't my geom_smooth plotting? How can I fix it?
> 2. I don't think I'm handling the month and day combination correctly.
> Is there a way to encode month and day (but not year) as a date?
> 3. (Minor point) Why does my graph of tmax_mean come out red when I
> specify "blue"?
>
> Thanks for any advice or guidance you can offer. I really appreciate
> the expertise of this group.
>
> -Kevin
>
> __
> 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] Help with plotting and date-times for climate data

2023-09-13 Thread Richard O'Keefe
can be modeled as a function of
> > > temperature. These are often called growing degree day models (or
> > > some version of that). This is number of thermal units needed for
> > > the organism to develop to the next stage (e.g. instar for an
> > > insect, or fruit/flower formation for a plant). However, better
> > > accuracy is obtained if the model includes both min and max
> > > thresholds.
> > >
> > > All I have done is provide an example where min and max could have
> > > a real world use. I use max(temp) over some interval and then
> > > update an accumulated thermal units variable based on the outcome.
> > > That detail is not evident in the original request.
> > >
> > > Tim
> > >
> > > -Original Message-
> > > From: R-help  On Behalf Of Richard
> > > O'Keefe
> > > Sent: Wednesday, September 13, 2023 9:58 AM
> > > To: Kevin Zembower 
> > > Cc: r-help@r-project.org
> > > Subject: Re: [R] Help with plotting and date-times for climate data
> > >
> > > [External Email]
> > >
> > > Off-topic, but what is a "mean temperature max"
> > > and what good would it do you to know you if you did?
> > > I've been looking at a lot of weather station data and for no
> > > question I've ever had (except "would the newspapers get excited
> > > about this") was "max" (or min) the answer.  Considering the way
> > > that temperature can change by several degrees in a few minutes, or
> > > a few metres -- I meant horizontally when I wrote that, but as you
> > > know your head and feet don't experience the same temperature,
> > > again by more than one degree -- I am at something of a loss to
> > > ascribe much practical significance to TMAX.  Are you sure this is
> > > the analysis you want to do?  Is this the most informative data you
> > > can get?
> > >
> > > On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help <
> > > r-help@r-project.org> wrote:
> > >
> > > > Hello,
> > > >
> > > > I'm trying to calculate the mean temperature max from a file of
> > > > climate date, and plot it over a range of days in the year. I've
> > > > downloaded the data, and cleaned it up the way I think it should
> > > > be.
> > > > However, when I plot it, the geom_smooth line doesn't show up. I
> > > > think
> > > > that's because my x axis is characters or factors. Here's what I
> > > > have so far:
> > > > 
> > > > library(tidyverse)
> > > >
> > > > data <- read_csv("Ely_MN_Weather.csv")
> > > >
> > > > start_day = yday(as_date("2023-09-22")) end_day =
> > > > yday(as_date("2023-10-15"))
> > > >
> > > > d <- as_tibble(data) %>%
> > > >  select(DATE,TMAX,TMIN) %>%
> > > >  mutate(DATE = as_date(DATE),
> > > > yday = yday(DATE),
> > > > md = sprintf("%02d-%02d", month(DATE), mday(DATE))
> > > > ) %>%
> > > >  filter(yday >= start_day & yday <= end_day) %>%
> > > >  mutate(md = as.factor(md))
> > > >
> > > > d_sum <- d %>%
> > > >  group_by(md) %>%
> > > >  summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
> > > >
> > > > ## Here's the filtered data:
> > > > dput(d_sum)
> > > >
> > > > > structure(list(md = structure(1:25, levels = c("09-21", "09-
> > > > > 22",
> > > > "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> > > > "09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
> > > > "10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
> > > > "10-14", "10-15"), class = "factor"), tmax_mean = c(65,
> > > > 62.2, 61.3, 63.9, 64.3, 60.1,
> > > > 62.3, 60.5, 61.9, 61.2, 63.7, 59.5, 59.6,
> > > > 61.6, 59.4, 58.8,
&

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
Dear Kevin,

You could try the National Weather Service. I can get "International Falls" and 
other locations, though Ely is not specifically listed. 

h**ps://www.weather.gov/wrh/climate?wfo=dlh
Replace the ** with tt and it should give the right link.

There is a menu.
Select your location,
Select a product (I selected temperature)
Select a year, and period of interest.
Select go.

If you scroll over the figure a popup with numbers appears.

The weather data in R is possible as well.
I would start by filtering the data to remove dates outside my range of 
interest. Then extract the date (say Day). Group_by the day and apply a max 
function to the grouped data. Then plot the result.

Tim

-Original Message-
From: Kevin Zembower  
Sent: Wednesday, September 13, 2023 3:26 PM
To: Ebert,Timothy Aaron ; Richard O'Keefe 
Cc: r-help@r-project.org
Subject: Re: [R] Help with plotting and date-times for climate data

[External Email]

Hi, Tim,

I actually did see this chart when I was doing some research, but rejected it 
because it was difficult to interpolate the graph for the three week period I 
was interested it. I didn't discover until just now that I could click on the 
labels on the x-axis to expand the graph.
Unfortunately, downloading the data from this site costs $95/month.

Also, I found the raw data (from the NWS, for free) and decided to exercise my 
R skills to see if I could produce the exact graph I wanted.

Thanks for taking the time to research this.

-Kevin

On Wed, 2023-09-13 at 18:21 +, Ebert,Timothy Aaron wrote:
> Hi Kevin,
>
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fweat
> herspark.com%2Fy%2F11610%2FAverage-Weather-in-Ely-Minnesota-United-Sta
> tes-Year-Round&data=05%7C01%7Ctebert%40ufl.edu%7C3c23bc8b4af14d747e2f0
> 8dbb48f37af%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C6383022994410
> 38779%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB
> TiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CE%2FYdcJbtKhZZ6VeRlI
> 55gEfwy8m2i1yhO9iUgB%2BkUc%3D&reserved=0
> Just scroll down. I think what you are looking for is the first graph, 
> but there are about a dozen other graphs on various meteorological 
> metrics.
>
>Another option would be to use larger cities (Duluth, 
> International Falls, Thunder Bay) and take a metal average. There is a 
> lake effect for two of these more than the other.
>
>All good?
> Tim
>
> -Original Message-
> From: Kevin Zembower 
> Sent: Wednesday, September 13, 2023 2:05 PM
> To: Ebert,Timothy Aaron ; Richard O'Keefe 
> 
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with plotting and date-times for climate data
>
> [External Email]
>
> Well, I looked for this, on both the NWS and WeatherUnderground, but 
> couldn't find what I was looking for. Didn't check Weather.com, but if 
> you can find a chart of the average high and low temperatures in Ely, 
> MN between about the middle of September to the middle of October, 
> I'll buy you a beer.
>
> -Kevin
>
> On Wed, 2023-09-13 at 17:39 +, Ebert,Timothy Aaron wrote:
> > I admire the dedication to R and data science, but the Weather 
> > Channel might be a simpler approach. Weather.com. I can search for 
> > (city
> > name)
> > and either weather (current values) or climate. It depends on how 
> > far away the trip will be.
> >
> > -Original Message-
> > From: Kevin Zembower 
> > Sent: Wednesday, September 13, 2023 1:22 PM
> > To: Richard O'Keefe ; Ebert,Timothy Aaron 
> > 
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Help with plotting and date-times for climate data
> >
> > [External Email]
> >
> > Tim, Richard, y'all are reading too much into this. I believe that 
> > TMAX is the high temperature of the day, and TMIN is the low. I'm 
> > trying to compute the average or median high and low temperatures 
> > for the data I have (2011 to present). I'm going on a trip to this 
> > area, and want to know how to pack.
> >
> > Thanks for your interest.
> >
> > -Kevin
> >
> > On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> > > I am well aware of the physiological implications of temperature, 
> > > and that is *why* I view recorded TMIN and TMAX at a single point 
> > > with an extremely jaundiced eye.  TMAX at shoulder height has very 
> > > little relevance to an insect living in grass, for example.  And 
> > > if TMAX is sustained for one second, that has very different 
> > > consequences from if TMAX is sustained for five minutes.  I can 
> > > see the usefulness of "proportion of day abov

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Kevin Zembower via R-help
Hi, Tim,

I actually did see this chart when I was doing some research, but
rejected it because it was difficult to interpolate the graph for the
three week period I was interested it. I didn't discover until just now
that I could click on the labels on the x-axis to expand the graph.
Unfortunately, downloading the data from this site costs $95/month. 

Also, I found the raw data (from the NWS, for free) and decided to
exercise my R skills to see if I could produce the exact graph I
wanted.

Thanks for taking the time to research this.

-Kevin

On Wed, 2023-09-13 at 18:21 +, Ebert,Timothy Aaron wrote:
> Hi Kevin,
> 
> https://weatherspark.com/y/11610/Average-Weather-in-Ely-Minnesota-United-States-Year-Round
> Just scroll down. I think what you are looking for is the first
> graph, but there are about a dozen other graphs on various
> meteorological metrics. 
>    
>    Another option would be to use larger cities (Duluth,
> International Falls, Thunder Bay) and take a metal average. There is
> a lake effect for two of these more than the other. 
>    
>    All good?
> Tim
> 
> -Original Message-
> From: Kevin Zembower  
> Sent: Wednesday, September 13, 2023 2:05 PM
> To: Ebert,Timothy Aaron ; Richard O'Keefe
> 
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with plotting and date-times for climate data
> 
> [External Email]
> 
> Well, I looked for this, on both the NWS and WeatherUnderground, but
> couldn't find what I was looking for. Didn't check Weather.com, but
> if you can find a chart of the average high and low temperatures in
> Ely, MN between about the middle of September to the middle of
> October, I'll buy you a beer.
> 
> -Kevin
> 
> On Wed, 2023-09-13 at 17:39 +, Ebert,Timothy Aaron wrote:
> > I admire the dedication to R and data science, but the Weather
> > Channel 
> > might be a simpler approach. Weather.com. I can search for (city
> > name) 
> > and either weather (current values) or climate. It depends on how
> > far 
> > away the trip will be.
> > 
> > -Original Message-----
> > From: Kevin Zembower 
> > Sent: Wednesday, September 13, 2023 1:22 PM
> > To: Richard O'Keefe ; Ebert,Timothy Aaron 
> > 
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Help with plotting and date-times for climate data
> > 
> > [External Email]
> > 
> > Tim, Richard, y'all are reading too much into this. I believe that 
> > TMAX is the high temperature of the day, and TMIN is the low. I'm 
> > trying to compute the average or median high and low temperatures
> > for 
> > the data I have (2011 to present). I'm going on a trip to this
> > area, 
> > and want to know how to pack.
> > 
> > Thanks for your interest.
> > 
> > -Kevin
> > 
> > On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> > > I am well aware of the physiological implications of temperature,
> > > and that is *why* I view recorded TMIN and TMAX at a single point
> > > with an extremely jaundiced eye.  TMAX at shoulder height has
> > > very 
> > > little relevance to an insect living in grass, for example.  And
> > > if 
> > > TMAX is sustained for one second, that has very different 
> > > consequences from if TMAX is sustained for five minutes.  I can
> > > see 
> > > the usefulness of "proportion of day above Thi/below Tlo", but
> > > that 
> > > is quite different.
> > > 
> > > OK, so my interest in weather data was mainly based around water
> > > management: precipitation, evaporation, herd and crop water
> > > needs, 
> > > that kind of thing.  And the first thing you learn from that 
> > > experience is that ANY kind of single-point summary is seriously 
> > > misleading.
> > > 
> > > Let's end this digression.
> > > 
> > > 
> > > On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron
> > > 
> > > wrote:
> > > > I had the same question.
> > > > However, I can partly answer the off-topic question. Min and
> > > > max 
> > > > can be important as lower and upper development thresholds.
> > > > Below 
> > > > the min no growth or development occur because reaction rates
> > > > are 
> > > > too slow to enable such. Above max, temperatures are too hot.
> > > > Protein function is impaired, and systems stop functioning.
> > > > There 
> > > > is a considerable range between where systems shut

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
Hi Kevin,

https://weatherspark.com/y/11610/Average-Weather-in-Ely-Minnesota-United-States-Year-Round
Just scroll down. I think what you are looking for is the first graph, but 
there are about a dozen other graphs on various meteorological metrics. 
   
   Another option would be to use larger cities (Duluth, International 
Falls, Thunder Bay) and take a metal average. There is a lake effect for two of 
these more than the other. 
   
   All good?
Tim

-Original Message-
From: Kevin Zembower  
Sent: Wednesday, September 13, 2023 2:05 PM
To: Ebert,Timothy Aaron ; Richard O'Keefe 
Cc: r-help@r-project.org
Subject: Re: [R] Help with plotting and date-times for climate data

[External Email]

Well, I looked for this, on both the NWS and WeatherUnderground, but couldn't 
find what I was looking for. Didn't check Weather.com, but if you can find a 
chart of the average high and low temperatures in Ely, MN between about the 
middle of September to the middle of October, I'll buy you a beer.

-Kevin

On Wed, 2023-09-13 at 17:39 +, Ebert,Timothy Aaron wrote:
> I admire the dedication to R and data science, but the Weather Channel 
> might be a simpler approach. Weather.com. I can search for (city name) 
> and either weather (current values) or climate. It depends on how far 
> away the trip will be.
>
> -Original Message-
> From: Kevin Zembower 
> Sent: Wednesday, September 13, 2023 1:22 PM
> To: Richard O'Keefe ; Ebert,Timothy Aaron 
> 
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with plotting and date-times for climate data
>
> [External Email]
>
> Tim, Richard, y'all are reading too much into this. I believe that 
> TMAX is the high temperature of the day, and TMIN is the low. I'm 
> trying to compute the average or median high and low temperatures for 
> the data I have (2011 to present). I'm going on a trip to this area, 
> and want to know how to pack.
>
> Thanks for your interest.
>
> -Kevin
>
> On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> > I am well aware of the physiological implications of temperature, 
> > and that is *why* I view recorded TMIN and TMAX at a single point 
> > with an extremely jaundiced eye.  TMAX at shoulder height has very 
> > little relevance to an insect living in grass, for example.  And if 
> > TMAX is sustained for one second, that has very different 
> > consequences from if TMAX is sustained for five minutes.  I can see 
> > the usefulness of "proportion of day above Thi/below Tlo", but that 
> > is quite different.
> >
> > OK, so my interest in weather data was mainly based around water
> > management: precipitation, evaporation, herd and crop water needs, 
> > that kind of thing.  And the first thing you learn from that 
> > experience is that ANY kind of single-point summary is seriously 
> > misleading.
> >
> > Let's end this digression.
> >
> >
> > On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron 
> > wrote:
> > > I had the same question.
> > > However, I can partly answer the off-topic question. Min and max 
> > > can be important as lower and upper development thresholds. Below 
> > > the min no growth or development occur because reaction rates are 
> > > too slow to enable such. Above max, temperatures are too hot.
> > > Protein function is impaired, and systems stop functioning. There 
> > > is a considerable range between where systems shut down (but
> > > recover) and tissue death.
> > > In a simple form the growth and physiological stage of plants, 
> > > insects, and many others, can be modeled as a function of 
> > > temperature. These are often called growing degree day models (or 
> > > some version of that). This is number of thermal units needed for 
> > > the organism to develop to the next stage (e.g. instar for an 
> > > insect, or fruit/flower formation for a plant). However, better 
> > > accuracy is obtained if the model includes both min and max 
> > > thresholds.
> > >
> > > All I have done is provide an example where min and max could have 
> > > a real world use. I use max(temp) over some interval and then 
> > > update an accumulated thermal units variable based on the outcome.
> > > That detail is not evident in the original request.
> > >
> > > Tim
> > >
> > > -Original Message-
> > > From: R-help  On Behalf Of Richard
> > > O'Keefe
> > > Sent: Wednesday, September 13, 2023 9:58 AM
> > > To: Kevin Zembower 
> > > Cc: r-help@r-project.org
> > > 

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Kevin Zembower via R-help
Well, I looked for this, on both the NWS and WeatherUnderground, but
couldn't find what I was looking for. Didn't check Weather.com, but if
you can find a chart of the average high and low temperatures in Ely,
MN between about the middle of September to the middle of October, I'll
buy you a beer.

-Kevin

On Wed, 2023-09-13 at 17:39 +, Ebert,Timothy Aaron wrote:
> I admire the dedication to R and data science, but the Weather
> Channel might be a simpler approach. Weather.com. I can search for
> (city name) and either weather (current values) or climate. It
> depends on how far away the trip will be.
> 
> -Original Message-
> From: Kevin Zembower  
> Sent: Wednesday, September 13, 2023 1:22 PM
> To: Richard O'Keefe ; Ebert,Timothy Aaron
> 
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with plotting and date-times for climate data
> 
> [External Email]
> 
> Tim, Richard, y'all are reading too much into this. I believe that
> TMAX is the high temperature of the day, and TMIN is the low. I'm
> trying to compute the average or median high and low temperatures for
> the data I have (2011 to present). I'm going on a trip to this area,
> and want to know how to pack.
> 
> Thanks for your interest.
> 
> -Kevin
> 
> On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> > I am well aware of the physiological implications of temperature,
> > and 
> > that is *why* I view recorded TMIN and TMAX at a single point with
> > an 
> > extremely jaundiced eye.  TMAX at shoulder height has very little 
> > relevance to an insect living in grass, for example.  And if TMAX
> > is 
> > sustained for one second, that has very different consequences from
> > if 
> > TMAX is sustained for five minutes.  I can see the usefulness of 
> > "proportion of day above Thi/below Tlo", but that is quite
> > different.
> > 
> > OK, so my interest in weather data was mainly based around water 
> > management: precipitation, evaporation, herd and crop water needs, 
> > that kind of thing.  And the first thing you learn from that 
> > experience is that ANY kind of single-point summary is seriously 
> > misleading.
> > 
> > Let's end this digression.
> > 
> > 
> > On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron 
> > wrote:
> > > I had the same question.
> > > However, I can partly answer the off-topic question. Min and max
> > > can 
> > > be important as lower and upper development thresholds. Below the
> > > min no growth or development occur because reaction rates are too
> > > slow to enable such. Above max, temperatures are too hot.
> > > Protein function is impaired, and systems stop functioning. There
> > > is 
> > > a considerable range between where systems shut down (but
> > > recover) and tissue death.
> > > In a simple form the growth and physiological stage of plants, 
> > > insects, and many others, can be modeled as a function of 
> > > temperature. These are often called growing degree day models (or
> > > some version of that). This is number of thermal units needed for
> > > the organism to develop to the next stage (e.g. instar for an 
> > > insect, or fruit/flower formation for a plant). However, better 
> > > accuracy is obtained if the model includes both min and max 
> > > thresholds.
> > > 
> > > All I have done is provide an example where min and max could
> > > have a 
> > > real world use. I use max(temp) over some interval and then
> > > update 
> > > an accumulated thermal units variable based on the outcome.
> > > That detail is not evident in the original request.
> > > 
> > > Tim
> > > 
> > > -Original Message-
> > > From: R-help  On Behalf Of Richard 
> > > O'Keefe
> > > Sent: Wednesday, September 13, 2023 9:58 AM
> > > To: Kevin Zembower 
> > > Cc: r-help@r-project.org
> > > Subject: Re: [R] Help with plotting and date-times for climate
> > > data
> > > 
> > > [External Email]
> > > 
> > > Off-topic, but what is a "mean temperature max"
> > > and what good would it do you to know you if you did?
> > > I've been looking at a lot of weather station data and for no 
> > > question I've ever had (except "would the newspapers get excited 
> > > about this") was "max" (or min) the answer.  Considering the way 
> > > that temperature can change by several degrees in a few

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
I admire the dedication to R and data science, but the Weather Channel might be 
a simpler approach. Weather.com. I can search for (city name) and either 
weather (current values) or climate. It depends on how far away the trip will 
be.

-Original Message-
From: Kevin Zembower  
Sent: Wednesday, September 13, 2023 1:22 PM
To: Richard O'Keefe ; Ebert,Timothy Aaron 
Cc: r-help@r-project.org
Subject: Re: [R] Help with plotting and date-times for climate data

[External Email]

Tim, Richard, y'all are reading too much into this. I believe that TMAX is the 
high temperature of the day, and TMIN is the low. I'm trying to compute the 
average or median high and low temperatures for the data I have (2011 to 
present). I'm going on a trip to this area, and want to know how to pack.

Thanks for your interest.

-Kevin

On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> I am well aware of the physiological implications of temperature, and 
> that is *why* I view recorded TMIN and TMAX at a single point with an 
> extremely jaundiced eye.  TMAX at shoulder height has very little 
> relevance to an insect living in grass, for example.  And if TMAX is 
> sustained for one second, that has very different consequences from if 
> TMAX is sustained for five minutes.  I can see the usefulness of 
> "proportion of day above Thi/below Tlo", but that is quite different.
>
> OK, so my interest in weather data was mainly based around water 
> management: precipitation, evaporation, herd and crop water needs, 
> that kind of thing.  And the first thing you learn from that 
> experience is that ANY kind of single-point summary is seriously 
> misleading.
>
> Let's end this digression.
>
>
> On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron 
> wrote:
> > I had the same question.
> > However, I can partly answer the off-topic question. Min and max can 
> > be important as lower and upper development thresholds. Below the 
> > min no growth or development occur because reaction rates are too 
> > slow to enable such. Above max, temperatures are too hot.
> > Protein function is impaired, and systems stop functioning. There is 
> > a considerable range between where systems shut down (but
> > recover) and tissue death.
> > In a simple form the growth and physiological stage of plants, 
> > insects, and many others, can be modeled as a function of 
> > temperature. These are often called growing degree day models (or 
> > some version of that). This is number of thermal units needed for 
> > the organism to develop to the next stage (e.g. instar for an 
> > insect, or fruit/flower formation for a plant). However, better 
> > accuracy is obtained if the model includes both min and max 
> > thresholds.
> >
> > All I have done is provide an example where min and max could have a 
> > real world use. I use max(temp) over some interval and then update 
> > an accumulated thermal units variable based on the outcome.
> > That detail is not evident in the original request.
> >
> > Tim
> >
> > -Original Message-
> > From: R-help  On Behalf Of Richard 
> > O'Keefe
> > Sent: Wednesday, September 13, 2023 9:58 AM
> > To: Kevin Zembower 
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Help with plotting and date-times for climate data
> >
> > [External Email]
> >
> > Off-topic, but what is a "mean temperature max"
> > and what good would it do you to know you if you did?
> > I've been looking at a lot of weather station data and for no 
> > question I've ever had (except "would the newspapers get excited 
> > about this") was "max" (or min) the answer.  Considering the way 
> > that temperature can change by several degrees in a few minutes, or 
> > a few metres -- I meant horizontally when I wrote that, but as you 
> > know your head and feet don't experience the same temperature, again 
> > by more than one degree -- I am at something of a loss to ascribe 
> > much practical significance to TMAX.  Are you sure this is the 
> > analysis you want to do?  Is this the most informative data you can 
> > get?
> >
> > On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help < 
> > r-help@r-project.org> wrote:
> >
> > > Hello,
> > >
> > > I'm trying to calculate the mean temperature max from a file of 
> > > climate date, and plot it over a range of days in the year. I've 
> > > downloaded the data, and cleaned it up the way I think it should 
> > > be.
> > > However, when I plot it, the geom_smooth line doe

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Kevin Zembower via R-help
Rui, thanks so much for your clear explanation, solution to my problem,
and additional help with making the graph come out exactly as I was
hoping. I learned a lot from your solution. Thanks, again, for your
help.

-Kevin

On Tue, 2023-09-12 at 23:06 +0100, Rui Barradas wrote:
> Às 21:50 de 12/09/2023, Kevin Zembower via R-help escreveu:
> > Hello,
> > 
> > I'm trying to calculate the mean temperature max from a file of
> > climate
> > date, and plot it over a range of days in the year. I've downloaded
> > the
> > data, and cleaned it up the way I think it should be. However, when
> > I
> > plot it, the geom_smooth line doesn't show up. I think that's
> > because
> > my x axis is characters or factors. Here's what I have so far:
> > 
> > library(tidyverse)
> > 
> > data <- read_csv("Ely_MN_Weather.csv")
> > 
> > start_day = yday(as_date("2023-09-22"))
> > end_day = yday(as_date("2023-10-15"))
> >     
> > d <- as_tibble(data) %>%
> >  select(DATE,TMAX,TMIN) %>%
> >  mutate(DATE = as_date(DATE),
> >     yday = yday(DATE),
> >     md = sprintf("%02d-%02d", month(DATE), mday(DATE))
> >     ) %>%
> >  filter(yday >= start_day & yday <= end_day) %>%
> >  mutate(md = as.factor(md))
> > 
> > d_sum <- d %>%
> >  group_by(md) %>%
> >  summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
> > 
> > ## Here's the filtered data:
> > dput(d_sum)
> > 
> > > structure(list(md = structure(1:25, levels = c("09-21", "09-22",
> > "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> > "09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
> > "10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
> > "10-14", "10-15"), class = "factor"), tmax_mean = c(65,
> > 62.2,
> > 61.3, 63.9, 64.3, 60.1, 62.3, 60.5, 61.9,
> > 61.2, 63.7, 59.5, 59.6, 61.6,
> > 59.4, 58.8, 55.9, 58.125,
> > 58, 55.7, 57, 55.4, 49.8,
> > 48.75, 43.7)), class = c("tbl_df", "tbl", "data.frame"
> > ), row.names = c(NA, -25L))
> > > 
> > ggplot(data = d_sum, aes(x = md)) +
> >  geom_point(aes(y = tmax_mean, color = "blue")) +
> >  geom_smooth(aes(y = tmax_mean, color = "blue"))
> > =
> > My questions are:
> > 1. Why isn't my geom_smooth plotting? How can I fix it?
> > 2. I don't think I'm handling the month and day combination
> > correctly.
> > Is there a way to encode month and day (but not year) as a date?
> > 3. (Minor point) Why does my graph of tmax_mean come out red when I
> > specify "blue"?
> > 
> > Thanks for any advice or guidance you can offer. I really
> > appreciate
> > the expertise of this group.
> > 
> > -Kevin
> > 
> > __
> > 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.
> Hello,
> 
> The problem is that the dates are factors, not real dates. And 
> geom_smooth is not interpolating along a discrete axis (the x axis).
> 
> Paste a fake year with md, coerce to date and plot.
> I have simplified the aes() calls and added a date scale in order to 
> make the x axis more readable.
> 
> Without the formula and method arguments, geom_smooth will print a 
> message, they are now made explicit.
> 
> 
> 
> suppressPackageStartupMessages({
>    library(dplyr)
>    library(ggplot2)
> })
> 
> d_sum %>%
>    mutate(md = paste("2023", md, sep = "-"),
>   md = as.Date(md)) %>%
>    ggplot(aes(x = md, y = tmax_mean)) +
>    geom_point(color = "blue") +
>    geom_smooth(
>  formula = y ~ x,
>  method = loess,
>  color = "blue"
>    ) +
>    scale_x_date(date_breaks = "7 days", date_labels = "%m-%d")
> 
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 



__
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] Help with plotting and date-times for climate data

2023-09-13 Thread Kevin Zembower via R-help
Tim, Richard, y'all are reading too much into this. I believe that TMAX
is the high temperature of the day, and TMIN is the low. I'm trying to
compute the average or median high and low temperatures for the data I
have (2011 to present). I'm going on a trip to this area, and want to
know how to pack.

Thanks for your interest.

-Kevin

On Thu, 2023-09-14 at 03:07 +1200, Richard O'Keefe wrote:
> I am well aware of the physiological implications
> of temperature, and that is *why* I view recorded
> TMIN and TMAX at a single point with an extremely
> jaundiced eye.  TMAX at shoulder height has very
> little relevance to an insect living in grass, for
> example.  And if TMAX is sustained for one second,
> that has very different consequences from if TMAX
> is sustained for five minutes.  I can see the usefulness
> of "proportion of day above Thi/below Tlo", but that
> is quite different.
> 
> OK, so my interest in weather data was mainly based
> around water management: precipitation, evaporation,
> herd and crop water needs, that kind of thing.  And
> the first thing you learn from that experience is
> that ANY kind of single-point summary is seriously
> misleading.
> 
> Let's end this digression.
> 
> 
> On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron 
> wrote:
> > I had the same question.
> > However, I can partly answer the off-topic question. Min and max
> > can be important as lower and upper development thresholds. Below
> > the min no growth or development occur because reaction rates are
> > too slow to enable such. Above max, temperatures are too hot.
> > Protein function is impaired, and systems stop functioning. There
> > is a considerable range between where systems shut down (but
> > recover) and tissue death.
> > In a simple form the growth and physiological stage of plants,
> > insects, and many others, can be modeled as a function of
> > temperature. These are often called growing degree day models (or
> > some version of that). This is number of thermal units needed for
> > the organism to develop to the next stage (e.g. instar for an
> > insect, or fruit/flower formation for a plant). However, better
> > accuracy is obtained if the model includes both min and max
> > thresholds.
> > 
> > All I have done is provide an example where min and max could have
> > a real world use. I use max(temp) over some interval and then
> > update an accumulated thermal units variable based on the outcome.
> > That detail is not evident in the original request.
> > 
> > Tim
> > 
> > -Original Message-
> > From: R-help  On Behalf Of Richard
> > O'Keefe
> > Sent: Wednesday, September 13, 2023 9:58 AM
> > To: Kevin Zembower 
> > Cc: r-help@r-project.org
> > Subject: Re: [R] Help with plotting and date-times for climate data
> > 
> > [External Email]
> > 
> > Off-topic, but what is a "mean temperature max"
> > and what good would it do you to know you if you did?
> > I've been looking at a lot of weather station data and for no
> > question I've ever had (except "would the newspapers get excited
> > about this") was "max" (or min) the answer.  Considering the way
> > that temperature can change by several degrees in a few minutes, or
> > a few metres -- I meant horizontally when I wrote that, but as you
> > know your head and feet don't experience the same temperature,
> > again by more than one degree -- I am at something of a loss to
> > ascribe much practical significance to TMAX.  Are you sure this is
> > the analysis you want to do?  Is this the most informative data you
> > can get?
> > 
> > On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help <
> > r-help@r-project.org> wrote:
> > 
> > > Hello,
> > > 
> > > I'm trying to calculate the mean temperature max from a file of
> > > climate date, and plot it over a range of days in the year. I've
> > > downloaded the data, and cleaned it up the way I think it should
> > > be.
> > > However, when I plot it, the geom_smooth line doesn't show up. I
> > > think
> > > that's because my x axis is characters or factors. Here's what I
> > > have so far:
> > > 
> > > library(tidyverse)
> > > 
> > > data <- read_csv("Ely_MN_Weather.csv")
> > > 
> > > start_day = yday(as_date("2023-09-22")) end_day =
> > > yday(as_date("2023-10-15"))
> > > 
> >

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Richard O'Keefe
I am well aware of the physiological implications
of temperature, and that is *why* I view recorded
TMIN and TMAX at a single point with an extremely
jaundiced eye.  TMAX at shoulder height has very
little relevance to an insect living in grass, for
example.  And if TMAX is sustained for one second,
that has very different consequences from if TMAX
is sustained for five minutes.  I can see the usefulness
of "proportion of day above Thi/below Tlo", but that
is quite different.

OK, so my interest in weather data was mainly based
around water management: precipitation, evaporation,
herd and crop water needs, that kind of thing.  And
the first thing you learn from that experience is
that ANY kind of single-point summary is seriously
misleading.

Let's end this digression.


On Thu, 14 Sept 2023 at 02:18, Ebert,Timothy Aaron  wrote:

> I had the same question.
> However, I can partly answer the off-topic question. Min and max can be
> important as lower and upper development thresholds. Below the min no
> growth or development occur because reaction rates are too slow to enable
> such. Above max, temperatures are too hot. Protein function is impaired,
> and systems stop functioning. There is a considerable range between where
> systems shut down (but recover) and tissue death.
> In a simple form the growth and physiological stage of plants, insects,
> and many others, can be modeled as a function of temperature. These are
> often called growing degree day models (or some version of that). This is
> number of thermal units needed for the organism to develop to the next
> stage (e.g. instar for an insect, or fruit/flower formation for a plant).
> However, better accuracy is obtained if the model includes both min and max
> thresholds.
>
> All I have done is provide an example where min and max could have a real
> world use. I use max(temp) over some interval and then update an
> accumulated thermal units variable based on the outcome. That detail is not
> evident in the original request.
>
> Tim
>
> -Original Message-
> From: R-help  On Behalf Of Richard O'Keefe
> Sent: Wednesday, September 13, 2023 9:58 AM
> To: Kevin Zembower 
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with plotting and date-times for climate data
>
> [External Email]
>
> Off-topic, but what is a "mean temperature max"
> and what good would it do you to know you if you did?
> I've been looking at a lot of weather station data and for no question
> I've ever had (except "would the newspapers get excited about this") was
> "max" (or min) the answer.  Considering the way that temperature can change
> by several degrees in a few minutes, or a few metres -- I meant
> horizontally when I wrote that, but as you know your head and feet don't
> experience the same temperature, again by more than one degree -- I am at
> something of a loss to ascribe much practical significance to TMAX.  Are
> you sure this is the analysis you want to do?  Is this the most informative
> data you can get?
>
> On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help <
> r-help@r-project.org> wrote:
>
> > Hello,
> >
> > I'm trying to calculate the mean temperature max from a file of
> > climate date, and plot it over a range of days in the year. I've
> > downloaded the data, and cleaned it up the way I think it should be.
> > However, when I plot it, the geom_smooth line doesn't show up. I think
> > that's because my x axis is characters or factors. Here's what I have so
> far:
> > 
> > library(tidyverse)
> >
> > data <- read_csv("Ely_MN_Weather.csv")
> >
> > start_day = yday(as_date("2023-09-22")) end_day =
> > yday(as_date("2023-10-15"))
> >
> > d <- as_tibble(data) %>%
> > select(DATE,TMAX,TMIN) %>%
> > mutate(DATE = as_date(DATE),
> >yday = yday(DATE),
> >md = sprintf("%02d-%02d", month(DATE), mday(DATE))
> >) %>%
> > filter(yday >= start_day & yday <= end_day) %>%
> > mutate(md = as.factor(md))
> >
> > d_sum <- d %>%
> > group_by(md) %>%
> > summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
> >
> > ## Here's the filtered data:
> > dput(d_sum)
> >
> > > structure(list(md = structure(1:25, levels = c("09-21", "09-22",
> > "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> > "09-30", "10-01", "10-02", "10-03

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Ebert,Timothy Aaron
I had the same question.
However, I can partly answer the off-topic question. Min and max can be 
important as lower and upper development thresholds. Below the min no growth or 
development occur because reaction rates are too slow to enable such. Above 
max, temperatures are too hot. Protein function is impaired, and systems stop 
functioning. There is a considerable range between where systems shut down (but 
recover) and tissue death.
In a simple form the growth and physiological stage of plants, insects, and 
many others, can be modeled as a function of temperature. These are often 
called growing degree day models (or some version of that). This is number of 
thermal units needed for the organism to develop to the next stage (e.g. instar 
for an insect, or fruit/flower formation for a plant). However, better accuracy 
is obtained if the model includes both min and max thresholds.

All I have done is provide an example where min and max could have a real world 
use. I use max(temp) over some interval and then update an accumulated thermal 
units variable based on the outcome. That detail is not evident in the original 
request.

Tim

-Original Message-
From: R-help  On Behalf Of Richard O'Keefe
Sent: Wednesday, September 13, 2023 9:58 AM
To: Kevin Zembower 
Cc: r-help@r-project.org
Subject: Re: [R] Help with plotting and date-times for climate data

[External Email]

Off-topic, but what is a "mean temperature max"
and what good would it do you to know you if you did?
I've been looking at a lot of weather station data and for no question I've 
ever had (except "would the newspapers get excited about this") was "max" (or 
min) the answer.  Considering the way that temperature can change by several 
degrees in a few minutes, or a few metres -- I meant horizontally when I wrote 
that, but as you know your head and feet don't experience the same temperature, 
again by more than one degree -- I am at something of a loss to ascribe much 
practical significance to TMAX.  Are you sure this is the analysis you want to 
do?  Is this the most informative data you can get?

On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help < 
r-help@r-project.org> wrote:

> Hello,
>
> I'm trying to calculate the mean temperature max from a file of
> climate date, and plot it over a range of days in the year. I've
> downloaded the data, and cleaned it up the way I think it should be.
> However, when I plot it, the geom_smooth line doesn't show up. I think
> that's because my x axis is characters or factors. Here's what I have so far:
> 
> library(tidyverse)
>
> data <- read_csv("Ely_MN_Weather.csv")
>
> start_day = yday(as_date("2023-09-22")) end_day =
> yday(as_date("2023-10-15"))
>
> d <- as_tibble(data) %>%
> select(DATE,TMAX,TMIN) %>%
> mutate(DATE = as_date(DATE),
>yday = yday(DATE),
>md = sprintf("%02d-%02d", month(DATE), mday(DATE))
>) %>%
> filter(yday >= start_day & yday <= end_day) %>%
> mutate(md = as.factor(md))
>
> d_sum <- d %>%
> group_by(md) %>%
> summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
>
> ## Here's the filtered data:
> dput(d_sum)
>
> > structure(list(md = structure(1:25, levels = c("09-21", "09-22",
> "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> "09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
> "10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
> "10-14", "10-15"), class = "factor"), tmax_mean = c(65,
> 62.2, 61.3, 63.9, 64.3, 60.1,
> 62.3, 60.5, 61.9, 61.2, 63.7, 59.5, 59.6,
> 61.6, 59.4, 58.8,
> 55.9, 58.125, 58, 55.7, 57, 55.4,
> 49.8, 48.75, 43.7)), class = c("tbl_df",
> "tbl", "data.frame"
> ), row.names = c(NA, -25L))
> >
> ggplot(data = d_sum, aes(x = md)) +
> geom_point(aes(y = tmax_mean, color = "blue")) +
> geom_smooth(aes(y = tmax_mean, color = "blue"))
> =
> My questions are:
> 1. Why isn't my geom_smooth plotting? How can I fix it?
> 2. I don't think I'm handling the month and day combination correctly.
> Is there a way to encode month and day (but not year) as a date?
> 

Re: [R] Help with plotting and date-times for climate data

2023-09-13 Thread Richard O'Keefe
Off-topic, but what is a "mean temperature max"
and what good would it do you to know you if you did?
I've been looking at a lot of weather station data
and for no question I've ever had (except "would the
newspapers get excited about this") was "max" (or min)
the answer.  Considering the way that temperature can
change by several degrees in a few minutes, or a few
metres -- I meant horizontally when I wrote that, but
as you know your head and feet don't experience the
same temperature, again by more than one degree -- I am
at something of a loss to ascribe much practical
significance to TMAX.  Are you sure this is the analysis
you want to do?  Is this the most informative data you
can get?

On Wed, 13 Sept 2023 at 08:51, Kevin Zembower via R-help <
r-help@r-project.org> wrote:

> Hello,
>
> I'm trying to calculate the mean temperature max from a file of climate
> date, and plot it over a range of days in the year. I've downloaded the
> data, and cleaned it up the way I think it should be. However, when I
> plot it, the geom_smooth line doesn't show up. I think that's because
> my x axis is characters or factors. Here's what I have so far:
> 
> library(tidyverse)
>
> data <- read_csv("Ely_MN_Weather.csv")
>
> start_day = yday(as_date("2023-09-22"))
> end_day = yday(as_date("2023-10-15"))
>
> d <- as_tibble(data) %>%
> select(DATE,TMAX,TMIN) %>%
> mutate(DATE = as_date(DATE),
>yday = yday(DATE),
>md = sprintf("%02d-%02d", month(DATE), mday(DATE))
>) %>%
> filter(yday >= start_day & yday <= end_day) %>%
> mutate(md = as.factor(md))
>
> d_sum <- d %>%
> group_by(md) %>%
> summarize(tmax_mean = mean(TMAX, na.rm=TRUE))
>
> ## Here's the filtered data:
> dput(d_sum)
>
> > structure(list(md = structure(1:25, levels = c("09-21", "09-22",
> "09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
> "09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
> "10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
> "10-14", "10-15"), class = "factor"), tmax_mean = c(65,
> 62.2,
> 61.3, 63.9, 64.3, 60.1, 62.3, 60.5, 61.9,
> 61.2, 63.7, 59.5, 59.6, 61.6,
> 59.4, 58.8, 55.9, 58.125,
> 58, 55.7, 57, 55.4, 49.8,
> 48.75, 43.7)), class = c("tbl_df", "tbl", "data.frame"
> ), row.names = c(NA, -25L))
> >
> ggplot(data = d_sum, aes(x = md)) +
> geom_point(aes(y = tmax_mean, color = "blue")) +
> geom_smooth(aes(y = tmax_mean, color = "blue"))
> =
> My questions are:
> 1. Why isn't my geom_smooth plotting? How can I fix it?
> 2. I don't think I'm handling the month and day combination correctly.
> Is there a way to encode month and day (but not year) as a date?
> 3. (Minor point) Why does my graph of tmax_mean come out red when I
> specify "blue"?
>
> Thanks for any advice or guidance you can offer. I really appreciate
> the expertise of this group.
>
> -Kevin
>
> __
> 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] Help with plotting and date-times for climate data

2023-09-12 Thread Rui Barradas

Às 21:50 de 12/09/2023, Kevin Zembower via R-help escreveu:

Hello,

I'm trying to calculate the mean temperature max from a file of climate
date, and plot it over a range of days in the year. I've downloaded the
data, and cleaned it up the way I think it should be. However, when I
plot it, the geom_smooth line doesn't show up. I think that's because
my x axis is characters or factors. Here's what I have so far:

library(tidyverse)

data <- read_csv("Ely_MN_Weather.csv")

start_day = yday(as_date("2023-09-22"))
end_day = yday(as_date("2023-10-15"))

d <- as_tibble(data) %>%

 select(DATE,TMAX,TMIN) %>%
 mutate(DATE = as_date(DATE),
yday = yday(DATE),
md = sprintf("%02d-%02d", month(DATE), mday(DATE))
) %>%
 filter(yday >= start_day & yday <= end_day) %>%
 mutate(md = as.factor(md))

d_sum <- d %>%
 group_by(md) %>%
 summarize(tmax_mean = mean(TMAX, na.rm=TRUE))

## Here's the filtered data:
dput(d_sum)


structure(list(md = structure(1:25, levels = c("09-21", "09-22",

"09-23", "09-24", "09-25", "09-26", "09-27", "09-28", "09-29",
"09-30", "10-01", "10-02", "10-03", "10-04", "10-05", "10-06",
"10-07", "10-08", "10-09", "10-10", "10-11", "10-12", "10-13",
"10-14", "10-15"), class = "factor"), tmax_mean = c(65,
62.2,
61.3, 63.9, 64.3, 60.1, 62.3, 60.5, 61.9,
61.2, 63.7, 59.5, 59.6, 61.6,
59.4, 58.8, 55.9, 58.125,
58, 55.7, 57, 55.4, 49.8,
48.75, 43.7)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -25L))



ggplot(data = d_sum, aes(x = md)) +
 geom_point(aes(y = tmax_mean, color = "blue")) +
 geom_smooth(aes(y = tmax_mean, color = "blue"))
=
My questions are:
1. Why isn't my geom_smooth plotting? How can I fix it?
2. I don't think I'm handling the month and day combination correctly.
Is there a way to encode month and day (but not year) as a date?
3. (Minor point) Why does my graph of tmax_mean come out red when I
specify "blue"?

Thanks for any advice or guidance you can offer. I really appreciate
the expertise of this group.

-Kevin

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

Hello,

The problem is that the dates are factors, not real dates. And 
geom_smooth is not interpolating along a discrete axis (the x axis).


Paste a fake year with md, coerce to date and plot.
I have simplified the aes() calls and added a date scale in order to 
make the x axis more readable.


Without the formula and method arguments, geom_smooth will print a 
message, they are now made explicit.




suppressPackageStartupMessages({
  library(dplyr)
  library(ggplot2)
})

d_sum %>%
  mutate(md = paste("2023", md, sep = "-"),
 md = as.Date(md)) %>%
  ggplot(aes(x = md, y = tmax_mean)) +
  geom_point(color = "blue") +
  geom_smooth(
formula = y ~ x,
method = loess,
color = "blue"
  ) +
  scale_x_date(date_breaks = "7 days", date_labels = "%m-%d")



Hope this helps,

Rui Barradas

__
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] Help needed with olsrr package

2023-08-24 Thread Ivan Krylov
On Thu, 24 Aug 2023 10:56:00 +0530
Ashim Kapoor  wrote:

> When I  open a terminal, type R and run my code, it runs fine. When I
> start Emacs, start an inferior R process using ESS, the error comes
> back.

Thankfully, in both of these cases you get an interactive R session.

Compare sessionInfo() outputs.

Use traceback(), options(error = recover) and other tricks described in
help(browser) and the free book The R Inferno [*] to find out (1) which
function is trying to eval(); (2) what is being evaluated (what does
predvars contain?), and (3) what do the environments actually contain
(what is `data`? what is `env`? Use ls(env) if it's an environment)

-- 
Best regards,
Ivan

[*] https://www.burns-stat.com/documents/books/the-r-inferno/

__
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] Help needed with olsrr package

2023-08-22 Thread Eric Berger
I copied your data and ran your code.
It worked fine for me.

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;
 LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
LC_ADDRESS=C   LC_TELEPHONE=C
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Asia/Jerusalem
tzcode source: system (glibc)

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] olsrr_0.5.3

loaded via a namespace (and not attached):
 [1] vctrs_0.6.3   cli_3.6.1 rlang_1.1.1   car_3.1-2
  generics_0.1.3data.table_1.14.8 glue_1.6.2
colorspace_2.1-0  gridExtra_2.3
[10] scales_1.2.1  fansi_1.0.4   grid_4.3.1
carData_3.0-5 munsell_0.5.0 tibble_3.2.1  abind_1.4-5
 lifecycle_1.0.3   compiler_4.3.1
[19] goftest_1.2-3 dplyr_1.1.2   Rcpp_1.0.11
pkgconfig_2.0.3   rstudioapi_0.15.0 nortest_1.0-4 R6_2.5.1
 tidyselect_1.2.0  utf8_1.2.3
[28] pillar_1.9.0  magrittr_2.0.3tools_4.3.1
gtable_0.3.3  ggplot2_3.4.2
>

HTH,
Eric


On Tue, Aug 22, 2023 at 7:47 PM Ivan Krylov  wrote:
>
> В Tue, 22 Aug 2023 16:06:22 +0530
> Ashim Kapoor  пишет:
>
> > Error in eval(predvars, data, env) : object 'Var.One' not found
>
> Use traceback() to find out in which function the error was raised.
> This looks like a bug in the olsrr package. Could be due to use of
> string manipulation in order to work with formula terms, could be
> some other assumption violated by I(10*Var2).
>
> Try asking at https://github.com/rsquaredacademy/olsrr/issues.
>
> --
> 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.

__
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] Help needed with olsrr package

2023-08-22 Thread Ivan Krylov
В Tue, 22 Aug 2023 16:06:22 +0530
Ashim Kapoor  пишет:

> Error in eval(predvars, data, env) : object 'Var.One' not found

Use traceback() to find out in which function the error was raised.
This looks like a bug in the olsrr package. Could be due to use of
string manipulation in order to work with formula terms, could be
some other assumption violated by I(10*Var2).

Try asking at https://github.com/rsquaredacademy/olsrr/issues.

-- 
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] Help/documentation on Rgui

2023-07-03 Thread Iago Giné Vázquez
Thank you Petr, great!

Best,
Iago


De: PIKAL Petr
Enviat: Dilluns, 3-juliol 3e000 2023 9:42
Per a: Iago Gin� V�zquez; r-help@r-project.org
Assumpte: RE: Help/documentation on Rgui

Hi

I am not sure about opening Rgui in terminal but for customising Rgui
appearance you can modify Rconsole and Rprofile or Rprofile.site which you
should find in etc folder of your R installation.

https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rconsole.html
https://rdrr.io/r/utils/Rconsole.html
and "Initialization at Start of an R Session" in R help
?Rprofile

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Iago Gin�
> V�zquez
> Sent: Monday, July 3, 2023 8:36 AM
> To: r-help@r-project.org
> Subject: [R] Help/documentation on Rgui
>
> Hi all,
>
> Where can I find a detailed document(ation) on the use of Rgui.exe. The
most
> detailed I found is https://cran.r-project.org/doc/manuals/r-release/R-
> ints.html#GUI-consoles, where there is almost nothing.
>
> Actually I want to know how to open Rgui.exe (let's say, from a terminal
> [mainly in Windows], even better, through the ViM plugin NVim-R) with a
set
> of specific preferences, like a dark background or specific text colour
and size,
> which I see I can modify once it is open.
>
> Thank you for your help.
>
> Iago
>
>
>[[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] Help/documentation on Rgui

2023-07-03 Thread PIKAL Petr
Hi

I am not sure about opening Rgui in terminal but for customising Rgui
appearance you can modify Rconsole and Rprofile or Rprofile.site which you
should find in etc folder of your R installation.

https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rconsole.html
https://rdrr.io/r/utils/Rconsole.html
and "Initialization at Start of an R Session" in R help
?Rprofile

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Iago Giné
> Vázquez
> Sent: Monday, July 3, 2023 8:36 AM
> To: r-help@r-project.org
> Subject: [R] Help/documentation on Rgui
> 
> Hi all,
> 
> Where can I find a detailed document(ation) on the use of Rgui.exe. The
most
> detailed I found is https://cran.r-project.org/doc/manuals/r-release/R-
> ints.html#GUI-consoles, where there is almost nothing.
> 
> Actually I want to know how to open Rgui.exe (let's say, from a terminal
> [mainly in Windows], even better, through the ViM plugin NVim-R) with a
set
> of specific preferences, like a dark background or specific text colour
and size,
> which I see I can modify once it is open.
> 
> Thank you for your help.
> 
> Iago
> 
> 
>   [[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] Help with regex replacements

2023-06-27 Thread Chris Evans via R-help

Magic!

tmp %>%
  as_tibble() %>%
  rename(Text = value) %>%
  mutate(Text = str_replace_all(Text, fixed("."), "")) %>%
  # filter(row_number() < 4) %>%
  mutate(Text2 = gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", 
"", Text))


Which (as you have already shown!) gave me this:

# A tibble: 7 × 2
  Text Text2
   
1 "Я досяг того, чого хотів"  "Я досяг того, чого 
хотів"
2 "Мені вдалося зробити бажане"   "Мені вдалося зробити 
бажане"
3 "Я досяг (досягла) того, чого хотів (хотіла)"   "Я досяг того, чого 
хотів "
4 "Я досяг(-ла) речей, яких хотілося досягти" "Я досяг речей, яких 
хотілося досягти"
5 "Я досяг/ла того, чого хотів/ла"    "Я досяг того, чого 
хотів"
6 "Я досяг\\досягла того, чого прагнув\\прагнула" "Я досяг того, чого 
прагнув"
7 "Я досягнув(ла) того, чого хотів(ла)"   "Я досягнув того, чого 
хотів"


perfect and I will spend some time tomorrow unpacking that regex and 
trying to drive the learning points into my thick skull!


Deeply indebted, as so often here though generally only when I'm reading 
others questions and the answers!


Chris

On 27/06/2023 20:48, Bert Gunter wrote:
OK, so you want parentheses, not "brackets" + I think I misinterpreted 
your specification, which I think is actually incomplete. Based on 
what I think you meant, how does this work:


gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text)
[1] "Я досяг того, чого хотів"              "Мені вдалося\nзробити 
бажане"
[3] "Я досяг  того, чого хотів "            "Я\nдосяг речей, яких 
хотілося досягти"

[5] "Я досяг того, чого\nхотів"             "Я досяг того, чого прагнув"
[7] "Я\nдосягнув того, чого хотів"

If you want it without the \n's, cat the above to get:
cat(gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text))

Я досяг того, чого хотів Мені вдалося
зробити бажане Я досяг  того, чого хотів  Я
досяг речей, яких хотілося досягти Я досяг того, чого
хотів Я досяг того, чого прагнув Я
досягнув того, чого хотів

Cheers,
Bert

On Tue, Jun 27, 2023 at 11:09 AM Bert Gunter  
wrote:


Does this do it for you (or get you closer):

 gsub("\\[.*\\]|[] |/ ","",tmp$Text)
[1] "Я досяг того, чого хотів"
[2] "Мені вдалося\nзробити бажане"
[3] "Я досяг (досягла) того, чого хотів (хотіла)"
[4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
[5] "Я досяг/ла того, чого\nхотів/ла"
[6] "Я досяг\\досягла того, чого прагнув\\прагнула"
[7] "Я\nдосягнув(ла) того, чого хотів(ла)"

On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help
 wrote:

I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of
lines of
Ukrainian translations of some English. They contain things
like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я
досяг
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких
хотілося
досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла
того, чого
прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"

Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів",
"Мені вдалося
зробити бажане", "Я досяг (досягла) того, чого хотів
(хотіла)", "Я
досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L),
class =
c("tbl_df", "tbl", "data.frame" )) Those show four different ways
translators have handled gendered words: 1) Ignore them and (I'm
guessing) only give the masculine 2) Give the feminine form of
the word
(or just the feminine suffix) in brackets 3) Give the feminine
form/suffix prefixed by a forward slash 4) Give the feminine
form/suffix
prefixed by backslash (here a double backslash) I would like
just to
drop all these feminine gendered options. (Don't worry,
they'll get back
in later.) So I would like to replace 1) anything between
brackets with
nothing! 2) anything between a forward slash and the next
space with
nothing 3) anything between a backslash and the next space
with nothing
but preserving the rest of the text. I have been trying to
achieve this
using str_replace_all() but I am failing utterly. Here's a
silly little
example of my failures. This was just trying to get the text I
wanted to
replace (as I was trying to simplify the issues for my tired
wetware): >
tmp %>%+ as_tibble() %>% + rename(Text = value) %>% +
mutate(Text =
str_replace_all(Text, fixed("."), "")) %>% +
filter(row_number() < 4)
%>% + mutate(Text2 = str_replace(Text, "\\(.*\\)"

Re: [R] Help with regex replacements

2023-06-27 Thread Bert Gunter
OK, so you want parentheses, not "brackets" + I think I misinterpreted your
specification, which I think is actually incomplete. Based on what I think
you meant, how does this work:

gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text)
[1] "Я досяг того, чого хотів"  "Мені вдалося\nзробити бажане"

[3] "Я досяг  того, чого хотів ""Я\nдосяг речей, яких хотілося
досягти"
[5] "Я досяг того, чого\nхотів" "Я досяг того, чого прагнув"

[7] "Я\nдосягнув того, чого хотів"

If you want it without the \n's, cat the above to get:
cat(gsub("((|/)[[:alnum:]]+)|(\\([[:alnum:]-]+\\))", "",tmp$Text))

Я досяг того, чого хотів Мені вдалося
зробити бажане Я досяг  того, чого хотів  Я
досяг речей, яких хотілося досягти Я досяг того, чого
хотів Я досяг того, чого прагнув Я
досягнув того, чого хотів

Cheers,
Bert

On Tue, Jun 27, 2023 at 11:09 AM Bert Gunter  wrote:

> Does this do it for you (or get you closer):
>
>  gsub("\\[.*\\]|[] |/ ","",tmp$Text)
> [1] "Я досяг того, чого хотів"
> [2] "Мені вдалося\nзробити бажане"
> [3] "Я досяг (досягла) того, чого хотів (хотіла)"
> [4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
> [5] "Я досяг/ла того, чого\nхотів/ла"
> [6] "Я досяг\\досягла того, чого прагнув\\прагнула"
> [7] "Я\nдосягнув(ла) того, чого хотів(ла)"
>
> On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help <
> r-help@r-project.org> wrote:
>
>> I am sure this is easy for people who are good at regexps but I'm
>> failing with it.  The situation is that I have hundreds of lines of
>> Ukrainian translations of some English. They contain things like this:
>>
>> 1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
>> (досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
>> досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого
>> прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"
>>
>> Using dput():
>>
>> tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося
>> зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я
>> досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
>> хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
>> досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class =
>> c("tbl_df", "tbl", "data.frame" )) Those show four different ways
>> translators have handled gendered words: 1) Ignore them and (I'm
>> guessing) only give the masculine 2) Give the feminine form of the word
>> (or just the feminine suffix) in brackets 3) Give the feminine
>> form/suffix prefixed by a forward slash 4) Give the feminine form/suffix
>> prefixed by backslash (here a double backslash) I would like just to
>> drop all these feminine gendered options. (Don't worry, they'll get back
>> in later.) So I would like to replace 1) anything between brackets with
>> nothing! 2) anything between a forward slash and the next space with
>> nothing 3) anything between a backslash and the next space with nothing
>> but preserving the rest of the text. I have been trying to achieve this
>> using str_replace_all() but I am failing utterly. Here's a silly little
>> example of my failures. This was just trying to get the text I wanted to
>> replace (as I was trying to simplify the issues for my tired wetware): >
>> tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text =
>> str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4)
>> %>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin
>> `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
>> "\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to
>> access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run
>> `rlang::last_trace()` to see where the error occurred. I have tried
>> gurgling around the internet but am striking out so throwing myself on
>> the list. Apologies if this is trivial but I'd hate to have to clean
>> these hundreds of lines by hand though it's starting to look as if I'd
>> achieve that faster by hand than I will by banging my ignorance of R
>> regexp syntax on the problem. TIA, Chris
>>
>> --
>> Chris Evans (he/him)
>> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
>> University of Roehampton, London, UK.
>> Work web site: https://www.psyctc.org/psyctc/
>> CORE site: http://www.coresystemtrust.org.uk/
>> Personal site: https://www.psyctc.org/pelerinage2016/
>>
>> __
>> 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 

Re: [R] Help with regex replacements

2023-06-27 Thread Bert Gunter
Does this do it for you (or get you closer):

 gsub("\\[.*\\]|[] |/ ","",tmp$Text)
[1] "Я досяг того, чого хотів"
[2] "Мені вдалося\nзробити бажане"
[3] "Я досяг (досягла) того, чого хотів (хотіла)"
[4] "Я\nдосяг(-ла) речей, яких хотілося досягти"
[5] "Я досяг/ла того, чого\nхотів/ла"
[6] "Я досяг\\досягла того, чого прагнув\\прагнула"
[7] "Я\nдосягнув(ла) того, чого хотів(ла)"

On Tue, Jun 27, 2023 at 10:16 AM Chris Evans via R-help <
r-help@r-project.org> wrote:

> I am sure this is easy for people who are good at regexps but I'm
> failing with it.  The situation is that I have hundreds of lines of
> Ukrainian translations of some English. They contain things like this:
>
> 1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
> (досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
> досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого
> прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"
>
> Using dput():
>
> tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося
> зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я
> досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого
> хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я
> досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class =
> c("tbl_df", "tbl", "data.frame" )) Those show four different ways
> translators have handled gendered words: 1) Ignore them and (I'm
> guessing) only give the masculine 2) Give the feminine form of the word
> (or just the feminine suffix) in brackets 3) Give the feminine
> form/suffix prefixed by a forward slash 4) Give the feminine form/suffix
> prefixed by backslash (here a double backslash) I would like just to
> drop all these feminine gendered options. (Don't worry, they'll get back
> in later.) So I would like to replace 1) anything between brackets with
> nothing! 2) anything between a forward slash and the next space with
> nothing 3) anything between a backslash and the next space with nothing
> but preserving the rest of the text. I have been trying to achieve this
> using str_replace_all() but I am failing utterly. Here's a silly little
> example of my failures. This was just trying to get the text I wanted to
> replace (as I was trying to simplify the issues for my tired wetware): >
> tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text =
> str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4)
> %>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin
> `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
> "\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to
> access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run
> `rlang::last_trace()` to see where the error occurred. I have tried
> gurgling around the internet but am striking out so throwing myself on
> the list. Apologies if this is trivial but I'd hate to have to clean
> these hundreds of lines by hand though it's starting to look as if I'd
> achieve that faster by hand than I will by banging my ignorance of R
> regexp syntax on the problem. TIA, Chris
>
> --
> Chris Evans (he/him)
> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
> University of Roehampton, London, UK.
> Work web site: https://www.psyctc.org/psyctc/
> CORE site: http://www.coresystemtrust.org.uk/
> Personal site: https://www.psyctc.org/pelerinage2016/
>
> __
> 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] Help with regex replacements

2023-06-27 Thread Chris Evans via R-help

Thanks Avi (I am a keen follower or your, and other stalwart helpers here).

On 27/06/2023 18:27, avi.e.gr...@gmail.com wrote:

Chris,

Consider breaking up your task into multiple passes.


Sorry, I could have explained more of what I had tried.  I never know 
how long to make things here.


I had been doing that. My plan was to pick them off, one by one but I 
think I am banging my head on a fundamental incomprehension on my part.



And do them in whatever order preserves what you need.

Agree.

First, are you talking about brackets as in square brackets, or as in your 
example, parentheses?

Sorry, always get that wrong, parentheses. Mea culpa.

If you are sure you have no nested brackets, your requirement seems to be that 
anything matching [ stuff ] be replaced with nothing. Or if using parentheses, 
something similar.
> 99% sure there are no nested parentheses.  However, there are lines 
with none, one or sometimes (as in the little reprex) more than one set 
of parentheses.

Your issue here is both sets of symbols are special so you must escape them so 
they are seen as part of the pattern and not the instructions.
So, sorry to be stupid but I thought I was doing that using "\(.*\)"  
Could you reply showing me the correct escaping and the correct 
replacing?  I was using str_replace_all() but happy to use gsub() if 
that's easier/safer/better.

The idea would be to pass through the text once and match all instances on a 
line and then replace with nothing or whatever is needed.

Nothing.

  But there is no guarantee some of your constructs will be on the same line 
completely so be wary.


Totally agree.

I also see that my Emailer (Thunderbird) despite my exhorting it not to, 
mangled the Email.  Have tried to fix that.  The mess below should have 
said:


I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of lines of
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"
2"Мені вдалося зробити бажане"
3"Я досяг (досягла) того, чого хотів (хотіла)"
4"Я досяг(-ла) речей, яких хотілося досягти"
5"Я досяг/ла того, чого хотів/ла"
6"Я досяг\\досягла того, чогопрагнув\\прагнула."7"Я досягнув(ла) того, 
чого хотів(ла)"


Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів",
"Мені вдалося зробити бажане",
"Я досяг (досягла) того, чого хотів (хотіла)",
"Я досяг(-ла) речей, яких хотілося досягти",
"Я досяг/ла того, чого хотів/ла",
"Я досяг\\досягла того, чого прагнув\\прагнула",
"Я досягнув(ла) того, чого хотів(ла)" )),
row.names = c(NA, -7L), class = c("tbl_df", "tbl", "data.frame" ))

Those show four different ways translators have handled gendered words:

1) Ignore them and (I'm guessing) only give the masculine
2) Give the feminine form of the word (or just the feminine suffix) in 
brackets

3) Give the feminine form/suffix prefixed by a forward slash
4) Give the feminine form/suffix prefixed by backslash (here a double 
backslash)


I would like just to drop all these feminine gendered options. (Don't 
worry,

they'll get back in later.)

So I would like to replace
1) anything between brackets with nothing!
2) anything between a forward slash and the next space with nothing
3) anything between a backslash and the next space with nothing
but preserving the rest of the text. I have been trying to achieve this
using str_replace_all() but I am failing utterly.

Here's a silly little example of my failures.
This was just trying to get the text I wanted to
replace (as I was trying to simplify the issues for my tired wetware):

> tmp %>%
+ as_tibble() %>%
+ rename(Text = value) %>%
+ mutate(Text = str_replace_all(Text, fixed("."), "")) %>%
+ filter(row_number() < 4) %>%
+ mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1"))

Error in `mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)",
"\\1")`.

Caused by error in `stri_replace_first_regex()`:!
Trying to access the index that is out of bounds. 
(U_INDEX_OUTOFBOUNDS_ERROR)

Run `rlang::last_trace()` to see where the error occurred.

I have tried gurgling around the internet but am striking out so 
throwing myself on

the list. Apologies if this is trivial but I'd hate to have to clean
these hundreds of lines by hand though it's starting to look as if I'd
achieve that faster by hand than I will by banging my ignorance of R
regexp syntax on the problem. TIA, Chris




  


-Original Message-
From: R-help  On Behalf Of Chris Evans via R-help
Sent: Tuesday, June 27, 2023 1:16 PM
To: r-help@r-project.org
Subject: [R] Help with regex replacements

I am sure this is easy for people who are good at regexps but I'm
failing with it.  The situation is that I have hundreds of lines of
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося
досягти"5"Я досяг/ла того,

Re: [R] Help with regex replacements

2023-06-27 Thread avi.e.gross
Chris,

Consider breaking up your task into multiple passes.

And do them in whatever order preserves what you need.

First, are you talking about brackets as in square brackets, or as in your 
example, parentheses?

If you are sure you have no nested brackets, your requirement seems to be that 
anything matching [ stuff ] be replaced with nothing. Or if using parentheses, 
something similar.

Your issue here is both sets of symbols are special so you must escape them so 
they are seen as part of the pattern and not the instructions.

The idea would be to pass through the text once and match all instances on a 
line and then replace with nothing or whatever is needed. But there is no 
guarantee some of your constructs will be on the same line completely so be 
wary.

 

-Original Message-
From: R-help  On Behalf Of Chris Evans via R-help
Sent: Tuesday, June 27, 2023 1:16 PM
To: r-help@r-project.org
Subject: [R] Help with regex replacements

I am sure this is easy for people who are good at regexps but I'm 
failing with it.  The situation is that I have hundreds of lines of 
Ukrainian translations of some English. They contain things like this:

1"Я досяг того, чого хотів"2"Мені вдалося зробити бажане"3"Я досяг 
(досягла) того, чого хотів (хотіла)"4"Я досяг(-ла) речей, яких хотілося 
досягти"5"Я досяг/ла того, чого хотів/ла"6"Я досяг\\досягла того, чого 
прагнув\\прагнула."7"Я досягнув(ла) того, чого хотів(ла)"

Using dput():

tmp <- structure(list(Text = c("Я досяг того, чого хотів", "Мені вдалося 
зробити бажане", "Я досяг (досягла) того, чого хотів (хотіла)", "Я 
досяг(-ла) речей, яких хотілося досягти", "Я досяг/ла того, чого 
хотів/ла", "Я досяг\\досягла того, чого прагнув\\прагнула", "Я 
досягнув(ла) того, чого хотів(ла)" )), row.names = c(NA, -7L), class = 
c("tbl_df", "tbl", "data.frame" )) Those show four different ways 
translators have handled gendered words: 1) Ignore them and (I'm 
guessing) only give the masculine 2) Give the feminine form of the word 
(or just the feminine suffix) in brackets 3) Give the feminine 
form/suffix prefixed by a forward slash 4) Give the feminine form/suffix 
prefixed by backslash (here a double backslash) I would like just to 
drop all these feminine gendered options. (Don't worry, they'll get back 
in later.) So I would like to replace 1) anything between brackets with 
nothing! 2) anything between a forward slash and the next space with 
nothing 3) anything between a backslash and the next space with nothing 
but preserving the rest of the text. I have been trying to achieve this 
using str_replace_all() but I am failing utterly. Here's a silly little 
example of my failures. This was just trying to get the text I wanted to 
replace (as I was trying to simplify the issues for my tired wetware): > 
tmp %>%+ as_tibble() %>% + rename(Text = value) %>% + mutate(Text = 
str_replace_all(Text, fixed("."), "")) %>% + filter(row_number() < 4) 
%>% + mutate(Text2 = str_replace(Text, "\\(.*\\)", "\\1")) Errorin 
`mutate()`:ℹIn argument: `Text2 = str_replace(Text, "\\(.*\\)", 
"\\1")`.Caused by error in `stri_replace_first_regex()`:!Trying to 
access the index that is out of bounds. (U_INDEX_OUTOFBOUNDS_ERROR) Run 
`rlang::last_trace()` to see where the error occurred. I have tried 
gurgling around the internet but am striking out so throwing myself on 
the list. Apologies if this is trivial but I'd hate to have to clean 
these hundreds of lines by hand though it's starting to look as if I'd 
achieve that faster by hand than I will by banging my ignorance of R 
regexp syntax on the problem. TIA, Chris

-- 
Chris Evans (he/him)
Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, 
University of Roehampton, London, UK.
Work web site: https://www.psyctc.org/psyctc/
CORE site: http://www.coresystemtrust.org.uk/
Personal site: https://www.psyctc.org/pelerinage2016/

__
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] Help sourcing datasets (.csv)

2023-06-02 Thread Ebert,Timothy Aaron
Another suggestion:
 The statistics does not care where the numbers come from. The values 1, 2, 
3 have a mean of 2 no matter if these are weights of a bird, plant heights, or 
concrete tensile strength. Your interpretation might change, but the mean is 
still 2.

Try synthetic data.
X<-rnorm(1000, mean=4, sd=2)
Y<-14+12*X
cor(X,Y)

That is too simple, but it is the start.
Y<- rnorm(1000, mean=14, sd=2) + 12*X
cor(X,Y)

look at the result in something like ggplot2
Dataf <- data.frame(X,Y)
ggplot(Dataf, aes(X, Y)) + geom.point() + stat_smooth(method=lm, se=FALSE)


This approach has a few advantages:
1) I know that X and Y are samples from the Gaussian (Normal) distribution.
2) I know that the data are homoscedastic.
3) I can change 1 and 2 in whatever way I want. Possibly useful if you want to 
understand how violations in model assumptions influence outcomes.
4) I can look closely at the influence of sample size when assumptions are met 
and when they are not.

Note that ANOVA and regression do not assume that the independent or dependent 
variables are normally distributed. The assumption of Normality is for the 
error term in the model. However, if both dependent and independent variables 
are normally distributed then it is likely that the error term will also be 
normally distributed.

What should I get here?
Y<- rnorm(1000, mean=14, sd=2) + X*rnorm(1000, mean=12, sd=27)



Tim
-Original Message-
From: R-help  On Behalf Of Uwe Ligges
Sent: Friday, June 2, 2023 5:18 AM
To: james carrigan ; r-help@r-project.org
Subject: Re: [R] Help sourcing datasets (.csv)

[External Email]

See ?data


On 28.05.2023 10:53, james carrigan wrote:
> Dear Sir or Madam
> I'm trying to compile a collection of datasets that require use of the 
> following hypothesis tests.
> Are there datasets within the R library that I can get access to?
> Kind regards
> James Carrigan
>
> Hypothesis Testing
> t.test(X,Y)
> - performs a two sample t-test between X and Y
> t.test(X,Y,paired=TRUE)
> - performs a paired t-test between X and Y prop.test(x = c(a, b), n =
> c(n1, n2)) - performs a 2-sample test for equality of proportions with
> continuity correction
>
> Sent from my iPad Sent from my iPhone
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat/
> .ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu
> %7C5f3292c3315b446b8b9008db634a37cb%7C0d4da0f84a314d76ace60a62331e1b84
> %7C0%7C0%7C638212942641271785%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sda
> ta=s5NqLzxYTlnA1BHldzka%2F2i%2FoefvsLmU%2FDuLJav5mMc%3D&reserved=0
> PLEASE do read the posting guide
> http://www.r/
> -project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C5f
> 3292c3315b446b8b9008db634a37cb%7C0d4da0f84a314d76ace60a62331e1b84%7C0%
> 7C0%7C638212942641271785%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
> CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xG
> MQDNZksGydmnYDLAFjZ%2BEZp4ne%2Bf5JK%2BO9qrH7zeU%3D&reserved=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.

__
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] Help sourcing datasets (.csv)

2023-06-02 Thread Uwe Ligges

See ?data


On 28.05.2023 10:53, james carrigan wrote:

Dear Sir or Madam
I’m trying to compile a collection of datasets that require use of the 
following hypothesis tests.
Are there datasets within the R library that I can get access to?
Kind regards
James Carrigan

Hypothesis Testing
t.test(X,Y)
— performs a two sample t-test between X and Y
t.test(X,Y,paired=TRUE)
— performs a paired t-test between X and Y
prop.test(x = c(a, b), n = c(n1, n2))
— performs a 2-sample test for equality of proportions with continuity 
correction

Sent from my iPad Sent from my iPhone
__
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] Help with function and survey data

2022-10-31 Thread Edjabou Vincent
Dear Bert

Thank you for your suggestion. I have tried it but it did not work.


For record, I am reposting the post with the plain text.
library(tidyverse)
library(plyr)
library(survey)

dat <- structure(list(
   r3a_1 = structure(c(3L, 2L, 3L, 3L, 3L, 3L, 3L,3L, 3L, 3L, 3L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_2 = structure(c(3L, 3L,3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_3 = structure(c(3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L),
.Label = c("Don't Know","No", "Yes"), class = "factor"),
  r3a_4 = structure(c(3L,2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L, 2L, 3L,
2L, 3L, 2L, 2L,3L, 3L, 3L, 1L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_5 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 2L,2L, 3L,
2L, 3L, 3L, 2L, 3L, 2L, 3L, 1L),
.Label = c("Don't Know","No", "Yes"), class = "factor"),
  r3a_6 = structure(c(3L,3L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L,
2L, 2L, 2L, 3L,2L, 3L, 3L, 3L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_7 = structure(c(1L, 2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L,3L, 3L,
2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_8 = structure(c(3L,2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L,
2L, 3L, 3L, 2L,  2L, 2L, 3L, 3L),
.Label = c("Don't Know", "No", "Yes"), class = "factor"),
  r3a_9 = structure(c(1L, 3L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 3L,3L, 3L,
2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L),
.Label = c("Don't Know","No", "Yes"), class = "factor"),
  weight = c(0.34, 0.34, 0.34,0.34, 0.34, 0.34, 0.34, 0.34, 0.34,
0.34, 0.34, 0.34, 0.43, 0.43, 0.43, 0.34, 0.34, 0.34, 0.34, 0.34),
  seg_2 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 1L,1L, 1L, 1L, 1L),
.Label = c("1", "2"), class = "factor"),
  seg_3 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L,
2L, 1L, 1L, 1L,1L, 2L, 2L, 2L),
.Label = c("1", "2"), class = "factor"),
  seg_4 = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L,
2L, 1L, 1L, 1L,1L, 1L, 1L, 1L),
.Label = c("1", "2"), class = "factor")),
  .Names = c("r3a_1", "r3a_2", "r3a_3", "r3a_4", "r3a_5", "r3a_6",
"r3a_7", "r3a_8", "r3a_9", "weight", "seg_2","seg_3","seg_4"),
row.names = c(NA, 20L), class = "data.frame")

 dat_weight <- svydesign(ids = ~1, weights = ~weight, data = dat)

my_funca <- function(mk,y){
   my_re <-   ldply( mk, function(x)
  svytable(bquote(~ y + .(as.name(x))), dat_weight) %>%
as_tibble() %>%
dplyr::group_by({{y}}) %>%
transmute(!!(as.name(x)), Procent = round(n/sum(n,na.rm = T)*100,2)) %>%
pivot_wider(names_from = (as.name(x)),
values_from = Procent)
   )
   return(my_re)
}

my_funca(mk =names(dat)[1:9], y = dat$seg_2)
Regards,

Vincent Edjabou
Mobile: +45 31 95 99 33
linkedin.com/vincent

Orcid: -0003-2849-6151

Regards,

Vincent Edjabou
Mobile: +45 31 95 99 33
linkedin.com/vincent

Orcid: -0003-2849-6151




On Mon, Oct 31, 2022 at 5:21 PM Bert Gunter  wrote:
>
> 1. This is a plain text list. Set your email to post in plain text, not html, 
> which often gets mangled (see below).
>
> 2. I did not run your example, but try:
> my_funca(mk =names(dat)[1:9], y = dat$seg_2)
>
> ## seg_2 is a component of dat and is not in the environment of the call. I 
> did not see any data argument that would tell it to look elsewhere, but I am 
> not familiar with tidy_whatever's nonstandard evaluation conventions.
>
> -- Bert
>
> On Mon, Oct 31, 2022 at 8:39 AM Edjabou Vincent  wrote:
>>
>> Dear R-Help
>> I am working with complex survey data using the survey package.
>> I would like to create a function for the generate multi crosstable. The
>> problem is that I am getting error with the following message:
>> "Error in eval(predvars, data, env) : object 'y' not found"
>>
>> Here is the example:
>> library(tidyverse)
>> library(plyr)
>> library(survey)
>>
>> dat <- structure(list(
>>r3a_1 = structure(c(3L, 2L, 3L, 3L, 3L, 3L, 3L,3L, 3L, 3L, 3L, 2L, 2L,
>> 3L, 3L, 3L, 3L, 3L, 3L, 3L),
>> .Label = c("Don't Know", "No", "Yes"), class = "factor"),
>>   r3a_2 = structure(c(3L, 3L,3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
>> 3L, 3L, 3L, 3L, 3L, 3L, 3L),
>> .Label = c("Don't Know", "No", "Yes"), class =
>> "factor"),
>>   r3a_3 = structure(c(3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L,
>> 2L, 2L, 2L, 2L, 2L, 3L, 3L),
>> .Label = c("Don't Know","No", "Yes"), class =
>> "factor"),
>>   r3a_4 = structure(c(3L,2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L, 2L, 3L, 2L,
>> 3L, 2L, 2L,3L, 3L, 3L, 1L),
>> .Label = c("Don't Kn

Re: [R] Help with function and survey data

2022-10-31 Thread Bert Gunter
1. This is a plain text list. Set your email to post in plain text, not
html, which often gets mangled (see below).

2. I did not run your example, but try:
my_funca(mk =names(dat)[1:9], y = dat$seg_2)

## seg_2 is a component of dat and is not in the environment of the call. I
did not see any data argument that would tell it to look elsewhere, but I
am not familiar with tidy_whatever's nonstandard evaluation conventions.

-- Bert

On Mon, Oct 31, 2022 at 8:39 AM Edjabou Vincent  wrote:

> Dear R-Help
> I am working with complex survey data using the survey package.
> I would like to create a function for the generate multi crosstable. The
> problem is that I am getting error with the following message:
> "Error in eval(predvars, data, env) : object 'y' not found"
>
> Here is the example:
> library(tidyverse)
> library(plyr)
> library(survey)
>
> dat <- structure(list(
>r3a_1 = structure(c(3L, 2L, 3L, 3L, 3L, 3L, 3L,3L, 3L, 3L, 3L, 2L, 2L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L),
> .Label = c("Don't Know", "No", "Yes"), class = "factor"),
>   r3a_2 = structure(c(3L, 3L,3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L),
> .Label = c("Don't Know", "No", "Yes"), class =
> "factor"),
>   r3a_3 = structure(c(3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L, 2L, 2L, 3L, 3L),
> .Label = c("Don't Know","No", "Yes"), class =
> "factor"),
>   r3a_4 = structure(c(3L,2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L, 2L, 3L, 2L,
> 3L, 2L, 2L,3L, 3L, 3L, 1L),
> .Label = c("Don't Know", "No", "Yes"), class =
> "factor"),
>   r3a_5 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 2L,2L, 3L, 2L,
> 3L, 3L, 2L, 3L, 2L, 3L, 1L),
> .Label = c("Don't Know","No", "Yes"), class =
> "factor"),
>   r3a_6 = structure(c(3L,3L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L,
> 2L, 2L, 3L,2L, 3L, 3L, 3L),
> .Label = c("Don't Know", "No", "Yes"), class =
> "factor"),
>   r3a_7 = structure(c(1L, 2L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 2L,3L, 3L, 2L,
> 2L, 2L, 2L, 2L, 3L, 3L, 3L),
> .Label = c("Don't Know", "No", "Yes"), class =
> "factor"),
>   r3a_8 = structure(c(3L,2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 2L,
> 3L, 3L, 2L,  2L, 2L, 3L, 3L),
> .Label = c("Don't Know", "No", "Yes"), class =
> "factor"),
>   r3a_9 = structure(c(1L, 3L, 2L, 2L, 3L, 2L, 2L, 3L, 3L, 3L,3L, 3L, 2L,
> 2L, 2L, 3L, 2L, 2L, 3L, 3L),
> .Label = c("Don't Know","No", "Yes"), class =
> "factor"),
>   weight = c(0.34, 0.34, 0.34,0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34,
> 0.34, 0.34, 0.43, 0.43, 0.43, 0.34, 0.34, 0.34, 0.34, 0.34),
>   seg_2 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L,
> 1L, 1L, 1L,1L, 1L, 1L, 1L),
> .Label = c("1", "2"), class = "factor"),
>   seg_3 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L,
> 1L, 1L, 1L,1L, 2L, 2L, 2L),
> .Label = c("1", "2"), class = "factor"),
>   seg_4 = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L,
> 1L, 1L, 1L,1L, 1L, 1L, 1L),
> .Label = c("1", "2"), class = "factor")),
>   .Names = c("r3a_1", "r3a_2", "r3a_3", "r3a_4", "r3a_5", "r3a_6", "r3a_7",
> "r3a_8", "r3a_9", "weight", "seg_2","seg_3","seg_4"), row.names = c(NA,
> 20L), class = "data.frame")
>
>  dat_weight <- svydesign(ids = ~1, weights = ~weight, data = dat)
>
> my_funca <- function(mk,y){
>my_re <-   ldply( mk, function(x)
>   svytable(bquote(~ y + .(as.name(x))), dat_weight) %>%
> as_tibble() %>%
> dplyr::group_by({{y}}) %>%
> transmute(!!(as.name(x)), Procent = round(n/sum(n,na.rm =
> T)*100,2)) %>%
> pivot_wider(names_from = (as.name(x)),
> values_from = Procent)
>)
>return(my_re)
> }
>
> my_funca(mk =names(dat)[1:9], y = seg_2)
>
>
> I will appreciate any help you will provide.
>
>
>
>
> Regards,
>
> Vincent Edjabou
> Mobile: +45 31 95 99 33
> linkedin.com/vincent
> 
>
> Orcid: -0003-2849-6151
>
> [[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] Help installing devtools plus other packages in R terminal

2022-10-06 Thread Ivan Krylov
On Wed, 5 Oct 2022 20:02:02 +
"Rhon Calderon, Eric"  wrote:

> automake found. Running autoupdate and autogen.sh.
<...>
> + libtoolize --copy
> autogen.sh: line 43: libtoolize: command not found

Since you have automake installed, you also need libtool
 installed in order to compile
this particular package from source. Depending on the HPC, there may be
a particular command to "activate" the installation already made by the
HPC administrator.

I guess you could also report this as a bug in devtools: they check for
automake but not libtool. If you can temporarily chmod -x automake, the
installation should succeed too, because then the package will not try
to regenerate its build system. I don't see why they even try to do
that, but maybe that's a workaround for some kind of compatibility
problem.

> CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh
> '/tmp/RtmpMjF6Ns/R.INSTALL4a3cb2204b0da/httpuv/src/libuv/missing'
> aclocal-1.16 -I m4
> /tmp/RtmpMjF6Ns/R.INSTALL4a3cb2204b0da/httpuv/src/libuv/missing: line
> 81: aclocal-1.16: command not found

Make sure your automake installation is working. I think the error is
caused by the previous error and may go away once you install libtool,
but I may be mistaken regarding that.

Do Bioconductor packages really depend on devtools? What do their
errors look like?

-- 
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] Help installing devtools plus other packages in R terminal

2022-10-06 Thread Andrew Simmons
To install the packages from source, you need to install make, gcc, and g++:
⁠sudo apt install make⁠
⁠sudo apt install gcc⁠
⁠sudo apt install g++

then try installing them again

On Thu, Oct 6, 2022 at 2:54 AM Rhon Calderon, Eric
 wrote:
>
> Hi,
>
> I am using R in my HPC terminal. After many tries, I was able to install and 
> exec successfully R on my HPC but now I cannot install devtools and other 
> dependencies. I need some of theses packages to install some others from 
> bioconductor. I was wondering if anybody has a solution.
>
> The script I got from my R session is (the highlighted part is the errors I 
> keep getting):
>
> > install.packages('devtools')
> Installing package into ‘/home/ericrhon/R/x86_64-pc-linux-gnu-library/4.2’
> (as ‘lib’ is unspecified)
> --- Please select a CRAN mirror for use in this session ---
> Secure CRAN mirrors
>
>  1: 0-Cloud [https]
>  2: Australia (Canberra) [https]
>  3: Australia (Melbourne 1) [https]
>  4: Australia (Melbourne 2) [https]
>  5: Australia (Perth) [https]
>  6: Austria [https]
>  7: Belgium (Brussels) [https]
>  8: Brazil (PR) [https]
>  9: Brazil (RJ) [https]
> 10: Brazil (SP 1) [https]
> 11: Brazil (SP 2) [https]
> 12: Bulgaria [https]
> 13: Canada (MB) [https]
> 14: Canada (ON 3) [https]
> 15: Chile (Santiago) [https]
> 16: China (Beijing 2) [https]
> 17: China (Beijing 3) [https]
> 18: China (Hefei) [https]
> 19: China (Hong Kong) [https]
> 20: China (Guangzhou) [https]
> 21: China (Lanzhou) [https]
> 22: China (Nanjing) [https]
> 23: China (Shanghai 2) [https]
> 24: China (Shenzhen) [https]
> 25: Colombia (Cali) [https]
> 26: Costa Rica [https]
> 27: Cyprus [https]
> 28: Czech Republic [https]
> 29: Denmark [https]
> 30: East Asia [https]
> 31: Ecuador (Cuenca) [https]
> 32: Ecuador (Quito) [https]
> 33: France (Lyon 1) [https]
> 34: France (Lyon 2) [https]
> 35: France (Marseille) [https]
> 36: France (Paris 1) [https]
> 37: Germany (Erlangen) [https]
> 38: Germany (Leipzig) [https]
> 39: Germany (Göttingen) [https]
> 40: Germany (Münster) [https]
> 41: Germany (Regensburg) [https]
> 42: Greece [https]
> 43: Hungary [https]
> 44: Iceland [https]
> 45: India [https]
> 46: Indonesia (Banda Aceh) [https]
> 47: Iran (Mashhad) [https]
> 48: Italy (Milano) [https]
> 49: Italy (Padua) [https]
> 50: Japan (Tokyo) [https]
> 51: Japan (Yonezawa) [https]
> 52: Korea (Gyeongsan-si) [https]
> 53: Korea (Ulsan) [https]
> 54: Malaysia [https]
> 55: Mexico (Mexico City) [https]
> 56: Mexico (Texcoco) [https]
> 57: Morocco [https]
> 58: Netherlands (Dronten) [https]
> 59: New Zealand [https]
> 60: Norway [https]
> 61: South Africa (Johannesburg) [https]
> 62: Spain (A Coruña) [https]
> 63: Spain (Madrid) [https]
> 64: Sweden (Borås) [https]
> 65: Sweden (Umeå) [https]
> 66: Switzerland [https]
> 67: Taiwan (Taipei) [https]
> 68: Turkey (Denizli) [https]
> 69: Turkey (Istanbul) [https]
> 70: Turkey (Mersin) [https]
> 71: UK (Bristol) [https]
> 72: UK (London 1) [https]
> 73: USA (IA) [https]
> 74: USA (MI) [https]
> 75: USA (MO) [https]
> 76: USA (OH) [https]
> 77: USA (OR) [https]
> 78: USA (TN) [https]
> 79: USA (TX 1) [https]
> 80: Uruguay [https]
> 81: (other mirrors)
>
> Selection: 1
> also installing the dependencies ‘httpuv’, ‘shiny’, ‘miniUI’
>
> trying URL 'https://cloud.r-project.org/src/contrib/httpuv_1.6.6.tar.gz'
> Content type 'application/x-gzip' length 1875264 bytes (1.8 MB)
> ==
> downloaded 1.8 MB
>
> trying URL 'https://cloud.r-project.org/src/contrib/shiny_1.7.2.tar.gz'
> Content type 'application/x-gzip' length 2982507 bytes (2.8 MB)
> ==
> downloaded 2.8 MB
>
> trying URL 'https://cloud.r-project.org/src/contrib/miniUI_0.1.1.1.tar.gz'
> Content type 'application/x-gzip' length 97958 bytes (95 KB)
> ==
> downloaded 95 KB
>
> trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.4.tar.gz'
> Content type 'application/x-gzip' length 374492 bytes (365 KB)
> ==
> downloaded 365 KB
>
> * installing *source* package ‘httpuv’ ...
> ** package ‘httpuv’ successfully unpacked and MD5 sums checked
> ** using staged installation
> ** libs
> g++ -std=gnu++11 -I"/home/ericrhon/R/4.2/R-4.2.1/include" -DNDEBUG 
> -Ilibuv/include -pthread 
> -I'/home/ericrhon/R/4.2/R-4.2.1/library/Rcpp/include' 
> -I'/home/ericrhon/R/4.2/R-4.2.1/library/later/include' -I/usr/local/include  
> -fvisibility=hidden -DSTRICT_R_HEADERS -fpic  -g -O2  -c 
> RcppExports-legacy.cpp -o RcppExports-legacy.o
>
> g++ -std=gnu++11 -I"/home/ericrhon/R/4.2/R-4.2.1/include" -DNDEBUG 
> -Ilibuv/include -pthread 
> -I'/home/ericrhon/R/4.2/R-4.2.1/library/Rcpp/include' 
> -I'/home/ericrhon/R/4.2/R-4.2.1/library/later/include' -I/usr/local/include  
> -fvisibility=hidden -DSTRICT_R_HEADERS -fpic  -g -O2  -c RcppExports.cpp -o 
> RcppExports.o
> g++ -std=gnu++11 -I"/home/ericrhon/R/4.2/R-4.2.1/i

Re: [R] Help executing R on High Performance Cluster

2022-10-04 Thread Ivan Krylov
Hi Eric!

В Tue, 4 Oct 2022 13:36:59 +
"Rhon Calderon, Eric"  пишет:

> cd /home/ericrhon/labsoftware/R-devel/

> ./configure --prefix=/home/ericrhon/labsoftware/R-devel

I'm not sure, but the reason for the confusing behaviour could be
that the installation prefix is set to be the same as the directory
where you had unpacked the source code. This may have caused file path
conflicts and maybe some kind of recursion when building the final
executable path.

R can run straight from the build directory, without installation.
If you start from scratch, does bin/R work without `make install`? If
not, do you get any useful output if you run bin/R under sh -x?

(Additionally, R supports building away from the source code directory.
For example, if you navigate to the source code directory, then run
mkdir build && cd build && ../configure $CONFIGURE_ARGUMENTS, the build
will be mostly self-contained to that directory, which may be useful
when experimenting.)

Why are you building R with --with-recommended-packages=no?

R is supposed to be easy to build and start working with, but there may
be important details to consider, especially on an HPC, in the "R
installation and administration" guide:
https://cran.r-project.org/doc/manuals/r-release/R-admin.html

> Here is the exec script of R, line 272 is highlighted:
<...>
>   [[alternative HTML version deleted]]

This mailing list strips the HTML version of the e-mails; here's what
we see: https://stat.ethz.ch/pipermail/r-help/2022-October/475956.html

One way to link to R source code is to use the GitHub mirror:
https://github.com/r-devel/r-svn

-- 
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] Help with steam graph

2022-10-02 Thread David Winsemius
I think you are being dishonest. That code does not appear on hrbrmstr's 
vignette at least in a form that I recognize.


When I run your code from the first posting with all the instances of 
`com_num` replaced by `com_name` and removing the `pointer` entry in dat 
which throws an error when trying to define dat, I get


Error in `group_by()`: ! Must group by variables found in `.data`. ✖ 
Column `com_name` is not found. So I "rewind the process to the point 
where the error is reported and find


dat %>%+ select(year, month, company, share, com_name) %>% + 
tidyr::gather(company, share, -year) # A tibble: 148 × 3 year company 
share1 2018 month 12 2 2019 month 1 3 2019 month 2 4 
2019 month 3 5 2019 month 4 6 2019 month 5 7 2019 month 6 8 2019 month 7 
9 2017 month 1 10 2017 month 2 # … with 138 more rows # ℹ Use `print(n = 
...)` to see more rows So the "gathering" process seems to have removed 
the `com_name` column. Can exit R without saving your workspace and then 
construct a series of R commands that will create a reproducible 
example? -- David.


On 10/2/22 10:03, Tariq Khasiri wrote:
Actually in my main data the column name is com_num ( where 
mistakenly I pasted the sample data here under the com_name ). So, 
when I run the command successfully this is the error shows up -


    ▆
  1. ├─... %>% sg_legend(show = TRUE, label = "Share: ")
  2. ├─streamgraph::sg_legend(., show = TRUE, label = "Share: ")
  3. ├─streamgraph::sg_fill_brewer(., "PuOr")
  4. ├─streamgraph::sg_axis_x(., 0.8)
  5. ├─streamgraph::streamgraph(., "com_num", "n", "year")
  6. │ └─base::data.frame(data)
  7. ├─dplyr::ungroup(.)
  8. ├─dplyr::tally(., wt = share)
  9. ├─dplyr::group_by(., year, com_num)
 10. └─dplyr:::group_by.data.frame(., year, com_num)
 11.   └─dplyr::group_by_prepare(.data, ..., .add = .add, caller_env = 
caller_env())

 12.     └─rlang::abort(bullets, call = error_call)

Any suggestions on how I can fix it ??

On Sun, 2 Oct 2022 at 09:12, David Winsemius  
wrote:


I don’t see a column with the name ‘com_num’, so the error message
makes complete sense.

—
David

Sent from my iPhone

> On Oct 2, 2022, at 5:06 AM, Tariq Khasiri
 wrote:
>
> Hi, i'm trying to create a steamgraph with the following data
by creating a
> unit indicator by combing the year and month. But, I'm getting
error as :
>
> Error in `group_by()`:
> ! Must group by variables found in `.data`.
> ✖ Column `com_num` is not found.
> Run `rlang::last_error()` to see where the error occurred.
>
> ### Packages needed for the code
> devtools::install_github("hrbrmstr/streamgraph")
>
> library(tidyverse)
> library(ggplot2)
> library(dplyr)
> library(steamgraph)
>
> ### Code ( The following code can be found on creator's account
> https://hrbrmstr.github.io/streamgraph/ )
>
> dat %>%
> select(year, month, company, share, com_num) %>%
>  tidyr::gather(company, share, -year) %>%
>  group_by(year, com_num) %>%
>  tally(wt=share) %>%
>  ungroup %>%
>  streamgraph("com_num", "n", "year") %>%
>  sg_axis_x(0.8) %>%
>  sg_fill_brewer("PuOr") %>%
>  sg_legend(show=TRUE, label="Share: ")
>
>
> ### data is like the following
>
> dput(dat)
> structure(list(year = c(2018, 2019, 2019, 2019, 2019, 2019, 2019,
> 2019, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
> 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,
> 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019), month = c(12,
> 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1,
> 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5), company =
c("ABC",
> "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH"
> ), share = c(20, 16.5, 15, 15.5, 15.5, 16, 17, 16.5, 61, 55,
> 53, 53, 54, 53, 58, 54, 50, 47, 55, 50, 52, 51, 51.5, 52, 53,
> 54, 55, 53, 54, 50, 42, 48, 41, 40, 39, 36.5, 35), com_name = c(1,
> 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)), row.names = c(NA,
> -37L), spec = structure(list(cols = list(year =
structure(list(), class =
> c("collector_double",
> "collector")), month = structure(list(), class =
c("collector_double",
> "collector")), company = structure(list(), class =
c("collector_character",
> "collector")), share = structure(list(), class =
c("collector_double",
> "collector")), com_name = structure(list(), class =
c("collector_double",
> "collector"))), default = structure(list(), class =
c("collector_guess",
> "collector")), delim = ","), class = "col_spec"), problems =
 0x7fd732028680>, cl

Re: [R] Help with steam graph

2022-10-02 Thread Tariq Khasiri
Actually in my main data the column name is com_num ( where mistakenly I
pasted the sample data here under the com_name ). So, when I run the
command successfully this is the error shows up -

▆
  1. ├─... %>% sg_legend(show = TRUE, label = "Share: ")
  2. ├─streamgraph::sg_legend(., show = TRUE, label = "Share: ")
  3. ├─streamgraph::sg_fill_brewer(., "PuOr")
  4. ├─streamgraph::sg_axis_x(., 0.8)
  5. ├─streamgraph::streamgraph(., "com_num", "n", "year")
  6. │ └─base::data.frame(data)
  7. ├─dplyr::ungroup(.)
  8. ├─dplyr::tally(., wt = share)
  9. ├─dplyr::group_by(., year, com_num)
 10. └─dplyr:::group_by.data.frame(., year, com_num)
 11.   └─dplyr::group_by_prepare(.data, ..., .add = .add, caller_env =
caller_env())
 12. └─rlang::abort(bullets, call = error_call)

Any suggestions on how I can fix it ??

On Sun, 2 Oct 2022 at 09:12, David Winsemius  wrote:

> I don’t see a column with the name ‘com_num’, so the error message makes
> complete sense.
>
> —
> David
>
> Sent from my iPhone
>
> > On Oct 2, 2022, at 5:06 AM, Tariq Khasiri 
> wrote:
> >
> > Hi, i'm trying to create a steamgraph with the following data by
> creating a
> > unit indicator by combing the year and month. But, I'm getting error as :
> >
> > Error in `group_by()`:
> > ! Must group by variables found in `.data`.
> > ✖ Column `com_num` is not found.
> > Run `rlang::last_error()` to see where the error occurred.
> >
> > ### Packages needed for the code
> > devtools::install_github("hrbrmstr/streamgraph")
> >
> > library(tidyverse)
> > library(ggplot2)
> > library(dplyr)
> > library(steamgraph)
> >
> > ### Code ( The following code can be found on creator's account
> > https://hrbrmstr.github.io/streamgraph/  )
> >
> > dat %>%
> > select(year, month, company, share, com_num) %>%
> >  tidyr::gather(company, share, -year) %>%
> >  group_by(year, com_num) %>%
> >  tally(wt=share) %>%
> >  ungroup %>%
> >  streamgraph("com_num", "n", "year") %>%
> >  sg_axis_x(0.8) %>%
> >  sg_fill_brewer("PuOr") %>%
> >  sg_legend(show=TRUE, label="Share: ")
> >
> >
> > ### data is like the following
> >
> > dput(dat)
> > structure(list(year = c(2018, 2019, 2019, 2019, 2019, 2019, 2019,
> > 2019, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
> > 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,
> > 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019), month = c(12,
> > 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1,
> > 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5), company = c("ABC",
> > "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "FGH", "FGH",
> > "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> > "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> > "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH"
> > ), share = c(20, 16.5, 15, 15.5, 15.5, 16, 17, 16.5, 61, 55,
> > 53, 53, 54, 53, 58, 54, 50, 47, 55, 50, 52, 51, 51.5, 52, 53,
> > 54, 55, 53, 54, 50, 42, 48, 41, 40, 39, 36.5, 35), com_name = c(1,
> > 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
> > 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)), row.names = c(NA,
> > -37L), spec = structure(list(cols = list(year = structure(list(), class =
> > c("collector_double",
> > "collector")), month = structure(list(), class = c("collector_double",
> > "collector")), company = structure(list(), class =
> c("collector_character",
> > "collector")), share = structure(list(), class = c("collector_double",
> > "collector")), com_name = structure(list(), class = c("collector_double",
> > "collector"))), default = structure(list(), class = c("collector_guess",
> > "collector")), delim = ","), class = "col_spec"), problems =  > 0x7fd732028680>, class = c("spec_tbl_df",
> > "tbl_df", "tbl", "data.frame"))
> >
> >[[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] Help with steam graph

2022-10-02 Thread David Winsemius
I don’t see a column with the name ‘com_num’, so the error message makes 
complete sense. 

— 
David

Sent from my iPhone

> On Oct 2, 2022, at 5:06 AM, Tariq Khasiri  wrote:
> 
> Hi, i'm trying to create a steamgraph with the following data by creating a
> unit indicator by combing the year and month. But, I'm getting error as :
> 
> Error in `group_by()`:
> ! Must group by variables found in `.data`.
> ✖ Column `com_num` is not found.
> Run `rlang::last_error()` to see where the error occurred.
> 
> ### Packages needed for the code
> devtools::install_github("hrbrmstr/streamgraph")
> 
> library(tidyverse)
> library(ggplot2)
> library(dplyr)
> library(steamgraph)
> 
> ### Code ( The following code can be found on creator's account
> https://hrbrmstr.github.io/streamgraph/  )
> 
> dat %>%
> select(year, month, company, share, com_num) %>%
>  tidyr::gather(company, share, -year) %>%
>  group_by(year, com_num) %>%
>  tally(wt=share) %>%
>  ungroup %>%
>  streamgraph("com_num", "n", "year") %>%
>  sg_axis_x(0.8) %>%
>  sg_fill_brewer("PuOr") %>%
>  sg_legend(show=TRUE, label="Share: ")
> 
> 
> ### data is like the following
> 
> dput(dat)
> structure(list(year = c(2018, 2019, 2019, 2019, 2019, 2019, 2019,
> 2019, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
> 2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,
> 2018, 2018, 2018, 2019, 2019, 2019, 2019, 2019), month = c(12,
> 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1,
> 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5), company = c("ABC",
> "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "ABC", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH",
> "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH", "FGH"
> ), share = c(20, 16.5, 15, 15.5, 15.5, 16, 17, 16.5, 61, 55,
> 53, 53, 54, 53, 58, 54, 50, 47, 55, 50, 52, 51, 51.5, 52, 53,
> 54, 55, 53, 54, 50, 42, 48, 41, 40, 39, 36.5, 35), com_name = c(1,
> 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2)), row.names = c(NA,
> -37L), spec = structure(list(cols = list(year = structure(list(), class =
> c("collector_double",
> "collector")), month = structure(list(), class = c("collector_double",
> "collector")), company = structure(list(), class = c("collector_character",
> "collector")), share = structure(list(), class = c("collector_double",
> "collector")), com_name = structure(list(), class = c("collector_double",
> "collector"))), default = structure(list(), class = c("collector_guess",
> "collector")), delim = ","), class = "col_spec"), problems =  0x7fd732028680>, class = c("spec_tbl_df",
> "tbl_df", "tbl", "data.frame"))
> 
>[[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] Help with a simple subroutine

2022-09-09 Thread Steven T. Yen
Thanks to all. It was just programming error. The following now works. 
Essentially, to impose non-negative restrictions I estimated the natural 
logs of two parameters and then do exponential transformation to uncover 
the parameters, with mathematical transformation (delta method) for 
their standard errors.


I believe deltaMethod {car} does that sort of things. I have yet to look 
up if it does that for nonlinear regression object. But since the 
exponential transformation is a simple transformation (with a derivative 
equal to itself), I tried to program my own. Thanks to all.


> obj<-cbp11.pooled
> j<-grep("gamma",names(obj$est),value=TRUE); j
[1] "log.gamma1" "log.gamma2"
> obj$estimate[j]
log.gamma1 log.gamma2
  -1.82378   -1.11313
> obj$stat$vb[j,j]
   log.gamma1 log.gamma2
log.gamma1  0.0842252  0.0138778
log.gamma2  0.0138778  0.0793592
> mydelta <- function(obj,j){
+ # ***
+ # Delta method for exponential transformation
+ # ***
+   b<-obj$estimate[j]
+   v<-obj$stat$vb[j,j]; v
+   gamma<-exp(b)
+   db<-gamma
+   vgamma<-db^2*v
+   sgamma<-sqrt(diag(vgamma))
+   t<-gamma/sgamma
+   df<-n<-obj$stat$n
+   p<-2*(1-pt(abs(t),df))
+   list(gamma=gamma,sgamma=sgamma,b=b,t=t,p=p)
+ }
> v<-mydelta(obj,j)
> v$b
log.gamma1 log.gamma2
  -1.82378   -1.11313
> v$gamma
log.gamma1 log.gamma2
  0.161414   0.328529
> v$sgamma
log.gamma1 log.gamma2
 0.0468449  0.0925490
> v$t
log.gamma1 log.gamma2
   3.44571    3.54978
> v$p
 log.gamma1  log.gamma2
0.000574108 0.000388996
>

On 9/9/2022 8:39 PM, Ebert,Timothy Aaron wrote:


If t = 1/sqrt(v[2,2]) and there is no code to change the value of v[2,2] and no 
code to change to a different cell why would you get two different values?

One approach to debugging is to make a small example and see if the code output 
matches (line-by-line) the output you get from doing a manual calculation. If 
they do not match you at least know where to start looking for a problem. Hand 
calculation can use pencil and paper or Excel or other tools. It is a tedious 
task but very effective.

Tim

-Original Message-
From: R-help  On Behalf Of Ivan Krylov
Sent: Friday, September 9, 2022 5:03 AM
To: Steven T. Yen 
Cc: R-help Mailing List 
Subject: Re: [R] Help with a simple subroutine

[External Email]

В Fri, 9 Sep 2022 16:46:00 +0800
"Steven T. Yen"  пишет:


I am expecting the line  t<-gamma/sgamma to produce two different
values. But I confirm that it is doing tt<-gamma[1]/sgamma[1]

No, it just happens that gamma[1]/sgamma[1] is the same as gamma[2]/sgamma[2], 
subject to rounding errors:


+   gamma<-exp(b)
+   vgamma<-gamma^2*v[2,2]
+   sgamma<-sqrt(vgamma)
+   t<-gamma/sgamma

t = gamma / sgamma = gamma / sqrt(gamma^2 * v[2,2]) =
   = gamma / (abs(gamma) * sqrt(v[2,2])) = (given gamma = exp(b) > 0)
   = 1 / sqrt(v[2,2]).

--
Best regards,
Ivan

__
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-help&data=05%7C01%7Ctebert%40ufl.edu%7C96597c0724d947d3c1ea08da9242e073%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637983113179778561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=EnaoCEmoUJNXsukvk8jqZVZ1tIveOeUCIX%2Bic5tMRLM%3D&reserved=0
PLEASE do read the posting guide 
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C96597c0724d947d3c1ea08da9242e073%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637983113179778561%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=18MG1xlJnQE%2Bqo54jNxYAIAGqSQC%2FFQOgTOkl7Ysvc8%3D&reserved=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.


Re: [R] Help for funnel plot

2022-05-15 Thread Jim Lemon
Hi,
Looking at the help page for "funnel", I first thought that the
"shade" argument would be the one. However, that seems to take a
specific color. Perhaps the function computes the shading from that. I
have never used the "funnel" function myself, so I don't have a good
idea of how that left-to-right gradient is determined. Perhaps:

w...@metafor-project.org

could tell you.

Jim

On Sun, May 15, 2022 at 10:24 PM De Simone
 wrote:
>
> Thank you Jim
> I attached an example for color gradient
> What would be the argument for one color gradient. I haven't used the plotrix 
> before
>
> On Sun, May 15, 2022 at 10:56 AM Jim Lemon  wrote:
>>
>> Hi,
>> There are a number of functions that will transform numeric values
>> into colors. One is color.scale in the plotrix package. This accepts a
>> vector of numeric values and linearly transforms them into one or more
>> ranges of colors. The resulting colors can then be passed to the
>> appropriate arguments in your plotting function.
>>
>> Jim
>>
>> On Sun, May 15, 2022 at 3:48 PM De Simone  
>> wrote:
>> >
>> > Hi,
>> > Excuse me for this silly question
>> > how do I get a colour gradient like the one attached. Colours are a bit
>> > limited
>> > Any specific code for the reference line and pseudo confidence lines. I use
>> > "lty", but this do both
>> >
>> > Here is my argument
>> >
>> > dat <- escalc("MD", m1i=Mean_TAP, sd1i= SD_TAP, n1i= N_TAP,
>> > m2i=Mean_caudal, sd2i= SD_caudal, n2i= N_caudal, slab=Study, data=
>> > Duration_of_analgesia)
>> >
>> >
>> >
>> > res <- rma(yi, vi, data=dat, measure="MD", method="DL")
>> >
>> >
>> > funnel(res, main="Duration of analegsia", back = 12, xlab="Mean difference
>> > (hours)", cex = 1.2,  lwd = 2, lty = "solid", mgp = c(2, 1, 0), font.main =
>> > 1, font.lab = 2, font.axis = 2)
>> >
>> > Thank you
>> > __
>> > 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] Help for funnel plot

2022-05-15 Thread De Simone
Hi Rui

Thank you. The default for the shade and hilinees is ok, that is why I
didn't add it.
I attached the example image as PDF
my question is how to get gradient colors for the background like the one
attached
And again how to get different types of lines for the Reference and
confidence. The argument "lty" do both

On Sun, May 15, 2022 at 9:14 AM Rui Barradas  wrote:

> Hello,
>
> No attachment came through, see the posting guide (a link is at the
> bottom of this and every R-Help e-mail) for the file formats allowed in
> attachments.
>
> What do you mean by colour gradient? `metafor::funnel` has 3 arguments
> to set colors,
>
>   - back, set in your code to 12;
>   - shade, unused;
>   - hlines, unused.
>
> And when you use functions not in base R, start your scripts with calls
> to library() to load the packages where those functions can be found.
>
>
> Hope this helps,
>
> Rui Barradas
>
>
> Às 01:37 de 15/05/2022, De Simone escreveu:
> > Hi,
> > Excuse me for this silly question
> > how do I get a colour gradient like the one attached. Colours are a bit
> > limited
> > Any specific code for the reference line and pseudo confidence lines. I
> use
> > "lty", but this do both
> >
> > Here is my argument
> >
> > dat <- escalc("MD", m1i=Mean_TAP, sd1i= SD_TAP, n1i= N_TAP,
> > m2i=Mean_caudal, sd2i= SD_caudal, n2i= N_caudal, slab=Study, data=
> > Duration_of_analgesia)
> >
> >
> >
> > res <- rma(yi, vi, data=dat, measure="MD", method="DL")
> >
> >
> > funnel(res, main="Duration of analegsia", back = 12, xlab="Mean
> difference
> > (hours)", cex = 1.2,  lwd = 2, lty = "solid", mgp = c(2, 1, 0),
> font.main =
> > 1, font.lab = 2, font.axis = 2)
> >
> > Thank you
> > __
> > 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.
>


Funnel.pdf
Description: Adobe PDF document
__
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] Help for funnel plot

2022-05-15 Thread Jim Lemon
Hi,
There are a number of functions that will transform numeric values
into colors. One is color.scale in the plotrix package. This accepts a
vector of numeric values and linearly transforms them into one or more
ranges of colors. The resulting colors can then be passed to the
appropriate arguments in your plotting function.

Jim

On Sun, May 15, 2022 at 3:48 PM De Simone  wrote:
>
> Hi,
> Excuse me for this silly question
> how do I get a colour gradient like the one attached. Colours are a bit
> limited
> Any specific code for the reference line and pseudo confidence lines. I use
> "lty", but this do both
>
> Here is my argument
>
> dat <- escalc("MD", m1i=Mean_TAP, sd1i= SD_TAP, n1i= N_TAP,
> m2i=Mean_caudal, sd2i= SD_caudal, n2i= N_caudal, slab=Study, data=
> Duration_of_analgesia)
>
>
>
> res <- rma(yi, vi, data=dat, measure="MD", method="DL")
>
>
> funnel(res, main="Duration of analegsia", back = 12, xlab="Mean difference
> (hours)", cex = 1.2,  lwd = 2, lty = "solid", mgp = c(2, 1, 0), font.main =
> 1, font.lab = 2, font.axis = 2)
>
> Thank you
> __
> 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] help with RcppTOML library

2022-03-25 Thread Ivan Krylov
On Thu, 24 Mar 2022 20:33:39 -0700
Bogdan Tanasa  wrote:

> "/FRIDAY/CONDA/pkgs/r-rcpptoml-0.1.7-r41h03ef668_0/lib/R/library/RcppTOML"

I have no idea how Conda works, but shouldn't this entry point to the
parent directory, that is,
"/FRIDAY/CONDA/pkgs/r-rcpptoml-0.1.7-r41h03ef668_0/lib/R/library"? So
that library() would be able to find the RcppTOML subdirectory in it
and load the package from there?

> RcppTOML is still not working

I'm assuming you mean something like "Error in library(RcppTOML) : there
is no package called 'RcppTOML'", but there are other options,
including it crashing your R session, or something completely different.

-- 
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] help with installing R packages on Mac : these packages are downloaded but not compiled

2022-03-23 Thread Bogdan Tanasa
Thank you Jeff.

Well, the same messages I do receive not only I do install "tidyverse" but
also any other packages from BioConductor ;

specifically, the packages are downloaded but not compiled and not
installed.

I believe that it is a more global R issue with Mac Monterey, although I do
not know how to solve it. Thanks,

Bogdan



On Wed, Mar 23, 2022 at 6:42 PM Jeff Newmiller 
wrote:

> Tidyverse has dozens of dependencies... and when a dependency fails to
> install then you often need to install it explicitly... the automatic
> dependency algorithm doesn't seem to work robustly.
>
> Carefully read your error messages... it looks like you should start by
> installing backports.
>
> On March 23, 2022 5:52:29 PM PDT, Bert Gunter 
> wrote:
> >Mac specific issues generally belong on the R-sig-mac list, not here(I
> >of course don't know whether this is Mac specific or not. Folks on the
> >Mac list presumably would).
> >
> >
> >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 Wed, Mar 23, 2022 at 5:41 PM Bogdan Tanasa  wrote:
> >>
> >> Dear all,
> >>
> >> I would appreciate to have your prompt help please on the following
> issue :
> >>
> >> I am the process of installing R and R packages on MacOS Monterrey.
> >>
> >> The packages are downloaded but not compiled and are not installed, as
> >> shown below.
> >>
> >>  I would appreciate any help that you can offer please. Thank you.
> >>
> >> > install.packages("tidyverse", dependencies=T)
> >> Installing package into
> >> ‘/Users/btanasa/Library/R/x86_64/4.1/library’(as ‘lib’ is unspecified)
> >> trying URL '
> https://cran.rstudio.com/bin/macosx/contrib/4.1/tidyverse_1.3.1.tgz'
> >> Content type 'application/x-gzip' length 421072 bytes (411
> >> KB)==
> >> downloaded 411 KB
> >>
> >>
> >> The downloaded binary packages are in
> >>
>  
> /var/folders/j1/vfxkcdz51l945jpfb2vplcsw47dvp9/T//RtmpYudPdW/downloaded_packages>
> >> > > library("tidyverse")
> >> Error: package or namespace load failed for ‘tidyverse’:
> >>  .onLoad failed in loadNamespace() for 'broom', details:
> >>   call: loadNamespace(x)
> >>   error: there is no package called ‘backports’
> >>
> >> [[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.
>
> --
> Sent from my phone. Please excuse my brevity.
>

[[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] help with installing R packages on Mac : these packages are downloaded but not compiled

2022-03-23 Thread Jeff Newmiller
Tidyverse has dozens of dependencies... and when a dependency fails to install 
then you often need to install it explicitly... the automatic dependency 
algorithm doesn't seem to work robustly.

Carefully read your error messages... it looks like you should start by 
installing backports.

On March 23, 2022 5:52:29 PM PDT, Bert Gunter  wrote:
>Mac specific issues generally belong on the R-sig-mac list, not here(I
>of course don't know whether this is Mac specific or not. Folks on the
>Mac list presumably would).
>
>
>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 Wed, Mar 23, 2022 at 5:41 PM Bogdan Tanasa  wrote:
>>
>> Dear all,
>>
>> I would appreciate to have your prompt help please on the following issue :
>>
>> I am the process of installing R and R packages on MacOS Monterrey.
>>
>> The packages are downloaded but not compiled and are not installed, as
>> shown below.
>>
>>  I would appreciate any help that you can offer please. Thank you.
>>
>> > install.packages("tidyverse", dependencies=T)
>> Installing package into
>> ‘/Users/btanasa/Library/R/x86_64/4.1/library’(as ‘lib’ is unspecified)
>> trying URL 
>> 'https://cran.rstudio.com/bin/macosx/contrib/4.1/tidyverse_1.3.1.tgz'
>> Content type 'application/x-gzip' length 421072 bytes (411
>> KB)==
>> downloaded 411 KB
>>
>>
>> The downloaded binary packages are in
>> 
>> /var/folders/j1/vfxkcdz51l945jpfb2vplcsw47dvp9/T//RtmpYudPdW/downloaded_packages>
>> > > library("tidyverse")
>> Error: package or namespace load failed for ‘tidyverse’:
>>  .onLoad failed in loadNamespace() for 'broom', details:
>>   call: loadNamespace(x)
>>   error: there is no package called ‘backports’
>>
>> [[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.

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


Re: [R] Help with using the huxreg() function

2022-03-22 Thread Bert Gunter
" I don't know if
this is the right way to ask for help, but at least I thought I could give
it a try."

It isn't. Read the posting guide linked below to learn what is
expected here. In particular, please note that it explicitly says:
"Basic statistics and classroom homework: R-help is not intended for these."
(though sometimes people do reply)

Also, questions about specialized packages (like huxreg)  will often
go unanswered -- there are thousands of packages, after all. Note that
huxreg has a vignette -- have you studied it carefully? You may also
wish to contact the maintainer (found via the maintainer() function)
as there may be package-specific Help resources maintained by them.

Finally, RStudio is not R.  RStudio is a private company with their
own Help resources at:
https://community.rstudio.com/
So if your issues involve RStudio developed packages/ecosystems like
the Tidyverse, that is probably a better place to look for help.

(Also, please note that if you post *here*, this is a *plain text*
list: HTML can get messed up by the server, as the PG says).



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 Tue, Mar 22, 2022 at 2:18 PM Linda Stefansson
 wrote:
>
> Hello,
>
> I am currently studying Econometrics at my university in Sweden, and we use
> RStudio.
> We are now doing our last assignment and I need a little bit of help with
> it.
>
> I have made a regression table using the huxreg() function for 4 different
> models. The task is to make the table only display the two coefficients
> that all models have. Since two of the models use the LSDV approach, they
> have a lot of different coefficients which I would like to exclude. How do
> I do this? To this point I have made the regression table like this:
> huxreg(model_1, model_2, model_3, model 4, statistics = c(N = "nobs", R2 =
> "r.squared"), stars = c(* = 0.1, ** = 0.05, *** = 0.01)).
>
> I would really be grateful if you could help me with this. I don't know if
> this is the right way to ask for help, but at least I thought I could give
> it a try.
>
> Best regards,
>
> Linda Stefansson
>
> [[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] Help with developing package DWLS

2022-01-11 Thread Bert Gunter
Andrew has already provided you a lot of help, but further posts should go
to r-package-devel, which is a mailing list specifically set up to provide
the sort of help you requested.

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 Tue, Jan 11, 2022 at 12:10 AM Adriana Sistig <
adriana.sis...@icahn.mssm.edu> wrote:

> Hello,
>
> My name is Adriana Sistig and I am struggle to fix an ERROR and a few
> WARNING and NOTE message that I am getting from my package. I am new to
> CRAN packaging and am having some trouble finalizing my package.
>
> I do not have any ERRORS when I check using Mac but when checking via
> Windows and Debian I do. The current Status: 1 ERROR, 3 WARNINGs, 6 NOTEs —
> Pasted below for more information.
>
> GitHub link: https://github.com/sistia01/DWLS <
> https://github.com/sistia01/DWLS>
>
> Further information:
>
> > sessionInfo()
> R version 4.0.5 (2021-03-31)
> Platform: x86_64-apple-darwin17.0 (64-bit)
> Running under: macOS Big Sur 10.16
>
> Matrix products: default
> LAPACK:
> /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] parallel  stats graphics  grDevices utils datasets  methods
>  base
>
> other attached packages:
> [1] DWLS_0.1.0  Giotto_1.0.3Biobase_2.50.0
> BiocGenerics_0.36.1
>
> loaded via a namespace (and not attached):
>   [1] Seurat_4.0.5Rtsne_0.15
> colorspace_2.0-2
>   [4] deldir_1.0-6class_7.3-19
> ellipsis_0.3.2
>   [7] ggridges_0.5.3  XVector_0.30.0
> GenomicRanges_1.42.0
>  [10] proxy_0.4-26spatstat.data_2.1-0
>  leiden_0.3.9
>  [13] listenv_0.8.0   ggrepel_0.9.1   fansi_0.5.0
>
>  [16] codetools_0.2-18splines_4.0.5
>  polyclip_1.10-0
>  [19] jsonlite_1.7.2  ica_1.0-2
>  cluster_2.1.2
>  [22] png_0.1-7   uwot_0.1.11 shiny_1.7.1
>
>  [25] sctransform_0.3.2   spatstat.sparse_2.0-0
>  compiler_4.0.5
>  [28] httr_1.4.2  SeuratObject_4.0.4
> Matrix_1.3-4
>  [31] fastmap_1.1.0   lazyeval_0.2.2  cli_3.1.0
>
>  [34] later_1.3.0 htmltools_0.5.2 tools_4.0.5
>
>  [37] igraph_1.2.9gtable_0.3.0glue_1.6.0
>
>  [40] GenomeInfoDbData_1.2.4  RANN_2.6.1
> reshape2_1.4.4
>  [43] dplyr_1.0.7 Rcpp_1.0.7
> scattermore_0.7
>  [46] vctrs_0.3.8 nlme_3.1-153
> lmtest_0.9-39
>  [49] stringr_1.4.0   globals_0.14.0  mime_0.12
>
>  [52] miniUI_0.1.1.1  lifecycle_1.0.1 irlba_2.3.5
>
>  [55] goftest_1.2-3   future_1.23.0
>  zlibbioc_1.36.0
>  [58] MASS_7.3-54 zoo_1.8-9
>  scales_1.1.1
>  [61] MAST_1.16.0 spatstat.core_2.3-2
>  promises_1.2.0.1
>  [64] MatrixGenerics_1.2.1spatstat.utils_2.2-0
> SummarizedExperiment_1.20.0
>  [67] RColorBrewer_1.1-2  SingleCellExperiment_1.12.0
> reticulate_1.22
>  [70] pbapply_1.5-0   gridExtra_2.3
>  ggplot2_3.3.5
>  [73] rpart_4.1-15reshape_0.8.8
>  stringi_1.7.6
>  [76] S4Vectors_0.28.1e1071_1.7-9
>  GenomeInfoDb_1.26.7
>  [79] rlang_0.4.12pkgconfig_2.0.3
>  matrixStats_0.61.0
>  [82] bitops_1.0-7lattice_0.20-45 ROCR_1.0-11
>
>  [85] purrr_0.3.4 tensor_1.5
> patchwork_1.1.1
>  [88] htmlwidgets_1.5.4   cowplot_1.1.1
>  tidyselect_1.1.1
>  [91] parallelly_1.29.0   RcppAnnoy_0.0.19plyr_1.8.6
>
>  [94] magrittr_2.0.1  R6_2.5.1
> IRanges_2.24.1
>  [97] generics_0.1.1  DBI_1.1.1
>  DelayedArray_0.16.3
> [100] mgcv_1.8-38 pillar_1.6.4
> fitdistrplus_1.1-6
> [103] survival_3.2-13 abind_1.4-5
>  RCurl_1.98-1.5
> [106] tibble_3.1.6future.apply_1.8.1
> crayon_1.4.2
> [109] KernSmooth_2.23-20  utf8_1.2.2
> spatstat.geom_2.3-0
> [112] plotly_4.10.0   grid_4.0.5
> data.table_1.14.2
> [115] digest_0.6.29   xtable_1.8-4tidyr_1.1.4
>
> [118] httpuv_1.6.3stats4_4.0.5
> munsell_0.5.0
> [121] viridisLite_0.4.0   quadprog_1.5-8
>
> > Sys.getlocale()
> [1] "en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8”
>
> —
> * using log directory 'd:/RCompile/CRANguest/R-devel/DWLS.Rcheck'
> * using R Under development (unstable) (2022-01-09 r81462 ucrt)
> * using platform: x86_64-w64-mingw32 (64-bit)
> * using session charset: UTF-8
> * checking for file 'DWLS/DESCRIPTION' ... OK
> * checking extension type ... Package
> * this is package 'DWLS' version '0.1.0'
> * package encoding: UTF-8
> * checking CRAN incoming f

Re: [R] Help with developing package DWLS

2022-01-11 Thread Andrew Simmons
The NOTE saying 'Possibly misspelled words in DESCRIPTION' can probably be
ignored (though I would probably put the name of your package in single
quotes).


The NOTE 'Non-standard files/directories found at top level' means that you
should move the non-standard files to a different location OR add the
files/directories to your .Rbuildignore file
For example, in my own packages, I usually have a script that will
conveniently run R CMD build, R CMD INSTALL, and R CMD check on that
package, but I don't want to include it in the *.tar.gz, so I add the line:
^Check_This\.R$
to the .Rbuildignore file, and then it's not included. For you, adding
something like:
^Reference_Manual_DWLS\.md$
^Reference_Manual_Rd2md\.md$
might work.


The NOTE 'DEAnalysisMAST: no visible binding for global variable
  'Number.of.Cells'', basically on line 46 of the function you have
something like vbeta.1 <- subset(vbeta.fa, Number.of.Cells == 1)
Anyone reading this would know that Number.of.Cells == 1 is evaluated
within the context vbeta.fa, but R CMD check doesn't, so something like:
vbeta.1 <- vbeta.fa[vbeta.fa[["Number.of.Cells"]] == 1, , drop = FALSE]
might get around this issue while still behaving the same code-wise.


The WARNING 'Undocumented code objects:', even though these objects you've
exported are not functions, they still need a documentation file.
It seems like you're using roxygen for documentation, I'm not familiar with
that, but I'd imagine it's nearly identical to documenting a function.
Here's the chapter of the manual they were referring to:
https://cran.r-project.org/doc/manuals/R-exts.html#Writing-R-documentation-files


The NOTE 'installed size is 66.4Mb'
and WARNING 'LazyData DB of 66.3 MB without LazyDataCompression set'
basically, you have too much data. Or not too much necessarily, but it's
not compressed enough.
The default compression is gzip, but you can also try bzip2 and xz.
You can do this by adding the argument --data-compress=bzip2
or --data-compress=xz to R CMD INSTALL,
or you can add LazyDataCompression: bzip2 or LazyDataCompression: xz to
your DESCRIPTION file.
It seems like you already have the line LazyDataCompression: xz in your
DESCRIPTION, but it's commented out, might want to un-comment it.
Also, for comparisons sake, you could add '-1' to the package version
and LazyDataCompression:
gzip, and then do the same thing adding '-2' and LazyDataCompression:
bzip2, and '-3' and LazyDataCompression: xz so that you figure out which
has the best compression.
You can also visit here for more details:
https://cran.r-project.org/doc/manuals/R-exts.html#Data-in-packages


The NOTE 'Examples with CPU (user + system) or elapsed time > 10s'
basically, your examples need to not take as long. If you'd like, you could
move the long computations into a demo, see here:
https://cran.r-project.org/doc/manuals/R-exts.html#Package-subdirectories
Or you could also add a question for the user:
if (utils::askYesNo("Would you like to run the longer, more involved
example?", default = interactive())) {
# long example
} else {
# make a shorter example here
}
and this way, when being check by R CMD check, it will run the short
example, while still allowing the user to run the long example.


I don't think I can offer much help with the last ERROR,


Might also be worth noting, my Windows machine brings up some things that
yours doesn't. For example, it says the directory should be named 'data',
not 'Data'.
Here's the rest of the print out:
andre@DESKTOP-VR312SR:~$ R CMD "check" "--as-cran"
"C:\Users\andre\AppData\Local\Temp\RtmpcjdmpU\file4b8c681a309f\DWLS_0.1.0.tar.gz"
* using log directory 'C:/Users/andre/Documents/DWLS.Rcheck'
* using R version 4.1.2 (2021-11-01)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using option '--as-cran'
* checking for file 'DWLS/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'DWLS' version '0.1.0'
* package encoding: UTF-8
* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Adriana Sistig '

New submission

Unknown, possibly mis-spelled, fields in DESCRIPTION:
  'RemoteType' 'RemoteHost' 'RemoteRepo' 'RemoteUsername' 'RemoteRef'
'RemoteSha' 'GithubRepo' 'GithubUsername' 'GithubRef' 'GithubSHA1'

Size of tarball: 32169874 bytes
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'DWLS' can be installed ... OK
* checking installed package size ... NOTE
  installed size is 66.4Mb
  sub-directories of 1Mb or more:
data  66.3Mb
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
Non-standard file/directory found at top l

Re: [R] help with LDA topic modelling..

2021-12-20 Thread akshay kulkarni
Thanks a lot

From: Jim Lemon 
Sent: Monday, December 20, 2021 1:43 PM
To: akshay kulkarni 
Cc: R help Mailing list 
Subject: Re: [R] help with LDA topic modelling..

Hi Akshay,
It depends upon how the circles are calculated. If each circle
encloses all of the members of each group, yes. I doubt you would get
perfect separation in any real example, though. At the moment:
Hanukkah is finished,
Margashirsha Punima has just happened and
Christmas is coming up.
No matter how devout the adherents, I don't think you would find news
articles that only mentioned one of these festivals. Less facetious
groupings would suffer the same eclectic problem.

Jim

On Mon, Dec 20, 2021 at 6:29 PM akshay kulkarni  wrote:
>
> dear members,
>  I am using LDA for topic modelling of news articles 
> (topicmodels package). I am visualizing the accuracy with the LDAvis package.
>
> The visualization shows clusters as circles, probably intersecting. My 
> question is, if a find the optimal number of topics, k, and if the circles 
> representing the topics doesn't intersect, then I have achieved perfect 
> segregation. AM I right?
>
> Thanking You,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[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] help with LDA topic modelling..

2021-12-20 Thread Jim Lemon
Hi Akshay,
It depends upon how the circles are calculated. If each circle
encloses all of the members of each group, yes. I doubt you would get
perfect separation in any real example, though. At the moment:
Hanukkah is finished,
Margashirsha Punima has just happened and
Christmas is coming up.
No matter how devout the adherents, I don't think you would find news
articles that only mentioned one of these festivals. Less facetious
groupings would suffer the same eclectic problem.

Jim

On Mon, Dec 20, 2021 at 6:29 PM akshay kulkarni  wrote:
>
> dear members,
>  I am using LDA for topic modelling of news articles 
> (topicmodels package). I am visualizing the accuracy with the LDAvis package.
>
> The visualization shows clusters as circles, probably intersecting. My 
> question is, if a find the optimal number of topics, k, and if the circles 
> representing the topics doesn't intersect, then I have achieved perfect 
> segregation. AM I right?
>
> Thanking You,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[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] help with parellel processing and RSelenium

2021-12-14 Thread akshay kulkarni
Dear Rui,
Thanks a lot. I've not yet ran the function. I hoped that I 
make sure of it before. Therefore I can't print r. Thanks anyways!

Yours sincerely,
Akshay M Kulkarni

From: Rui Barradas 
Sent: Sunday, December 12, 2021 10:42 PM
To: akshay kulkarni ; R help Mailing list 

Subject: Re: [R] help with parellel processing and RSelenium

Hello,

Inline.

�s 16:43 de 12/12/21, akshay kulkarni escreveu:
> dear members,
>   I am a stock trader based in INDIA using R for my 
> research. I have two questions:
>
>
>1.  I want to send the same function with different arguments to different 
> cores. This link in SO 
> https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using
>2.  gives the following solution:
>
> library(parallel)
>
> cl <- makeCluster(4)
> clusterExport(cl, "foo")
> cores <- seq_along(cl)
> r <- clusterApply(cl[cores], cores, function(core) {
>if (core == 1) {
>  foo(5, 4, 1/2, 3, "a")
>} else if (core == 2) {
>  foo(5, 3, 1/3, 1, "b")
>} else if (core == 3) {
>  foo(5, 4, 1/4, 1, "c")
>} else if (core == 4) {
>  foo(5, 2, 1/5, 0, "d")
>}})
>
> My question is: what is the structure of the output "r" in the above code? I 
> think it is a list with r[[1]] = output of foo(5,4,1/2,3,"a"),r[[2]] = output 
> of foo(5,1/3,1,"b")
>
> and so on. AM I right?

Yes, you are right. Why don't you try and print r[[1]]?

Anyway, I would put the parameters in a list and pass them to the
function following the below lines.


library(parallel)

foo <- function(pars){
   x <- pars$x
   y <- pars$y
   z <- pars$z
   w <- pars$w
   alpha <- pars$alpha
   res <- (x + y)*z^w
   list(result = res, message = alpha)
}
params <- list(
   list(x=5, y=4, z=1/2, w=3, alpha="a"),
   list(x=5, y=3, z=1/3, w=1, alpha="b"),
   list(x=5, y=4, z=1/4, w=1, alpha="c"),
   list(x=5, y=2, z=1/5, w=0, alpha="d")
)

cl <- makeCluster(4)
clusterExport(cl, "foo")
clusterExport(cl, "params")
cores <- seq_along(cl)
r <- clusterApply(cl[cores], cores, function(core) {
   foo(params[[core]])
})
stopCluster(cl)

do.call(rbind.data.frame, r)


Hope this helps,

Rui Barradas


>
>1.
>
> I am using RSelenium to scrape a website. Javascript has a document.ready 
> function which ensures that any JS code is run only after the whole document 
> is
>
>*
>
> loaded. Is there a similar function in RSelenium? Or will the execution of 
> the next expression takes place only after the whole page is loaded (with the
>
>*
>
> "navigate" method of RSelenium)?
>
> Thanking you,
>
> Yours sincerely,
>
> AKSHAY M KULKARNI
>
>
>
>
>[[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] help with parellel processing and RSelenium

2021-12-12 Thread Bert Gunter
I would suggest instead:

foo <- function(pars){
   with(pars,
   (res <- (x + y)*z^w
   list(result = res, message = alpha) ))
}

On Sun, Dec 12, 2021, 9:12 AM Rui Barradas  wrote:

> Hello,
>
> Inline.
>
> Às 16:43 de 12/12/21, akshay kulkarni escreveu:
> > dear members,
> >   I am a stock trader based in INDIA using R for
> my research. I have two questions:
> >
> >
> >1.  I want to send the same function with different arguments to
> different cores. This link in SO
> https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using
> >2.  gives the following solution:
> >
> > library(parallel)
> >
> > cl <- makeCluster(4)
> > clusterExport(cl, "foo")
> > cores <- seq_along(cl)
> > r <- clusterApply(cl[cores], cores, function(core) {
> >if (core == 1) {
> >  foo(5, 4, 1/2, 3, "a")
> >} else if (core == 2) {
> >  foo(5, 3, 1/3, 1, "b")
> >} else if (core == 3) {
> >  foo(5, 4, 1/4, 1, "c")
> >} else if (core == 4) {
> >  foo(5, 2, 1/5, 0, "d")
> >}})
> >
> > My question is: what is the structure of the output "r" in the above
> code? I think it is a list with r[[1]] = output of
> foo(5,4,1/2,3,"a"),r[[2]] = output of foo(5,1/3,1,"b")
> >
> > and so on. AM I right?
>
> Yes, you are right. Why don't you try and print r[[1]]?
>
> Anyway, I would put the parameters in a list and pass them to the
> function following the below lines.
>
>
> library(parallel)
>
> foo <- function(pars){
>x <- pars$x
>y <- pars$y
>z <- pars$z
>w <- pars$w
>alpha <- pars$alpha
>res <- (x + y)*z^w
>list(result = res, message = alpha)
> }
> params <- list(
>list(x=5, y=4, z=1/2, w=3, alpha="a"),
>list(x=5, y=3, z=1/3, w=1, alpha="b"),
>list(x=5, y=4, z=1/4, w=1, alpha="c"),
>list(x=5, y=2, z=1/5, w=0, alpha="d")
> )
>
> cl <- makeCluster(4)
> clusterExport(cl, "foo")
> clusterExport(cl, "params")
> cores <- seq_along(cl)
> r <- clusterApply(cl[cores], cores, function(core) {
>foo(params[[core]])
> })
> stopCluster(cl)
>
> do.call(rbind.data.frame, r)
>
>
> Hope this helps,
>
> Rui Barradas
>
>
> >
> >1.
> >
> > I am using RSelenium to scrape a website. Javascript has a
> document.ready function which ensures that any JS code is run only after
> the whole document is
> >
> >*
> >
> > loaded. Is there a similar function in RSelenium? Or will the execution
> of the next expression takes place only after the whole page is loaded
> (with the
> >
> >*
> >
> > "navigate" method of RSelenium)?
> >
> > Thanking you,
> >
> > Yours sincerely,
> >
> > AKSHAY M KULKARNI
> >
> >
> >
> >
> >   [[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.
>

[[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] help with parellel processing and RSelenium

2021-12-12 Thread Rui Barradas

Hello,

Inline.

Às 16:43 de 12/12/21, akshay kulkarni escreveu:

dear members,
  I am a stock trader based in INDIA using R for my 
research. I have two questions:


   1.  I want to send the same function with different arguments to different 
cores. This link in SO 
https://stackoverflow.com/questions/25045998/send-function-calls-with-different-arguments-to-different-processors-in-r-using
   2.  gives the following solution:

library(parallel)

cl <- makeCluster(4)
clusterExport(cl, "foo")
cores <- seq_along(cl)
r <- clusterApply(cl[cores], cores, function(core) {
   if (core == 1) {
 foo(5, 4, 1/2, 3, "a")
   } else if (core == 2) {
 foo(5, 3, 1/3, 1, "b")
   } else if (core == 3) {
 foo(5, 4, 1/4, 1, "c")
   } else if (core == 4) {
 foo(5, 2, 1/5, 0, "d")
   }})

My question is: what is the structure of the output "r" in the above code? I think it is a list 
with r[[1]] = output of foo(5,4,1/2,3,"a"),r[[2]] = output of foo(5,1/3,1,"b")

and so on. AM I right?


Yes, you are right. Why don't you try and print r[[1]]?

Anyway, I would put the parameters in a list and pass them to the 
function following the below lines.



library(parallel)

foo <- function(pars){
  x <- pars$x
  y <- pars$y
  z <- pars$z
  w <- pars$w
  alpha <- pars$alpha
  res <- (x + y)*z^w
  list(result = res, message = alpha)
}
params <- list(
  list(x=5, y=4, z=1/2, w=3, alpha="a"),
  list(x=5, y=3, z=1/3, w=1, alpha="b"),
  list(x=5, y=4, z=1/4, w=1, alpha="c"),
  list(x=5, y=2, z=1/5, w=0, alpha="d")
)

cl <- makeCluster(4)
clusterExport(cl, "foo")
clusterExport(cl, "params")
cores <- seq_along(cl)
r <- clusterApply(cl[cores], cores, function(core) {
  foo(params[[core]])
})
stopCluster(cl)

do.call(rbind.data.frame, r)


Hope this helps,

Rui Barradas




   1.

I am using RSelenium to scrape a website. Javascript has a document.ready 
function which ensures that any JS code is run only after the whole document is

   *

loaded. Is there a similar function in RSelenium? Or will the execution of the 
next expression takes place only after the whole page is loaded (with the

   *

"navigate" method of RSelenium)?

Thanking you,

Yours sincerely,

AKSHAY M KULKARNI




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

2021-12-01 Thread Jim Lemon
Hi mehdi,
Try this (first example in the help page):

ref<-rnorm(30,sd=2)
 # add a little noise
 model1<-ref+rnorm(30)/2
 # add more noise
 model2<-ref+rnorm(30)
 # display the diagram with the better model
 oldpar<-taylor.diagram(ref,model1)
 # now add the worse model
 taylor.diagram(ref,model2,add=TRUE,col="blue")
 # get approximate legend position
 lpos<-1.5*sd(ref)
 # add a legend
 legend(lpos,lpos,legend=c("Better","Worse"),pch=19,col=c("red","blue"))
 # now restore par values
 par(oldpar)

What you have done is to leave out the "reference" model (ref), so
that the second argument is missing.

Jim

On Wed, Dec 1, 2021 at 7:29 PM mehdi ghasemi  wrote:
>
> Hi Dr
>
> If we want to draw two plots only in a Taylor diagram ,What  the  attached  
> code should be modified ?
> 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.


Re: [R] Help needed to understand an error message produced from furrr and future packages

2021-11-25 Thread Jeff Newmiller
This question is off-topic here (see the Posting Guide, you are asking about a 
contributed package). Like walking down the street and asking this question, 
someone might know about it, but most will be puzzled.

You should know that multicore is quite sensitive to which kinds of operations 
you put into the worker threads, and you may be lucky that it returned an error 
because it can easily return an invalid result with no error. Getting reliable 
results with it is a bit of an art and may require detailed knowledge about 
your OS to avoid trouble with it. I don't claim such knowledge... good luck.

On November 25, 2021 4:19:09 AM PST, Hiroto Miyoshi  
wrote:
>Dear R-users
>
>I need help to understand the error message from furrr function.
>I am trying to build a parallel compute system which combines two
>desktop computers, one of which is a host computer, and runs ubuntu
>over wsl2, and the other is a slave, which runs ubuntu. as its OS.
>They are mutually connected on LAN.
>
>The host computer has 8 physical cores (16 logical cores), and the
>slave has 4 physical cores(8 logical cores).
>
>I wrote a code chunk, which is;
>
> > nodes<-c(rep("localhost",7),rep("192.168.1.11",4))
> > plan(list(tweak(cluster, workers = nodes),tweak(multicore,workers=2)))
> > system.time(VCtransfrm("typeIII"))
>
>in which VCtransfrm() is the target function, in which future_pmap and 
>future_map
>are being called tporogically.   The variable "typeIII" shows the file 
>which is sent to
>the VCtransfrm function. the typeIII file is the largest and has 165MB 
>of data while
>a typeII file is smaller and has only 7 MB of data.
>
>The chunk runs just fine when the typeII data is fed.  However, when the 
>typeIII data
>was fed, it gave the following error messages  and returned to the R 
>prompt.  Oddly,
>multiple R sessions were still running under the host computers when I 
>obsered its
>behaviour by the top command of ubuntu.  The error messages are:
>
>Error in unserialize(node$con) :
>   ClusterFuture () failed to receive results from cluster 
>RichSOCKnode #10 (PID 47955 on localhost ‘localhost’). The reason 
>reported was ‘error reading from connection’. Post-mortem diagnostic: No 
>process exists with this PID, i.e. the localhost worker is no longer 
>alive. Detected a non-exportable reference (‘externalptr’) in one of the 
>globals (‘...furrr_fn’ of class ‘function’) used in the future 
>expression. The total size of the 8 globals exported is 3.77 MiB. The 
>three largest globals are ‘...furrr_chunk_args’ (3.30 MiB of class 
>‘list’), ‘...furrr_fn’ (456.55 KiB of class ‘function’) and 
>‘...furrr_map_fn’ (11.91 KiB of class ‘function’)
>Timing stopped at: 2.285 4.291 37.53
>
>I hastily add that the part of "multicore" in the chunk is changed to 
>"multisession",
>the chunk runs without a problem even when the typeIII file is fed.
>
>I need to understand what this messages mean and how to fix this 
>problem.Since
>the chunk runs just fine for the smaller data, I reasoned that the 
>problem could not
>be a logical matter of the code.
>
>Please direct me to the solution of the problem.
>Any suggestion will be greatly appreciated.
>
>Sincerely,
>
>Hiroto
>
>__
>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.


Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Stephen Hartley
I haven't been able to get remote desktop working, I suspect it's disabled
for security reasons.

Any other thoughts/suggestions?

On Thu, Nov 18, 2021 at 2:22 AM Mark Fowler 
wrote:

> Hi,
>
>
>
> This issue bears some similarity to a problem I’ve been experiencing over
> the last few days. R 4.0.3, Windows 10, RGui. My ability to adjust window
> dimensions took a serious slide (cursor on edge or corner, click and tug).
> Usually only works now if I pause for awhile after the click before moving
> the cursor, while it used to work immediately every time. Similarly my
> ability to select text with a scroll became more difficult, but
> shift-clicking works fine. I just assumed my mouse was succumbing to age
> (still think that likeliest), or possibly related to the last Windows
> update a few days back (coincidental timing). So I doubt this is pertinent
> but thought I should mention it just in case.
>
>
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows
>
>
>
> *From: *Eric Berger 
> *Sent: *Wednesday, November 17, 2021 1:04 PM
> *To: *Stephen Hartley 
> *Cc: *r-help@r-project.org
> *Subject: *Re: [R] Help with strange RGui behavior? Will not consistently
> run source.
>
>
>
> Hi Stephen,
> Does the problem still occur if you connect remotely to your computer from
> a different computer?
> e.g. via remote desktop?
>
>
> On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley <
> stephen.hartley@gmail.com> wrote:
>
> > So I've got an odd problem that I can't seem to nail down, and I'm not
> > totally sure even where I should go to ask about it. Hopefully this
> mailing
> > list is acceptable, and please do let me know if not.
> >
> > I'm using the "Rgui.exe" interface for R in windows 10. I've used this
> for
> > more than a decade now with no problems, and for at least a year on this
> > computer specifically. But now, when I click "Run line or selection" or
> > equivalently use CTRL+R, it only sometimes runs the selection.
> > Specifically: the FIRST time I attempt to run any given selection, it
> >
> > This issue only appears when I drag to select a snippet of text. It works
> > fine when I simply click on a line without selecting it. However, if I
> drag
> > and select a region of code and hit the command, the selection stops
> being
> > selected but it does not run the code. If I then drag and select the
> exact
> > same code a second time and do it again, it runs normally. If instead of
> > running the same code again I attempt to select different code, it once
> > again does not run.
> >
> > Here's the really odd bit: this affects multiple installations of R. I
> have
> > multiple versions of R installed on my machine for testing purposes (R
> > 3.4.4, 3.6.1, and 4.1.2), and this issue suddenly appeared simultaneously
> > on all three.
> >
> > I've tested it hundreds of times in various situations on all three
> > installations and it is extremely consistent but utterly unreproducible.
> I
> > have a second computer with R installed that works normally, and I have
> > tried doing the exact same thing on that computer and it behaves as
> > expected.
> >
> > It's not a hotkey capture issue or a hardware since it doesn't matter if
> I
> > use the hotkey or use the right-click menu. So far as I can tell nothing
> > else has changed. Are there hidden options in Rgui, or is there like an
> > Rprofile file or something somewhere that all the R installations will
> run
> > on startup? Are there R commands that alter options in the gui itself?
> >
> > I'm not even sure who I should contact or what list I should use, since
> > this isn't really an issue with the R programming language itself but
> > rather an issue with the GUI. The issue doesn't involve any keywords
> that I
> > can think of to search for others with the same issue ("run R on
> selection"
> > appears a lot in unrelated pages).
> >
> > Best,
> > Steve Hartley
> > Staff scientist, National Cancer Institute
> >
> > [[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

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Eric Berger
HI Stephen,
The reason I suggested the test was that I had a real flakey and
annoying GUI problem a couple of years ago.
It had to do with selection by mouse etc. The IT group could not
reproduce the problem (when they connected remotely) and I realized
that when I worked from home I also avoided the problem.
By fluke I found that when the problem arose I could "fix it"
(temporarily) by disconnecting/reconnecting my USB keyboard. My point
is that the problem was some weird interaction between hardware and
software. Eventually the problem more or less disappeared with some
updated version of Windows 10. (I was somewhat relieved to find that a
lot of people were complaining of the same symptoms, but no one could
provide a fix that worked for me.)

Good luck!


On Thu, Nov 18, 2021 at 6:45 PM Stephen Hartley
 wrote:
>
> I haven't been able to get remote desktop working, I suspect it's disabled 
> for security reasons.
>
> Any other thoughts/suggestions?
>
> On Thu, Nov 18, 2021 at 2:22 AM Mark Fowler  wrote:
>>
>> Hi,
>>
>>
>>
>> This issue bears some similarity to a problem I’ve been experiencing over 
>> the last few days. R 4.0.3, Windows 10, RGui. My ability to adjust window 
>> dimensions took a serious slide (cursor on edge or corner, click and tug). 
>> Usually only works now if I pause for awhile after the click before moving 
>> the cursor, while it used to work immediately every time. Similarly my 
>> ability to select text with a scroll became more difficult, but 
>> shift-clicking works fine. I just assumed my mouse was succumbing to age 
>> (still think that likeliest), or possibly related to the last Windows update 
>> a few days back (coincidental timing). So I doubt this is pertinent but 
>> thought I should mention it just in case.
>>
>>
>>
>> Sent from Mail for Windows
>>
>>
>>
>> From: Eric Berger
>> Sent: Wednesday, November 17, 2021 1:04 PM
>> To: Stephen Hartley
>> Cc: r-help@r-project.org
>> Subject: Re: [R] Help with strange RGui behavior? Will not consistently run 
>> source.
>>
>>
>>
>> Hi Stephen,
>> Does the problem still occur if you connect remotely to your computer from
>> a different computer?
>> e.g. via remote desktop?
>>
>>
>> On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley <
>> stephen.hartley@gmail.com> wrote:
>>
>> > So I've got an odd problem that I can't seem to nail down, and I'm not
>> > totally sure even where I should go to ask about it. Hopefully this mailing
>> > list is acceptable, and please do let me know if not.
>> >
>> > I'm using the "Rgui.exe" interface for R in windows 10. I've used this for
>> > more than a decade now with no problems, and for at least a year on this
>> > computer specifically. But now, when I click "Run line or selection" or
>> > equivalently use CTRL+R, it only sometimes runs the selection.
>> > Specifically: the FIRST time I attempt to run any given selection, it
>> >
>> > This issue only appears when I drag to select a snippet of text. It works
>> > fine when I simply click on a line without selecting it. However, if I drag
>> > and select a region of code and hit the command, the selection stops being
>> > selected but it does not run the code. If I then drag and select the exact
>> > same code a second time and do it again, it runs normally. If instead of
>> > running the same code again I attempt to select different code, it once
>> > again does not run.
>> >
>> > Here's the really odd bit: this affects multiple installations of R. I have
>> > multiple versions of R installed on my machine for testing purposes (R
>> > 3.4.4, 3.6.1, and 4.1.2), and this issue suddenly appeared simultaneously
>> > on all three.
>> >
>> > I've tested it hundreds of times in various situations on all three
>> > installations and it is extremely consistent but utterly unreproducible. I
>> > have a second computer with R installed that works normally, and I have
>> > tried doing the exact same thing on that computer and it behaves as
>> > expected.
>> >
>> > It's not a hotkey capture issue or a hardware since it doesn't matter if I
>> > use the hotkey or use the right-click menu. So far as I can tell nothing
>> > else has changed. Are there hidden options in Rgui, or is there like an
>> > Rprofile file or something somewhere that all the R installations will run
>> > on startup? Are there R commands that

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Stephen Hartley
I have not tried that. I'm not certain if I have the permissions for remote
desktop, but I will find out and give it a shot if possible.

On Wed, Nov 17, 2021, 12:04 PM Eric Berger  wrote:

> Hi Stephen,
> Does the problem still occur if you connect remotely to your computer from
> a different computer?
> e.g. via remote desktop?
>
>
> On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley <
> stephen.hartley@gmail.com> wrote:
>
>> So I've got an odd problem that I can't seem to nail down, and I'm not
>> totally sure even where I should go to ask about it. Hopefully this
>> mailing
>> list is acceptable, and please do let me know if not.
>>
>> I'm using the "Rgui.exe" interface for R in windows 10. I've used this for
>> more than a decade now with no problems, and for at least a year on this
>> computer specifically. But now, when I click "Run line or selection" or
>> equivalently use CTRL+R, it only sometimes runs the selection.
>> Specifically: the FIRST time I attempt to run any given selection, it
>>
>> This issue only appears when I drag to select a snippet of text. It works
>> fine when I simply click on a line without selecting it. However, if I
>> drag
>> and select a region of code and hit the command, the selection stops being
>> selected but it does not run the code. If I then drag and select the exact
>> same code a second time and do it again, it runs normally. If instead of
>> running the same code again I attempt to select different code, it once
>> again does not run.
>>
>> Here's the really odd bit: this affects multiple installations of R. I
>> have
>> multiple versions of R installed on my machine for testing purposes (R
>> 3.4.4, 3.6.1, and 4.1.2), and this issue suddenly appeared simultaneously
>> on all three.
>>
>> I've tested it hundreds of times in various situations on all three
>> installations and it is extremely consistent but utterly unreproducible. I
>> have a second computer with R installed that works normally, and I have
>> tried doing the exact same thing on that computer and it behaves as
>> expected.
>>
>> It's not a hotkey capture issue or a hardware since it doesn't matter if I
>> use the hotkey or use the right-click menu. So far as I can tell nothing
>> else has changed. Are there hidden options in Rgui, or is there like an
>> Rprofile file or something somewhere that all the R installations will run
>> on startup? Are there R commands that alter options in the gui itself?
>>
>> I'm not even sure who I should contact or what list I should use, since
>> this isn't really an issue with the R programming language itself but
>> rather an issue with the GUI. The issue doesn't involve any keywords that
>> I
>> can think of to search for others with the same issue ("run R on
>> selection"
>> appears a lot in unrelated pages).
>>
>> Best,
>> Steve Hartley
>> Staff scientist, National Cancer Institute
>>
>> [[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] Help with strange RGui behavior? Will not consistently run source.

2021-11-17 Thread Mark Fowler
Hi,

This issue bears some similarity to a problem I�ve been experiencing over the 
last few days. R 4.0.3, Windows 10, RGui. My ability to adjust window 
dimensions took a serious slide (cursor on edge or corner, click and tug). 
Usually only works now if I pause for awhile after the click before moving the 
cursor, while it used to work immediately every time. Similarly my ability to 
select text with a scroll became more difficult, but shift-clicking works fine. 
I just assumed my mouse was succumbing to age (still think that likeliest), or 
possibly related to the last Windows update a few days back (coincidental 
timing). So I doubt this is pertinent but thought I should mention it just in 
case.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Eric Berger<mailto:ericjber...@gmail.com>
Sent: Wednesday, November 17, 2021 1:04 PM
To: Stephen Hartley<mailto:stephen.hartley@gmail.com>
Cc: r-help@r-project.org<mailto:r-help@r-project.org>
Subject: Re: [R] Help with strange RGui behavior? Will not consistently run 
source.

Hi Stephen,
Does the problem still occur if you connect remotely to your computer from
a different computer?
e.g. via remote desktop?


On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley <
stephen.hartley@gmail.com> wrote:

> So I've got an odd problem that I can't seem to nail down, and I'm not
> totally sure even where I should go to ask about it. Hopefully this mailing
> list is acceptable, and please do let me know if not.
>
> I'm using the "Rgui.exe" interface for R in windows 10. I've used this for
> more than a decade now with no problems, and for at least a year on this
> computer specifically. But now, when I click "Run line or selection" or
> equivalently use CTRL+R, it only sometimes runs the selection.
> Specifically: the FIRST time I attempt to run any given selection, it
>
> This issue only appears when I drag to select a snippet of text. It works
> fine when I simply click on a line without selecting it. However, if I drag
> and select a region of code and hit the command, the selection stops being
> selected but it does not run the code. If I then drag and select the exact
> same code a second time and do it again, it runs normally. If instead of
> running the same code again I attempt to select different code, it once
> again does not run.
>
> Here's the really odd bit: this affects multiple installations of R. I have
> multiple versions of R installed on my machine for testing purposes (R
> 3.4.4, 3.6.1, and 4.1.2), and this issue suddenly appeared simultaneously
> on all three.
>
> I've tested it hundreds of times in various situations on all three
> installations and it is extremely consistent but utterly unreproducible. I
> have a second computer with R installed that works normally, and I have
> tried doing the exact same thing on that computer and it behaves as
> expected.
>
> It's not a hotkey capture issue or a hardware since it doesn't matter if I
> use the hotkey or use the right-click menu. So far as I can tell nothing
> else has changed. Are there hidden options in Rgui, or is there like an
> Rprofile file or something somewhere that all the R installations will run
> on startup? Are there R commands that alter options in the gui itself?
>
> I'm not even sure who I should contact or what list I should use, since
> this isn't really an issue with the R programming language itself but
> rather an issue with the GUI. The issue doesn't involve any keywords that I
> can think of to search for others with the same issue ("run R on selection"
> appears a lot in unrelated pages).
>
> Best,
> Steve Hartley
> Staff scientist, National Cancer Institute
>
> [[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.


[[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] Help with strange RGui behavior? Will not consistently run source.

2021-11-17 Thread Eric Berger
Hi Stephen,
Does the problem still occur if you connect remotely to your computer from
a different computer?
e.g. via remote desktop?


On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley <
stephen.hartley@gmail.com> wrote:

> So I've got an odd problem that I can't seem to nail down, and I'm not
> totally sure even where I should go to ask about it. Hopefully this mailing
> list is acceptable, and please do let me know if not.
>
> I'm using the "Rgui.exe" interface for R in windows 10. I've used this for
> more than a decade now with no problems, and for at least a year on this
> computer specifically. But now, when I click "Run line or selection" or
> equivalently use CTRL+R, it only sometimes runs the selection.
> Specifically: the FIRST time I attempt to run any given selection, it
>
> This issue only appears when I drag to select a snippet of text. It works
> fine when I simply click on a line without selecting it. However, if I drag
> and select a region of code and hit the command, the selection stops being
> selected but it does not run the code. If I then drag and select the exact
> same code a second time and do it again, it runs normally. If instead of
> running the same code again I attempt to select different code, it once
> again does not run.
>
> Here's the really odd bit: this affects multiple installations of R. I have
> multiple versions of R installed on my machine for testing purposes (R
> 3.4.4, 3.6.1, and 4.1.2), and this issue suddenly appeared simultaneously
> on all three.
>
> I've tested it hundreds of times in various situations on all three
> installations and it is extremely consistent but utterly unreproducible. I
> have a second computer with R installed that works normally, and I have
> tried doing the exact same thing on that computer and it behaves as
> expected.
>
> It's not a hotkey capture issue or a hardware since it doesn't matter if I
> use the hotkey or use the right-click menu. So far as I can tell nothing
> else has changed. Are there hidden options in Rgui, or is there like an
> Rprofile file or something somewhere that all the R installations will run
> on startup? Are there R commands that alter options in the gui itself?
>
> I'm not even sure who I should contact or what list I should use, since
> this isn't really an issue with the R programming language itself but
> rather an issue with the GUI. The issue doesn't involve any keywords that I
> can think of to search for others with the same issue ("run R on selection"
> appears a lot in unrelated pages).
>
> Best,
> Steve Hartley
> Staff scientist, National Cancer Institute
>
> [[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] Help needed with data visualization in R

2021-11-01 Thread Jim Lemon
Hi bharat,
There are a number of ways to do this in R. One is:

library(plotrix)
example(size_n_color)

Jim

On Tue, Nov 2, 2021 at 6:43 AM bharat rawlley via R-help
 wrote:
>
>  Thank you very much, for your time and response!
> This did resolve my issue and I apologize if the question was a little too 
> straightforward - I did try to create bubble plots in excel but that did not 
> work, hence, I asked here since it is more of a diagram and less of a plot. 
> Thank you very much for your time and help!
> On Monday, 1 November, 2021, 09:47:29 pm IST, Bert Gunter 
>  wrote:
>
>  ... a simple web search on "bubble plots R" (what else?) would have brought 
> up many relevant hits. One should always try such obvious "homework" before 
> posting here. Better and quicker info often results.
>
> 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 Mon, Nov 1, 2021 at 8:15 AM Eric Berger  wrote:
>
> I have no experience with this but I did a search and found the following
> which looks close to what you are looking for
>
> https://stackoverflow.com/questions/69755844/is-it-possible-to-draw-the-following-diagram-in-r
>
>
>
> On Mon, Nov 1, 2021 at 5:06 PM bharat rawlley via R-help <
> r-help@r-project.org> wrote:
>
> > Hello,
> >
> > I wanted to ask if it is possible to have a data visualization of the
> > following kind in R?
> > It is not exactly a graph; a series of bubbles that have an area
> > corresponding to the percentage inside it arranged in a row.
> > Thank you!
> > __
> > 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.
>
>
> [[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] Help needed with data visualization in R

2021-11-01 Thread bharat rawlley via R-help
 Thank you very much, for your time and response! 
This did resolve my issue and I apologize if the question was a little too 
straightforward - I did try to create bubble plots in excel but that did not 
work, hence, I asked here since it is more of a diagram and less of a plot. 
Thank you very much for your time and help! 
On Monday, 1 November, 2021, 09:47:29 pm IST, Bert Gunter 
 wrote:  
 
 ... a simple web search on "bubble plots R" (what else?) would have brought up 
many relevant hits. One should always try such obvious "homework" before 
posting here. Better and quicker info often results.

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 Mon, Nov 1, 2021 at 8:15 AM Eric Berger  wrote:

I have no experience with this but I did a search and found the following
which looks close to what you are looking for

https://stackoverflow.com/questions/69755844/is-it-possible-to-draw-the-following-diagram-in-r



On Mon, Nov 1, 2021 at 5:06 PM bharat rawlley via R-help <
r-help@r-project.org> wrote:

> Hello,
>
> I wanted to ask if it is possible to have a data visualization of the
> following kind in R?
> It is not exactly a graph; a series of bubbles that have an area
> corresponding to the percentage inside it arranged in a row.
> Thank you!
> __
> 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.

  
[[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] Help needed with data visualization in R

2021-11-01 Thread Bert Gunter
... a simple web search on "bubble plots R" (what else?) would have brought
up many relevant hits. One should always try such obvious "homework" before
posting here. Better and quicker info often results.

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 Mon, Nov 1, 2021 at 8:15 AM Eric Berger  wrote:

> I have no experience with this but I did a search and found the following
> which looks close to what you are looking for
>
>
> https://stackoverflow.com/questions/69755844/is-it-possible-to-draw-the-following-diagram-in-r
>
>
>
> On Mon, Nov 1, 2021 at 5:06 PM bharat rawlley via R-help <
> r-help@r-project.org> wrote:
>
> > Hello,
> >
> > I wanted to ask if it is possible to have a data visualization of the
> > following kind in R?
> > It is not exactly a graph; a series of bubbles that have an area
> > corresponding to the percentage inside it arranged in a row.
> > Thank you!
> > __
> > 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.
>

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


  1   2   3   4   5   6   7   8   9   10   >