Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Rui Barradas

Hello,

Inline.

Às 22:44 de 29/04/20, Ana Marija escreveu:

Hi Rui,

thanks for getting back to me
so I tried your method and I got:

sum(b$PHENO==2, na.rm=T)

[1] 828

sum(b$PHENO==1, na.rm=T)

[1] 859

Can you please tell me if
b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L

just assigns PHENO=2 if b$FLASER == 2 | b$PLASER == 2 and everything else is 1?


Yes, that's it. If b$FLASER == 2 | b$PLASER == 2 returns TRUE then 
adding 1 will give


TRUE + 1 -> 1 + 1 -> 2

This is because logical values are internally coded as integers 0 and 1.
And if the condition returns FALSE it becomes

FALSE + 1 -> 0 + 1 -> 1

In both cases the result is what you want.




Please see how my data looks like:

sum(b$FLASER==2, na.rm=T)

[1] 92

sum(b$FLASER==1, na.rm=T)

[1] 1533

sum(b$PLASER==1, na.rm=T)

[1] 850

sum(b$PLASER==2, na.rm=T)

[1] 806

dim(b)

[1] 16985

unique(b$FLASER)

[1]  1  3  2 NA

unique(b$PLASER)

[1]  1  2  3 NA



What I write above is valid even if your data contains NA's, like it 
does. This is because


(TRUE | x) == (x | TRUE) == TRUE

even if x is NA.

This is an example with some NA values in the data.

set.seed(1234)
b <- rbind(b, b)
i <- sample(nrow(b), 3)
b$FLASER[i] <- NA
i <- sample(nrow(b), 2)
b$PLASER[i] <- NA
b$PLASER[10] <- 2

b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1
b


As you can see,

row 5:

b$FLASER is NA, b$PLASER == 2 evaluates to TRUE -> b$PHENO is TRUE

row 10:

b$FLASER == 2 evaluates to TRUE, b$PLASER is NA -> b$PHENO is TRUE


So the code is not broken by NA's

Hope this helps,

Rui Barradas


On Wed, Apr 29, 2020 at 4:10 PM Rui Barradas  wrote:


Hello,

Here is another way. The condition returns FALSE/TRUE or 0/1. Add 1 to
get the expected result.
It has the advantage of being faster.

b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L


Hope this helps,

Rui Barradas

Às 20:42 de 29/04/20, Ana Marija escreveu:

Thanks, I did this:
b$PHENO<- ifelse(b$FLASER ==2 | b$PLASER ==2, 2, 1)

On Wed, Apr 29, 2020 at 2:36 PM Ivan Krylov  wrote:


On Wed, 29 Apr 2020 14:19:18 -0500
Ana Marija  wrote:


My conditions for creating a new column PHENO would be this:

if FLASER or PLASER =2 then PHENO=2
otherwise PHENO=1


On Wed, 29 Apr 2020 15:30:45 -0400
"Patrick (Malone Quantitative)"  wrote:


If you don't mind using tidyverse, you can do this easily with
if_else.


...and if you want to stay with base R, you can use the ifelse
function.

--
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] Rtools required

2020-04-29 Thread Spencer Graves
  I just encountered something that looks exactly like that with R 
4.0.0 and the latest RStudio AND with Rtools40 installed under Windows 
10 (AND some manual adjustment of the path to delete references to old 
versions of Rtools and make sure Rtools40 was there).



  I got around it by have Rtools40 installed AND running 
"install.packages('xmlw')" inside R 4.0.0 inside a CMD prompt.  That 
worked, even though the same command inside RStudio failed with:



WARNING:  Rtools is required to build an R package but no version of 
Rtools compatible with the currently running version of R was found.  
Note that the following incompatible version(s) of Rtools were found:


  - Rtools 3.5 (installed at C:\Rtools).


  I got this message after deleting references to C:\Rtools from 
the path and rebooting.



*** I BELIEVE YOU NEED Rtools40 installed, because binaries for some 
packages are not (yet) available for R 4.0.0.



  Hope this helps.
  Spencer Graves


On 2020-04-29 21:02, Bert Gunter wrote:

Wouldn't packages that have to be built from source on installation
require Rtools?

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, Apr 29, 2020 at 6:48 PM Steven  wrote:

Thanks to all - very helpful. I search from c:\ and now find file
.Renviron located in C:\Users\USER\Documents. That does it.

I would like to pose an additional question, since it would also fall
under the same subject line. This is an RStudio question but since I am
using the free version the RStudio folks would not help me.

My students simply need to install packages and are not building any
packages so they have no reason to install Rtools.

When they install (not build) packages (from CRAN or file archive) they
received the same warning message saying

"Rtools required to build a package".

This is nonsense of course as they are, as I said, simply installing. I
tell them to user an older RStudio version, specifically 1.1.463 that's
free of that warning. Any idea?

Steven Yen

On 2020/4/30 上午 06:30, Fox, John wrote:

Dear Steven,

It's possible that Windows will hide .Renviron, but it's generally a good idea, in my opinion, in 
Folder Options > View to click "Show hidden files" and uncheck "hide 
extensions". Then .Renviron should show up (once you've created it).

Best,
   John


-Original Message-
From: Bert Gunter 
Sent: Wednesday, April 29, 2020 5:50 PM
To: Steven 
Cc: Fox, John ; R-help Mailing List 
Subject: Re: [R] Rtools required

Type
?.Renviron
?R.home
?"environment variables"

at the R prompt to get what I think should be the info you need (or at
least useful info).


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, Apr 29, 2020 at 2:37 PM Steven  wrote:

Thanks John. Where is file .Renviron located? It must be a hidden file.
I cannot find it.

On 2020/4/28 下午 08:29, Fox, John wrote:

Dear Steven,

Did you follow the instruction on the Rtools webpage to add

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

to your .Renviron file?

I hope this helps,
John

 -
 John Fox, Professor Emeritus
 McMaster University
 Hamilton, Ontario, Canada
 Web: http::/socserv.mcmaster.ca/jfox


On Apr 28, 2020, at 4:38 AM, Steven  wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to
now the new default folder c:\rtools40). While compiling a package
(binary) I received the follow marning message saying Rtools is
required. Any clues? Thanks.

Steven Yen

WARNING: Rtools is required to build R packages but is not
currently installed. Please download and install the appropriate
version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/


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

__
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] Rtools required

2020-04-29 Thread Bert Gunter
Wouldn't packages that have to be built from source on installation
require Rtools?

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, Apr 29, 2020 at 6:48 PM Steven  wrote:
>
> Thanks to all - very helpful. I search from c:\ and now find file
> .Renviron located in C:\Users\USER\Documents. That does it.
>
> I would like to pose an additional question, since it would also fall
> under the same subject line. This is an RStudio question but since I am
> using the free version the RStudio folks would not help me.
>
> My students simply need to install packages and are not building any
> packages so they have no reason to install Rtools.
>
> When they install (not build) packages (from CRAN or file archive) they
> received the same warning message saying
>
> "Rtools required to build a package".
>
> This is nonsense of course as they are, as I said, simply installing. I
> tell them to user an older RStudio version, specifically 1.1.463 that's
> free of that warning. Any idea?
>
> Steven Yen
>
> On 2020/4/30 上午 06:30, Fox, John wrote:
> > Dear Steven,
> >
> > It's possible that Windows will hide .Renviron, but it's generally a good 
> > idea, in my opinion, in Folder Options > View to click "Show hidden files" 
> > and uncheck "hide extensions". Then .Renviron should show up (once you've 
> > created it).
> >
> > Best,
> >   John
> >
> >> -Original Message-
> >> From: Bert Gunter 
> >> Sent: Wednesday, April 29, 2020 5:50 PM
> >> To: Steven 
> >> Cc: Fox, John ; R-help Mailing List  >> project.org>
> >> Subject: Re: [R] Rtools required
> >>
> >> Type
> >> ?.Renviron
> >> ?R.home
> >> ?"environment variables"
> >>
> >> at the R prompt to get what I think should be the info you need (or at
> >> least useful info).
> >>
> >>
> >> 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, Apr 29, 2020 at 2:37 PM Steven  wrote:
> >>> Thanks John. Where is file .Renviron located? It must be a hidden file.
> >>> I cannot find it.
> >>>
> >>> On 2020/4/28 下午 08:29, Fox, John wrote:
>  Dear Steven,
> 
>  Did you follow the instruction on the Rtools webpage to add
> 
> PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
> 
>  to your .Renviron file?
> 
>  I hope this helps,
> John
> 
>  -
>  John Fox, Professor Emeritus
>  McMaster University
>  Hamilton, Ontario, Canada
>  Web: http::/socserv.mcmaster.ca/jfox
> 
> > On Apr 28, 2020, at 4:38 AM, Steven  wrote:
> >
> > Dear All
> >
> > I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to
> > now the new default folder c:\rtools40). While compiling a package
> > (binary) I received the follow marning message saying Rtools is
> > required. Any clues? Thanks.
> >
> > Steven Yen
> >
> > WARNING: Rtools is required to build R packages but is not
> > currently installed. Please download and install the appropriate
> > version of Rtools before proceeding:
> > https://cran.rstudio.com/bin/windows/Rtools/
> >
> >
> >   [[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.
>

__
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] repository for ubuntu/linux mint for R 4.0.0

2020-04-29 Thread Rasmus Liland
On 2020-04-29 19:55 -0400, ProfJCNash wrote:
> In updating (an older computer with) Linux Mint 18.3 I tried to add
> the repository
> 
> deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran40/
> 
> as per the "Download R for Linux" instructions. This gave an error
> that there was no Release.key file.
> 
> After some investigation, I found that
> 
> deb https://cran.r-project.org/bin/linux/ubuntu xenial-cran40/
> 
> i.e., CRAN not CLOUD. With this change, I could install R 4.0.
> 
> Is this a known glitch?

Dear JN,

perhaps it is a glitch ... does anyone run mirmon[1] on the R 
mirrors to see which ones are old?

If you open those two addresses in a browser, you see that the 
xenial-cran40 folder is only present in cran case ...  These are 
two different servers, which can also be seen by running curl:

rasmus@twentyfive ~ % curl -I 
https://cloud.r-project.org/bin/linux/ubuntu/
HTTP/2 200 
content-type: text/html;charset=ISO-8859-1
date: Thu, 30 Apr 2020 00:05:13 GMT
server: Apache/2.4.39 (Unix)
cache-control: max-age=1800
expires: Thu, 30 Apr 2020 00:35:13 GMT
x-cache: Miss from cloudfront
...

rasmus@twentyfive ~ % curl -I 
https://cran.r-project.org/bin/linux/ubuntu/
HTTP/1.1 200 OK
Date: Thu, 30 Apr 2020 00:05:23 GMT
Server: Apache
Content-Type: text/html;charset=UTF-8

It is wise to point your package manager to a mirror[2] close to you 
instead of a cdn, e.g. [3] or something ... 

Best,
Rasmus

[1] https://spacehopper.org/mirmon/
[2] https://cran.r-project.org/mirrors.html
[3] https://mirror.las.iastate.edu/CRAN/bin/linux/ubuntu/

__
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] repository for ubuntu/linux mint for R 4.0.0

2020-04-29 Thread ProfJCNash
In updating (an older computer with) Linux Mint 18.3 I tried to add
the repository

deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran40/

as per the "Download R for Linux" instructions. This gave an error
that there was no Release.key file.

After some investigation, I found that

deb https://cran.r-project.org/bin/linux/ubuntu xenial-cran40/

i.e., CRAN not CLOUD. With this change, I could install R 4.0.

Is this a known glitch?

JN

__
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] Rtools required

2020-04-29 Thread Henrik Bengtsson
Careful so you don't overwrite an existing ~/.Renviron file; it's safer to
use something like:

cat('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"\n', file="~/.Renviron"
append=TRUE)

/Henrik




On Wed, Apr 29, 2020, 15:33 Fox, John  wrote:

> Dear Steven,
>
> It's possible that Windows will hide .Renviron, but it's generally a good
> idea, in my opinion, in Folder Options > View to click "Show hidden files"
> and uncheck "hide extensions". Then .Renviron should show up (once you've
> created it).
>
> Best,
>  John
>
> > -Original Message-
> > From: Bert Gunter 
> > Sent: Wednesday, April 29, 2020 5:50 PM
> > To: Steven 
> > Cc: Fox, John ; R-help Mailing List  > project.org>
> > Subject: Re: [R] Rtools required
> >
> > Type
> > ?.Renviron
> > ?R.home
> > ?"environment variables"
> >
> > at the R prompt to get what I think should be the info you need (or at
> > least useful info).
> >
> >
> > 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, Apr 29, 2020 at 2:37 PM Steven  wrote:
> > >
> > > Thanks John. Where is file .Renviron located? It must be a hidden file.
> > > I cannot find it.
> > >
> > > On 2020/4/28 下午 08:29, Fox, John wrote:
> > > > Dear Steven,
> > > >
> > > > Did you follow the instruction on the Rtools webpage to add
> > > >
> > > >   PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
> > > >
> > > > to your .Renviron file?
> > > >
> > > > I hope this helps,
> > > >   John
> > > >
> > > >-
> > > >John Fox, Professor Emeritus
> > > >McMaster University
> > > >Hamilton, Ontario, Canada
> > > >Web: http::/socserv.mcmaster.ca/jfox
> > > >
> > > >> On Apr 28, 2020, at 4:38 AM, Steven  wrote:
> > > >>
> > > >> Dear All
> > > >>
> > > >> I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to
> > > >> now the new default folder c:\rtools40). While compiling a package
> > > >> (binary) I received the follow marning message saying Rtools is
> > > >> required. Any clues? Thanks.
> > > >>
> > > >> Steven Yen
> > > >>
> > > >> WARNING: Rtools is required to build R packages but is not
> > > >> currently installed. Please download and install the appropriate
> > > >> version of Rtools before proceeding:
> > > >> https://cran.rstudio.com/bin/windows/Rtools/
> > > >>
> > > >>
> > > >>  [[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.
> __
> 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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Rolf Turner



On 30/04/20 12:28 am, Eric Leroy wrote:


Dear all, I am sorry to see all the reactions I provoked from a
newbie user. Anyway, thank you for the answer I think that the
pcf3est function responds to my question.
Indeed the spatstat is a very impressive library and I am very grateful to the 
the developers.


(1) Not to worry.  Certainly not your fault!

(2) I'm glad that the pcf3est() function was useful to you.

(3) Thank you for your kind words about spatstat.

(4) But *please* --- spatstat is a *package* not a "library"!!!  A 
library is a *collection* of packages; the library() function "checks 
out" a package from a library, like checking a book out of a "real" 
library (bibliothèque en français, just in case there is any confusion, 
"library" and "libraire" being false cognates).  But I'm sure you knew that.


I know that insisting on this distinction is being pedantic --- but it 
never hurts to get things right!  And saying "library" when you mean 
"package" upsets Martin Maechler!!! :-)


cheers,

Rolf

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
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] Rtools required

2020-04-29 Thread Fox, John
Dear Steven,

It's possible that Windows will hide .Renviron, but it's generally a good idea, 
in my opinion, in Folder Options > View to click "Show hidden files" and 
uncheck "hide extensions". Then .Renviron should show up (once you've created 
it).

Best,
 John

> -Original Message-
> From: Bert Gunter 
> Sent: Wednesday, April 29, 2020 5:50 PM
> To: Steven 
> Cc: Fox, John ; R-help Mailing List  project.org>
> Subject: Re: [R] Rtools required
> 
> Type
> ?.Renviron
> ?R.home
> ?"environment variables"
> 
> at the R prompt to get what I think should be the info you need (or at
> least useful info).
> 
> 
> 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, Apr 29, 2020 at 2:37 PM Steven  wrote:
> >
> > Thanks John. Where is file .Renviron located? It must be a hidden file.
> > I cannot find it.
> >
> > On 2020/4/28 下午 08:29, Fox, John wrote:
> > > Dear Steven,
> > >
> > > Did you follow the instruction on the Rtools webpage to add
> > >
> > >   PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
> > >
> > > to your .Renviron file?
> > >
> > > I hope this helps,
> > >   John
> > >
> > >-
> > >John Fox, Professor Emeritus
> > >McMaster University
> > >Hamilton, Ontario, Canada
> > >Web: http::/socserv.mcmaster.ca/jfox
> > >
> > >> On Apr 28, 2020, at 4:38 AM, Steven  wrote:
> > >>
> > >> Dear All
> > >>
> > >> I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to
> > >> now the new default folder c:\rtools40). While compiling a package
> > >> (binary) I received the follow marning message saying Rtools is
> > >> required. Any clues? Thanks.
> > >>
> > >> Steven Yen
> > >>
> > >> WARNING: Rtools is required to build R packages but is not
> > >> currently installed. Please download and install the appropriate
> > >> version of Rtools before proceeding:
> > >> https://cran.rstudio.com/bin/windows/Rtools/
> > >>
> > >>
> > >>  [[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.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Ana Marija
Thank you so much, numbers add up now!

On Wed, Apr 29, 2020 at 5:09 PM  wrote:
>
> While I've sent you a maths way to do it,
>
> I'd probably take this approach;
>
> # set b$pheno to 1 as default
>
> b$pheno <- 1
>
> # set the flaser
>
> b$pheno[b$flaser == 2] <- 2
>
> #set the plaser
>
> b$pheno[b$plaser == 2] <- 2
>
>
> On 29 Apr 2020 22:44, Ana Marija  wrote:
>
> Hi Rui,
>
> thanks for getting back to me
> so I tried your method and I got:
> > sum(b$PHENO==2, na.rm=T)
> [1] 828
> > sum(b$PHENO==1, na.rm=T)
> [1] 859
>
> Can you please tell me if
> b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L
>
> just assigns PHENO=2 if b$FLASER == 2 | b$PLASER == 2 and everything else is 
> 1?
>
> Please see how my data looks like:
> > sum(b$FLASER==2, na.rm=T)
> [1] 92
> > sum(b$FLASER==1, na.rm=T)
> [1] 1533
> > sum(b$PLASER==1, na.rm=T)
> [1] 850
> > sum(b$PLASER==2, na.rm=T)
> [1] 806
> > dim(b)
> [1] 16985
> > unique(b$FLASER)
> [1]  1  3  2 NA
> > unique(b$PLASER)
> [1]  1  2  3 NA
>
> On Wed, Apr 29, 2020 at 4:10 PM Rui Barradas  wrote:
> >
> > Hello,
> >
> > Here is another way. The condition returns FALSE/TRUE or 0/1. Add 1 to
> > get the expected result.
> > It has the advantage of being faster.
> >
> > b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L
> >
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> > Às 20:42 de 29/04/20, Ana Marija escreveu:
> > > Thanks, I did this:
> > > b$PHENO<- ifelse(b$FLASER ==2 | b$PLASER ==2, 2, 1)
> > >
> > > On Wed, Apr 29, 2020 at 2:36 PM Ivan Krylov  wrote:
> > >>
> > >> On Wed, 29 Apr 2020 14:19:18 -0500
> > >> Ana Marija  wrote:
> > >>
> > >>> My conditions for creating a new column PHENO would be this:
> > >>>
> > >>> if FLASER or PLASER =2 then PHENO=2
> > >>> otherwise PHENO=1
> > >>
> > >> On Wed, 29 Apr 2020 15:30:45 -0400
> > >> "Patrick (Malone Quantitative)"  wrote:
> > >>
> > >>> If you don't mind using tidyverse, you can do this easily with
> > >>> if_else.
> > >>
> > >> ...and if you want to stay with base R, you can use the ifelse
> > >> function.
> > >>
> > >> --
> > >> 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.
>
>

__
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] Designing a Fractional Factorial Design in R

2020-04-29 Thread Bert Gunter
https://CRAN.R-project.org/view=ExperimentalDesign

For many R experimental design packages. You might wish to bookmark
the CRAN task view page.

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, Apr 29, 2020 at 2:39 PM Rahul Chakraborty  wrote:
>
> Dear all,
>
> Presently I am working on designing a questionnaire for my discrete choice
> experiment. I intend to use R for the "fractional factorial design". I have
> the following objective-
>
> The respondent has to choose one out of 4 objects. Each of the 4 objects
> are classified by 5 different attributes. However, the levels are not the
> same under each of the objects. For example, the table below displays first
> three attributes and corresponding values of levels.
>
>Object1 Object2Object3
>Object4
> Attribute1   100  80, 100, 120120, 140, 160
> 120, 140, 160
> Attribute2100,80,120 100,80,60,40  80,60,40
> 75, 50, 25
> Atrribute3   100   100 100,75
>75, 50, 20, 10
>
> In this scenario, as you can see the number and values of levels for each
> attribute may vary across different objects. Given this scenario which
> package should I use to implement a fractional factorial design? Any help
> would be highly appreciated.
>
> Thanking you,
>
> -- Regards,
> Rahul Chakraborty
> Research Fellow
> National Institute of Public Finance and Policy
> New Delhi- 110067
>
> [[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] how to create a new column from two columns with conditions

2020-04-29 Thread Ana Marija
Hi Rui,

thanks for getting back to me
so I tried your method and I got:
> sum(b$PHENO==2, na.rm=T)
[1] 828
> sum(b$PHENO==1, na.rm=T)
[1] 859

Can you please tell me if
b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L

just assigns PHENO=2 if b$FLASER == 2 | b$PLASER == 2 and everything else is 1?

Please see how my data looks like:
> sum(b$FLASER==2, na.rm=T)
[1] 92
> sum(b$FLASER==1, na.rm=T)
[1] 1533
> sum(b$PLASER==1, na.rm=T)
[1] 850
> sum(b$PLASER==2, na.rm=T)
[1] 806
> dim(b)
[1] 16985
> unique(b$FLASER)
[1]  1  3  2 NA
> unique(b$PLASER)
[1]  1  2  3 NA

On Wed, Apr 29, 2020 at 4:10 PM Rui Barradas  wrote:
>
> Hello,
>
> Here is another way. The condition returns FALSE/TRUE or 0/1. Add 1 to
> get the expected result.
> It has the advantage of being faster.
>
> b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 20:42 de 29/04/20, Ana Marija escreveu:
> > Thanks, I did this:
> > b$PHENO<- ifelse(b$FLASER ==2 | b$PLASER ==2, 2, 1)
> >
> > On Wed, Apr 29, 2020 at 2:36 PM Ivan Krylov  wrote:
> >>
> >> On Wed, 29 Apr 2020 14:19:18 -0500
> >> Ana Marija  wrote:
> >>
> >>> My conditions for creating a new column PHENO would be this:
> >>>
> >>> if FLASER or PLASER =2 then PHENO=2
> >>> otherwise PHENO=1
> >>
> >> On Wed, 29 Apr 2020 15:30:45 -0400
> >> "Patrick (Malone Quantitative)"  wrote:
> >>
> >>> If you don't mind using tidyverse, you can do this easily with
> >>> if_else.
> >>
> >> ...and if you want to stay with base R, you can use the ifelse
> >> function.
> >>
> >> --
> >> 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] Rtools required

2020-04-29 Thread Bert Gunter
Type
?.Renviron
?R.home
?"environment variables"

at the R prompt to get what I think should be the info you need (or at
least useful info).


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, Apr 29, 2020 at 2:37 PM Steven  wrote:
>
> Thanks John. Where is file .Renviron located? It must be a hidden file.
> I cannot find it.
>
> On 2020/4/28 下午 08:29, Fox, John wrote:
> > Dear Steven,
> >
> > Did you follow the instruction on the Rtools webpage to add
> >
> >   PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
> >
> > to your .Renviron file?
> >
> > I hope this helps,
> >   John
> >
> >-
> >John Fox, Professor Emeritus
> >McMaster University
> >Hamilton, Ontario, Canada
> >Web: http::/socserv.mcmaster.ca/jfox
> >
> >> On Apr 28, 2020, at 4:38 AM, Steven  wrote:
> >>
> >> Dear All
> >>
> >> I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to now
> >> the new default folder c:\rtools40). While compiling a package (binary)
> >> I received the follow marning message saying Rtools is required. Any
> >> clues? Thanks.
> >>
> >> Steven Yen
> >>
> >> WARNING: Rtools is required to build R packages but is not currently
> >> installed. Please download and install the appropriate version of Rtools
> >> before proceeding: https://cran.rstudio.com/bin/windows/Rtools/
> >>
> >>
> >>  [[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.

__
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] [FORGED] what is the expected behavior of layout.show(n)

2020-04-29 Thread Yousri Fanous
Thank you

Yousri

On Wed, Apr 29, 2020 at 5:12 PM Paul Murrell 
wrote:

> Hi
>
> This behaviour is as expected.
>
> The layout.show() function is just there to help visualise what the
> layout will look like.
>
> So for testing purposes, you would do something like ...
>
> layout(...)
> layout.show(n)
>
> Then to actually use the layout, you would do something like ...
>
> layout(...)
> plot(...)
> plot(...)
> plot(...)
>
> Paul
>
> On 30/04/20 1:09 am, Yousri Fanous wrote:
> > This works as expected: Histograms 1-3 are displayed on the first row and
> > histograms 4 and 5 on the second row
> >
> > However when I use layout.show to check the layout , it appears that
> > layout.show(3) consumes the first 3 locations
> >
> >> layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0),2,6,byrow=T),respect=F)
> >> layout.show(3)
> >> hist(sample[,1],main="Hist for sample I",xlab="sample 1",ylab="freq")
> >> hist(sample[,2],main="Hist for sample II",xlab="sample 2",ylab="freq")
> >> hist(sample[,3],main="Hist for sample III",xlab="sample 3",ylab="freq")
> >> hist(sample[,4],main="Hist for sample IV",xlab="sample 4",ylab="freq")
> >> hist(sample[,5],main="Hist for sample V",xlab="sample 5",ylab="freq")
> > Now the first row shows 3 empty rectangles and histogram 1 and 2 are
> > displayed on row 2 while histograms 3-5 are displayed on the top row in a
> > different graph / page
> >
> > If I use layout.show(5) then each histogram is displayed on a separate
> > sheet as if the layout was fully consumed
> >
> > Few questions here:
> > 1) in case of layout.show(3) why the layout was still remembered /
> recycled
> > 2) with layout.show(5) why was the layout totally dismissed. I expected
> at
> > least it would restart over with 3 graphs in first row and 2 graphs in
> > second row to be consistent in behavior with layout.show(3)
> > 3) layout.show(x) purpose is to check if my layout is correct. It must
> not
> > leave any side effect on the main plots.
> >  From the help of function layout this line relates to layout.show
> >
> > layout.show(n) plots (part of) the current layout, namely the outlines of
> > the next n figures.
> >
> > It does not describe the behavior I am seeing
> >
> > 4) Finally is there a way to undo the effect of layout.show except
> re-enter
> > my layout again?
> >
> > Yousri
>
> --
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> p...@stat.auckland.ac.nz
> http://www.stat.auckland.ac.nz/~paul/
>

[[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] how to create a new column from two columns with conditions

2020-04-29 Thread Ege Rubak
Or if you prefer not to load an entire suite of packages to do such a
simple task you could use

b$PHENO <- ifelse(...)

or in this specific case it seems sufficient to do

b$PHENO <- pmax(b$FLASER, b$PLASER)

/Ege

On Wed, 2020-04-29 at 15:30 -0400, Patrick (Malone Quantitative) wrote:
> If you don't mind using tidyverse, you can do this easily with
> if_else.
> 
> b$PHENO<-if_else(...
> 
> 
> 
> On Wed, Apr 29, 2020 at 3:21 PM Ana Marija <
> sokovic.anamar...@gmail.com>
> wrote:
> 
> > Hello,
> > 
> > I have a data frame like this:
> > 
> > > head(b)
> > 
> >FID  IID FLASER PLASER
> > 1: fam1000 G1000  1  1
> > 2: fam1001 G1001  1  1
> > 3: fam1003 G1003  1  2
> > 4: fam1005 G1005  1  1
> > 5: fam1009 G1009  2  1
> > 6: fam1052 G1052  1  1
> > ...
> > 
> > My conditions for creating a new column PHENO would be this:
> > 
> > if FLASER or PLASER =2 then PHENO=2
> > otherwise PHENO=1
> > 
> > so result would look like this:
> > 
> > > head(b)
> > 
> >FID  IID FLASER PLASER PHENO
> > 1: fam1000 G1000  1  11
> > 2: fam1001 G1001  1  11
> > 3: fam1003 G1003  1  22
> > 4: fam1005 G1005  1  11
> > 5: fam1009 G1009  2  1 2
> > 6: fam1052 G1052  1  1 1
> > ...
> > 
> > Thanks
> > Ana
> > ...
> > 
> > __
> > 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.
> > 
> 
> 
-- 
Ege Rubak, Associate Professor,
Department of Mathematical Sciences, Aalborg University
Skjernvej 4A, 9220 Aalborg East, Denmark
Phone: (+45)99408861
Mobile: (+45)30230252
Email: ru...@math.aau.dk
__
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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Ege Rubak
Hi Abby,

Once again I must say your form of communication puzzles me. Do you
believe it benefits the open source community to communicate like this?
What about contacting the package maintainer in this way:

"Hi, I was helping someone else using your package to estimate a pair
correlation function. I was really puzzled that the generel help page
for `pcf` said it was a generic, but it doesn't seem to be generic for
the three dimensional case we needed, and no reference was given from
`pcf` to `pcf3est` which I had to search around to find. Maybe you
should consider throwing in a few cross references. Have a nice day."

I think this all would have played out much nicer then. None of us were
ignoring the original poster. We simply weren't aware of the OPs
problem until Rolf discovered it. I think Adrian and I focus on more
spatstat devoted channels to maximize the benefit of our time.

Regarding splitting the package into smaller pieces the thought has
occurred to us without your helpful suggestion. We started the process
of doing so years ago with the introduction of `spatstat.utils` and
`spatstat.data`. This is well documented on the spatstat GitHub page
referenced in the DESCRIPTION file. However, we have to prioritize our
time and it is quite a complex task to split out the relevant parts in
standalone packages due to all the interdependencies of the existing
code.

On a final note, to give you another example of a way to bring
attention to possible improvements of documentation: Let's say I was
looking at the function `marginal.set` in the package `probhat`, then I
would contact the author and say:

"Hi Abby, I was looking at the help for `marginal.set` and I couldn't
quite figure out what the argument constructor was supposed to be. The
help doesn't mention any class and contains no cross references
whatsoever and searching for 'constructor' in the R help system didn't
lead anywhere. Maybe a few cross references and actual usage of the
section 'See Also' would be beneficial for new users of your package.
It would be much better if instead of making assumptions about
assumptions you just use hyperlinks. Have a nice day. Kind regards,
Ege"

Where of course I would never use the sentence about hyperlinks in a
real example. I guess at this point I dug myself into the hole of bad
communication which is so killing for good software projects so
apologies for that. I do wish you a good day and hope you will consider
helping us all improve the state of open source software by
constructive suggestions rather than us claiming that each others
packages are unfit for CRAN.

Kind regards,
Ege

On Thu, 2020-04-30 at 06:53 +1200, Abby Spurdle wrote:
> NOTE CITATIONS USE BRIEF EXCERPTS
> 
> > It's a complaint that no-one responded to your query within 24
> > hours.
> 
> Correction, it wasn't my query.
> I was replying to someone else's query.
> 
> > Finally, you cast doubt on whether the function pcf3est actually
> > does calculate...
> 
> You've taken what I said out of context.
> As I said in my response to Rolf, I didn't run the code.
> 
> > email from CRAN requesting me to please cut down the size of the
> > spatstat package
> 
> I can't speak on behalf on CRAN.
> But reiterating what I said earlier, you'd be better to create
> smaller
> packages, each with a more specific focus.
> Each package could have an unofficial co-maintainer to help you out.
> 
> > You complain that the documentation is insufficient, but at the
> > same time, you complain that the manual is too long (> 1700 pages)
> > and you seem unwilling to search the documentation or follow cross-
> > references.
> 
> Did you read my posts...
> 
> The functions DO NOT cross-reference.
> The pcf generic/methods DO NOT reference the pcf3est function, at
> all.
> The pcf3est function DOES NOT reference the pp3 function, but rather
> references the class of the object.
> 
> Also, the seealso sections are minimalist.
> 
> If you are not going to create smaller packages, then the least you
> could do it improve the standard of the seealso sections and
> cross-referencing.
> 
> Furthermore, if functions are not cross-referenced, the reader (I
> this
> case me) doesn't necessarily know what package those functions are
> defined in.
> You assume that readers will assume the functions are defined in your
> package, and then do a search for them.
> 
> Instead of making assumptions about assumptions, just use
> hyperlinks...
> 
> > > I was somewhat disappointed ... not one (after approx 24 hours)
> > > had tried to
> > > help answer the OP's question.
> > 
> > Seriously?
> 
> Yes, seriously.
> From my experiences, if people don't reply to an R-help question in
> the first 24 hours, chances that they will reply later are low.
> Also, I've found a bias on this forum, with few replies to
> physics-related questions.
> 
> Personally, I like physicists, one of the most under-valued
> professions on the planet.
> 
> > I found the pcf function via Googling the subject.

[R] Designing a Fractional Factorial Design in R

2020-04-29 Thread Rahul Chakraborty
Dear all,

Presently I am working on designing a questionnaire for my discrete choice
experiment. I intend to use R for the "fractional factorial design". I have
the following objective-

The respondent has to choose one out of 4 objects. Each of the 4 objects
are classified by 5 different attributes. However, the levels are not the
same under each of the objects. For example, the table below displays first
three attributes and corresponding values of levels.

   Object1 Object2Object3
   Object4
Attribute1   100  80, 100, 120120, 140, 160
120, 140, 160
Attribute2100,80,120 100,80,60,40  80,60,40
75, 50, 25
Atrribute3   100   100 100,75
   75, 50, 20, 10

In this scenario, as you can see the number and values of levels for each
attribute may vary across different objects. Given this scenario which
package should I use to implement a fractional factorial design? Any help
would be highly appreciated.

Thanking you,

-- Regards,
Rahul Chakraborty
Research Fellow
National Institute of Public Finance and Policy
New Delhi- 110067

[[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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Ege Rubak
Dear all,

I see two issues here:

1. A new user has a hard time finding and using a specific function in
spatstat. As package authors we are always interested in such reports
and we then try to improve documentation, which is indeed a very
important part of any software project. The package is **very**
actively developed and documented by mainly Adrian and to a lesser
extend by Rolf and I. All the other people listed as
"authors"/"contributors" have contributed things such as a single new
function, a bug report, a documentation improvement, etc. Many of them
might not even be aware that they are mentioned on this list. This list
has developed over many years, and it is unfortunate if it gives the
impression that a lot of people are ready to help within 24 hours of a
question being posted on the general R help list because we cannot give
such guarantee -- you will have better luck with GitHub, the `spatstat`
tag on stackoverflow or the R SIG-GEO mail list, but still no 24 hour
guarantee is provided.

2. Abby replies in a very impolite tone towards the spatstat authors
and suggests that the package isn't fit for CRAN, which I consider a
direct insult to Adrian and all the hard work he has done to keep a
very well-documented package on CRAN since 2002. It would have been
nice to get a constructive suggestion on how to improve documentation
rather than a message about the alleged poor quality of the spatstat
package based on the documentation of a single function. If anyone
(Abby?) has spare time available for going through the documentation
and suggest improvements, add cross references etc. that's most
welcome. However, we would like to receive any suggestions in normal
polite manner via the project's GitHub page or by direct email to the
authors.

Regards,
Ege

On Wed, 2020-04-29 at 17:31 +1200, Abby Spurdle wrote:
> I should have noted that my comments weren't directed towards the
> main
> authors, but to all people listed in the description file, which is
> many, including some R core members.
> 
> Also, overall, I'm impressed by the effort here. It's just I strongly
> feel that good documentation is crucial (especially in open source),
> and I was somewhat disappointed that, given how many people are/were
> involved in this package, not one (after approx 24 hours) had tried
> to
> help answer the OP's question.
> 
> > > *If* it does what it claims ...
> > 
> > Why would you doubt that it does what it claims?
> 
> Because I didn't test it.
> 
> > Wouldn't the first thing that one would try be:
> >??"pp3"
> 
> No, because I was reading the PDF version of the documentation.
> 
> > Of course I'm biased, but IMHO spatstat is documented not only
> > "properly", but superbly well! :-)
> 
> I started reading the pcf function first.
> This function has the same problem, it doesn't clearly describe the
> function arguments.
> It doesn't say whether it applies to 2d, 3d or higher-dimensional
> data.
> After reading it, I had no idea whether the function could be applied
> to 3d data or not.
> 
> In my opinion this is not sufficient.
> Descriptions of function arguments and return values should be clear.
> 
> But here's a bigger problem.
> The documentation says the pcf function is a generic, but the pcf3est
> function isn't a method.
> And the pcf documentation (along with the three methods) don't
> reference the pcf3est function.
> 
> I found the pcf function via Googling the subject.
> But unless someone goes through a list of all the help topics,
> they're
> unlikely to find the pcf3est function.
-- 
Ege Rubak, Associate Professor,
Department of Mathematical Sciences, Aalborg University
Skjernvej 4A, 9220 Aalborg East, Denmark
Phone: (+45)99408861
Mobile: (+45)30230252
Email: ru...@math.aau.dk
__
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] Rtools required

2020-04-29 Thread Steven Yen
Thanks. Can you kindly tell me what to read to do it the "standard way"? 
Also, where can I find file .Renviron.


On 2020/4/28 下午 11:08, Duncan Murdoch wrote:

On 28/04/2020 11:02 a.m., Steven Yen wrote:

In RStudio, I enter File -> Open Project -> and browse to open a .Rproj
file. Then, I click Build -> Build Binary Package. Thanks.


Do it the standard way instead of using devtools.

Duncan Murdoch



On 2020/4/28 下午 10:55, Duncan Murdoch wrote:

On 28/04/2020 9:56 a.m., Steven Yen wrote:

Thanks. I visited the Rtools web page and learned to run the following
lines. I am still getting the same warning message.


And you are still not telling us what command you used to trigger that
message.

Duncan Murdoch



   > writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con =
"~/.Renviron")
   > Sys.which("make")
     make
"C:\\rtools40\\usr\\bin\\make.exe"

On 2020/4/28 下午 08:39, Duncan Murdoch wrote:

On 28/04/2020 5:57 a.m., Steven T. Yen wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 
(to now

the new default folder c:\rtools40). While compiling a package
(binary)
I received the follow marning message saying Rtools is required. Any
clues? Thanks.


Presumably you didn't put it on your path, or you used a non-standard
way to build.  You need to say what command you used.

Duncan Murdoch






__
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] Rtools required

2020-04-29 Thread Steven Yen
In RStudio, I enter File -> Open Project -> and browse to open a .Rproj 
file. Then, I click Build -> Build Binary Package. Thanks.


On 2020/4/28 下午 10:55, Duncan Murdoch wrote:

On 28/04/2020 9:56 a.m., Steven Yen wrote:

Thanks. I visited the Rtools web page and learned to run the following
lines. I am still getting the same warning message.


And you are still not telling us what command you used to trigger that 
message.


Duncan Murdoch



  > writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con =
"~/.Renviron")
  > Sys.which("make")
    make
"C:\\rtools40\\usr\\bin\\make.exe"

On 2020/4/28 下午 08:39, Duncan Murdoch wrote:

On 28/04/2020 5:57 a.m., Steven T. Yen wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to now
the new default folder c:\rtools40). While compiling a package 
(binary)

I received the follow marning message saying Rtools is required. Any
clues? Thanks.


Presumably you didn't put it on your path, or you used a non-standard
way to build.  You need to say what command you used.

Duncan Murdoch




__
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] Rtools required

2020-04-29 Thread Steven Yen

Thanks. Updating RStudio to 1.2.5042 did fix the problem. Thank you!

On 2020/4/28 下午 11:30, Duncan Murdoch wrote:

On 28/04/2020 11:16 a.m., Steven Yen wrote:

Thanks. Can you kindly tell me what to read to do it the "standard way"?


Start with ?INSTALL, and find more details in the Writing R Extensions 
manual.  I believe RStudio can be configured to use those tools rather 
than the devtools ones, but I don't know if it will still run its test 
for Rtools if you do it that way.


I imagine you can also update RStudio and all of your packages; 
eventually that will work, if this is really the issue.


Duncan Murdoch


Also, where can I find file .Renviron.

On 2020/4/28 下午 11:08, Duncan Murdoch wrote:

On 28/04/2020 11:02 a.m., Steven Yen wrote:
In RStudio, I enter File -> Open Project -> and browse to open a 
.Rproj

file. Then, I click Build -> Build Binary Package. Thanks.


Do it the standard way instead of using devtools.

Duncan Murdoch



On 2020/4/28 下午 10:55, Duncan Murdoch wrote:

On 28/04/2020 9:56 a.m., Steven Yen wrote:
Thanks. I visited the Rtools web page and learned to run the 
following

lines. I am still getting the same warning message.


And you are still not telling us what command you used to trigger 
that

message.

Duncan Murdoch



    > writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con =
"~/.Renviron")
    > Sys.which("make")
      make
"C:\\rtools40\\usr\\bin\\make.exe"

On 2020/4/28 下午 08:39, Duncan Murdoch wrote:

On 28/04/2020 5:57 a.m., Steven T. Yen wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0
(to now
the new default folder c:\rtools40). While compiling a package
(binary)
I received the follow marning message saying Rtools is 
required. Any

clues? Thanks.


Presumably you didn't put it on your path, or you used a 
non-standard

way to build.  You need to say what command you used.

Duncan Murdoch








__
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] Rtools required

2020-04-29 Thread Steven

Hello John,

Perhaps you can help me. I am an idiot. I visited the Rtools web page 
and learn to run the following lines in R: Still I am getting the same 
warning message.


> writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = 
"~/.Renviron")

> Sys.which("make")
  make
"C:\\rtools40\\usr\\bin\\make.exe"

On 2020/4/28 下午 08:29, Fox, John wrote:

Dear Steven,

Did you follow the instruction on the Rtools webpage to add

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

to your .Renviron file?

I hope this helps,
  John

   -
   John Fox, Professor Emeritus
   McMaster University
   Hamilton, Ontario, Canada
   Web: http::/socserv.mcmaster.ca/jfox


On Apr 28, 2020, at 4:38 AM, Steven  wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to now
the new default folder c:\rtools40). While compiling a package (binary)
I received the follow marning message saying Rtools is required. Any
clues? Thanks.

Steven Yen

WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
before proceeding: https://cran.rstudio.com/bin/windows/Rtools/


[[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] Rtools required

2020-04-29 Thread Steven
Thanks John. Where is file .Renviron located? It must be a hidden file. 
I cannot find it.


On 2020/4/28 下午 08:29, Fox, John wrote:

Dear Steven,

Did you follow the instruction on the Rtools webpage to add

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

to your .Renviron file?

I hope this helps,
  John

   -
   John Fox, Professor Emeritus
   McMaster University
   Hamilton, Ontario, Canada
   Web: http::/socserv.mcmaster.ca/jfox


On Apr 28, 2020, at 4:38 AM, Steven  wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to now
the new default folder c:\rtools40). While compiling a package (binary)
I received the follow marning message saying Rtools is required. Any
clues? Thanks.

Steven Yen

WARNING: Rtools is required to build R packages but is not currently
installed. Please download and install the appropriate version of Rtools
before proceeding: https://cran.rstudio.com/bin/windows/Rtools/


[[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] Rtools required

2020-04-29 Thread Steven Yen
Thanks. I visited the Rtools web page and learned to run the following 
lines. I am still getting the same warning message.


> writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = 
"~/.Renviron")

> Sys.which("make")
  make
"C:\\rtools40\\usr\\bin\\make.exe"

On 2020/4/28 下午 08:39, Duncan Murdoch wrote:

On 28/04/2020 5:57 a.m., Steven T. Yen wrote:

Dear All

I updated to R-4.0.0. and also installed the latest Rtools 4.0 (to now
the new default folder c:\rtools40). While compiling a package (binary)
I received the follow marning message saying Rtools is required. Any
clues? Thanks.


Presumably you didn't put it on your path, or you used a non-standard 
way to build.  You need to say what command you used.


Duncan Murdoch


__
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] [FORGED] what is the expected behavior of layout.show(n)

2020-04-29 Thread Paul Murrell

Hi

This behaviour is as expected.

The layout.show() function is just there to help visualise what the 
layout will look like.


So for testing purposes, you would do something like ...

layout(...)
layout.show(n)

Then to actually use the layout, you would do something like ...

layout(...)
plot(...)
plot(...)
plot(...)

Paul

On 30/04/20 1:09 am, Yousri Fanous wrote:

This works as expected: Histograms 1-3 are displayed on the first row and
histograms 4 and 5 on the second row

However when I use layout.show to check the layout , it appears that
layout.show(3) consumes the first 3 locations


layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0),2,6,byrow=T),respect=F)
layout.show(3)
hist(sample[,1],main="Hist for sample I",xlab="sample 1",ylab="freq")
hist(sample[,2],main="Hist for sample II",xlab="sample 2",ylab="freq")
hist(sample[,3],main="Hist for sample III",xlab="sample 3",ylab="freq")
hist(sample[,4],main="Hist for sample IV",xlab="sample 4",ylab="freq")
hist(sample[,5],main="Hist for sample V",xlab="sample 5",ylab="freq")

Now the first row shows 3 empty rectangles and histogram 1 and 2 are
displayed on row 2 while histograms 3-5 are displayed on the top row in a
different graph / page

If I use layout.show(5) then each histogram is displayed on a separate
sheet as if the layout was fully consumed

Few questions here:
1) in case of layout.show(3) why the layout was still remembered / recycled
2) with layout.show(5) why was the layout totally dismissed. I expected at
least it would restart over with 3 graphs in first row and 2 graphs in
second row to be consistent in behavior with layout.show(3)
3) layout.show(x) purpose is to check if my layout is correct. It must not
leave any side effect on the main plots.
 From the help of function layout this line relates to layout.show

layout.show(n) plots (part of) the current layout, namely the outlines of
the next n figures.

It does not describe the behavior I am seeing

4) Finally is there a way to undo the effect of layout.show except re-enter
my layout again?

Yousri


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Rui Barradas

Hello,

Here is another way. The condition returns FALSE/TRUE or 0/1. Add 1 to 
get the expected result.

It has the advantage of being faster.

b$PHENO <- (b$FLASER == 2 | b$PLASER == 2) + 1L


Hope this helps,

Rui Barradas

Às 20:42 de 29/04/20, Ana Marija escreveu:

Thanks, I did this:
b$PHENO<- ifelse(b$FLASER ==2 | b$PLASER ==2, 2, 1)

On Wed, Apr 29, 2020 at 2:36 PM Ivan Krylov  wrote:


On Wed, 29 Apr 2020 14:19:18 -0500
Ana Marija  wrote:


My conditions for creating a new column PHENO would be this:

if FLASER or PLASER =2 then PHENO=2
otherwise PHENO=1


On Wed, 29 Apr 2020 15:30:45 -0400
"Patrick (Malone Quantitative)"  wrote:


If you don't mind using tidyverse, you can do this easily with
if_else.


...and if you want to stay with base R, you can use the ifelse
function.

--
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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Abby Spurdle
> suggests that the package isn't fit for CRAN, which I consider a
> direct insult to Adrian and all the hard work he has done

This is my last post on this subject.

I just ran R check on the source package.
After 40 minutes, R check wasn't complete.

And I note the CRAN check results show the package was checked with:

Linux: --no-tests
Windows: --no-examples --no-tests --no-vignettes

I recognize that R-help isn't the right place for this discussion.
And perhaps the last line of my first post was unfair.

But the rest of my comments about the package are objective.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Ana Marija
Thanks, I did this:
b$PHENO<- ifelse(b$FLASER ==2 | b$PLASER ==2, 2, 1)

On Wed, Apr 29, 2020 at 2:36 PM Ivan Krylov  wrote:
>
> On Wed, 29 Apr 2020 14:19:18 -0500
> Ana Marija  wrote:
>
> > My conditions for creating a new column PHENO would be this:
> >
> > if FLASER or PLASER =2 then PHENO=2
> > otherwise PHENO=1
>
> On Wed, 29 Apr 2020 15:30:45 -0400
> "Patrick (Malone Quantitative)"  wrote:
>
> > If you don't mind using tidyverse, you can do this easily with
> > if_else.
>
> ...and if you want to stay with base R, you can use the ifelse
> function.
>
> --
> Best regards,
> Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Ivan Krylov
On Wed, 29 Apr 2020 14:19:18 -0500
Ana Marija  wrote:

> My conditions for creating a new column PHENO would be this:
> 
> if FLASER or PLASER =2 then PHENO=2
> otherwise PHENO=1

On Wed, 29 Apr 2020 15:30:45 -0400
"Patrick (Malone Quantitative)"  wrote:

> If you don't mind using tidyverse, you can do this easily with
> if_else.

...and if you want to stay with base R, you can use the ifelse
function.

-- 
Best regards,
Ivan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create a new column from two columns with conditions

2020-04-29 Thread Patrick (Malone Quantitative)
If you don't mind using tidyverse, you can do this easily with if_else.

b$PHENO<-if_else(...



On Wed, Apr 29, 2020 at 3:21 PM Ana Marija 
wrote:

> Hello,
>
> I have a data frame like this:
>
> > head(b)
>FID  IID FLASER PLASER
> 1: fam1000 G1000  1  1
> 2: fam1001 G1001  1  1
> 3: fam1003 G1003  1  2
> 4: fam1005 G1005  1  1
> 5: fam1009 G1009  2  1
> 6: fam1052 G1052  1  1
> ...
>
> My conditions for creating a new column PHENO would be this:
>
> if FLASER or PLASER =2 then PHENO=2
> otherwise PHENO=1
>
> so result would look like this:
>
> > head(b)
>FID  IID FLASER PLASER PHENO
> 1: fam1000 G1000  1  11
> 2: fam1001 G1001  1  11
> 3: fam1003 G1003  1  22
> 4: fam1005 G1005  1  11
> 5: fam1009 G1009  2  1 2
> 6: fam1052 G1052  1  1 1
> ...
>
> Thanks
> Ana
> ...
>
> __
> 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.
>


-- 
Patrick S. Malone, Ph.D., Malone Quantitative
NEW Service Models: http://malonequantitative.com

He/Him/His

[[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] how to create a new column from two columns with conditions

2020-04-29 Thread Ana Marija
Hello,

I have a data frame like this:

> head(b)
   FID  IID FLASER PLASER
1: fam1000 G1000  1  1
2: fam1001 G1001  1  1
3: fam1003 G1003  1  2
4: fam1005 G1005  1  1
5: fam1009 G1009  2  1
6: fam1052 G1052  1  1
...

My conditions for creating a new column PHENO would be this:

if FLASER or PLASER =2 then PHENO=2
otherwise PHENO=1

so result would look like this:

> head(b)
   FID  IID FLASER PLASER PHENO
1: fam1000 G1000  1  11
2: fam1001 G1001  1  11
3: fam1003 G1003  1  22
4: fam1005 G1005  1  11
5: fam1009 G1009  2  1 2
6: fam1052 G1052  1  1 1
...

Thanks
Ana
...

__
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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Abby Spurdle
NOTE CITATIONS USE BRIEF EXCERPTS

> It's a complaint that no-one responded to your query within 24 hours.

Correction, it wasn't my query.
I was replying to someone else's query.

> Finally, you cast doubt on whether the function pcf3est actually does 
> calculate...

You've taken what I said out of context.
As I said in my response to Rolf, I didn't run the code.

> email from CRAN requesting me to please cut down the size of the spatstat 
> package

I can't speak on behalf on CRAN.
But reiterating what I said earlier, you'd be better to create smaller
packages, each with a more specific focus.
Each package could have an unofficial co-maintainer to help you out.

> You complain that the documentation is insufficient, but at the same time, 
> you complain that the manual is too long (> 1700 pages) and you seem 
> unwilling to search the documentation or follow cross-references.

Did you read my posts...

The functions DO NOT cross-reference.
The pcf generic/methods DO NOT reference the pcf3est function, at all.
The pcf3est function DOES NOT reference the pp3 function, but rather
references the class of the object.

Also, the seealso sections are minimalist.

If you are not going to create smaller packages, then the least you
could do it improve the standard of the seealso sections and
cross-referencing.

Furthermore, if functions are not cross-referenced, the reader (I this
case me) doesn't necessarily know what package those functions are
defined in.
You assume that readers will assume the functions are defined in your
package, and then do a search for them.

Instead of making assumptions about assumptions, just use hyperlinks...

> > I was somewhat disappointed ... not one (after approx 24 hours) had tried to
> > help answer the OP's question.
> Seriously?

Yes, seriously.
>From my experiences, if people don't reply to an R-help question in
the first 24 hours, chances that they will reply later are low.
Also, I've found a bias on this forum, with few replies to
physics-related questions.

Personally, I like physicists, one of the most under-valued
professions on the planet.

> I found the pcf function via Googling the subject.
> I don't want to be rude, but this seems pretty lazy.

> Try Googling  'spatstat pair correlation function three dimensions'

That sounds like a contradiction.

Also, it's off the mark, given that I was the only one who attempted
to answer the OPs question.

__
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] upgrade from R 3.6.3 to 4.0.0

2020-04-29 Thread J C Nash
Did you update your software sources (/etc/apt/sources.list or entry in 
/etc/apt/sources.list.d)?

JN

On 2020-04-29 1:01 p.m., Carlos H. Mireles wrote:
> Hello everyone, I'm trying to upgrade R from 3.6.3 to 4.0.0 using the linux
> terminal commands (sudo apt upgrade r-base r-base-dev) but I get a message
> that says 3.6.3 is still the latest version. Please see the output below.
> How could I fix this?
> 
> Thanks much for your help!
> 
> Carlos
> 
> ==
> (base) carloshmireles@chm-hp:~$ sudo apt upgrade r-base r-base-dev
> [sudo] password for carloshmireles:
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> r-base-dev is already the newest version (3.6.3-1bionic).
> r-base is already the newest version (3.6.3-1bionic).
> Calculating upgrade... Done
> The following packages were automatically installed and are no longer
> required:
>   linux-headers-4.15.0-91 linux-headers-4.15.0-91-generic
> linux-image-4.15.0-91-generic linux-modules-4.15.0-91-generic
>   linux-modules-extra-4.15.0-91-generic
> Use 'sudo apt autoremove' to remove them.
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> (base) carloshmireles@chm-hp:~$
> 
>   [[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.


[R] upgrade from R 3.6.3 to 4.0.0

2020-04-29 Thread Carlos H. Mireles
Hello everyone, I'm trying to upgrade R from 3.6.3 to 4.0.0 using the linux
terminal commands (sudo apt upgrade r-base r-base-dev) but I get a message
that says 3.6.3 is still the latest version. Please see the output below.
How could I fix this?

Thanks much for your help!

Carlos

==
(base) carloshmireles@chm-hp:~$ sudo apt upgrade r-base r-base-dev
[sudo] password for carloshmireles:
Reading package lists... Done
Building dependency tree
Reading state information... Done
r-base-dev is already the newest version (3.6.3-1bionic).
r-base is already the newest version (3.6.3-1bionic).
Calculating upgrade... Done
The following packages were automatically installed and are no longer
required:
  linux-headers-4.15.0-91 linux-headers-4.15.0-91-generic
linux-image-4.15.0-91-generic linux-modules-4.15.0-91-generic
  linux-modules-extra-4.15.0-91-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(base) carloshmireles@chm-hp:~$

[[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] regular expression, stringr::str_view, grep

2020-04-29 Thread Andy Spada

This highlights the literal meaning of the last ] in your correct_brackets:

aff <- c("affgfk]ing", "fgok", "rafgkah]e","a fgk", "bafghk]")

To me, too, the missing_brackets looks more like what was desired, and
returns correct results for a PCRE. Perhaps the regular expression
should have been rewritten:

desired_brackets <- "af+g[^m$][^A-Z]"
grep(desired_brackets, aff, value = TRUE) ### correct result
str_view(aff, desired_brackets) ### correct result

Regards,
Andy


On 28.04.2020 18:41:50, David Winsemius wrote:


On 4/28/20 2:29 AM, Sigbert Klinke wrote:

Hi,

we gave students the task to construct a regular expression selecting
some texts. One send us back a program which gives different results
on stringr::str_view and grep.

The problem is "[^[A-Z]]" / "[^[A-Z]" at the end of the regular
expression. I would have expected that all four calls would give the
same result; interpreting [ and ] within [...] as the characters `[`
and `]`. Obviously this not the case and moreover stringr::str_view
and grep interpret the regular expressions differently.

Any ideas?

Thanks Sigbert

---

aff <- c("affgfking", "fgok", "rafgkahe","a fgk", "bafghk", "affgm",
 "baffgkit", "afffhk", "affgfking", "fgok", "rafgkahe", "afg.K",
 "bafghk", "aff gm", "baffg kit", "afffhgk")


TL;DR: different versions of regex character class syntax:




correct_brackets <- "af+g[^m$][^[A-Z]]"

To me that looks "incorrect" because of an unnecessary square-bracket.

missing_brackets <- "af+g[^m$][^[A-Z]"

And that one looks complete. To my mind it looks like the negation of
a character class with "[" and the range A-Z.


library("stringr")



I think this is the root of your problem. If you execute ?regex you
should be given a choice of two different help pages and if you go to
the one from pkg stringr it says in the Usage section:

regex
The default. Uses ICU regular expressions.

So that's probably different than the base regex convention which uses
TRE regular expressions.


You should carefully review:


help('stringi-search-charclass' , pac=stringi)

 I think you should also find the adding square brackets around ranges
is not needed in either type of regex syntax, but that stringi's regex
(unlike base R's TRE regex) does allow multiple disjoint ranges inside
the outer square brackets of a character class. I've never seen that
in base R regex. So I think that this base regex pattern,
grepl("([a-b]|[r-t])", letters) is the same as this stringi pattern: 
str_view( letters, "[[a-c][r-t]]").




__
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] R-help Digest, Vol 206, Issue 25

2020-04-29 Thread David Duffy
I don't think anyone responded last week.

> Using the mice package, I have created multiple imputed datasets to deal
> with missing data. I am looking for an example of the R code to use in
> order to analyze the set of imputed datasets using tetrachoric correlations
> in such a way that after pooling, I will have a combined tetrachoric
> covariance-variance matrix to use as input for an exploratory factor
> analysis.

Hi Ian.

The mice package requires you to have an appropriate method to extract the 
individual simulated datasets:

The ‘mira’ object is generated by the ‘with.mids()’...It may happen that you'll 
see the messages like ‘No method for tidying an S3 object of class ...’ or 
‘Error: No glance method for objects of class ...’. The royal way to solve this 
problem is to write your own ‘glance()’ and ‘tidy()’ methods and add these to 
‘broom’ according to the specifications given in
 https://broom.tidyverse.org/articles/adding-tidiers.html>.

eg
data(gllm::lsat)
idx <- rep(1:32, lsat$Freq)
lsat2 <- lsat[idx,-6]
idx <- cbind(sample(1:1000, size=50, replace=T), sample(1:5, size=50, 
replace=T))
lsat2[idx] <- NA
library(mice)
s1 <- mice(lsat2)
pool(with(s1, exp=polychor(A,B)))
Error: No glance method for objects of class numeric

 print(with(s1, exp=polychor(A,B)))
call :
with.mids(data = s1, expr = polychor(A, B))
call1 :
mice(data = lsat3)

nmis :
 A  B  C  D  E 
 9 11 13  7 10 

analyses :
[[1]]
[1] 0.1552523

[[2]]
[1] 0.1485645

[[3]]
[1] 0.1584301

[[4]]
[1] 0.1536678

[[5]]
[1] 0.1698725

You can see that "all" you have to do is take the mean of the A-B tetrachoric 
correlations from in this case, 5, replicates, to get your corrected 
correlation.

It happens that there is a ‘glance.lavaan’ routine, and lavaan has the lavCor() 
function to estimate tetrachoric correlations and
fit structural equation models. So you can probably fit your factor model 
directly and get correct statistical tests there.

Cheers, David Duffy.

__
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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Adrian Baddeley
I am the main author of spatstat, and the author of the code and documentation 
for pcf3est.

This is the first time in 25 years that I can remember anyone complaining about 
the documentation for the spatstat package.

The available documentation for spatstat includes:

 - welcome message on startup which explains where to find help
 - introductory vignette 'Getting Started in Spatstat'
 - quick reference guide (in the help file 'spatstat-package' , 
at the front of the full manual, and on website)
 - online help files (> 2000 help files)
 - package manual (> 1700 pages)
 - project website www.spatstat.org
 - book 'Spatial Point Patterns: Methodology and Applications 
with R' (>700 pages)
 - book companion website book.spatstat.org
 - technical descriptions in journal articles
 - ample explanatory comments in the source code

All of these sources (even the Description file) explain that spatstat is 
mainly focused on *two-dimensional* spatial point patterns but provides limited 
support for other kinds of data, including three-dimensional point patterns.

Three-dimensional point patterns are a relatively small subset of the current 
spatstat functionality
(covered in Section 15.3 pages 650-657 of the book, thus approximately 1% of 
the book).

The full manual PDF is searchable, has an index, and its internal 
cross-references are hyperlinks that can be followed.
Package manuals can also be accessed interactively in R through a web-like 
interface.
Package manuals are also available online with a web interface at some websites 
like rdrr.io

The help entry for 'pcf3est' says that the argument X must be a 
"three-dimensional point pattern (object of class 'pp3')". Most users would 
immediately look up 'pp3'. Apparently you were reading this from the full 
manual PDF and you say that you couldn't look up 'pp3'. The manual is 
searchable; you could have searched the PDF for keyword 'pp3', or jumped to the 
index, or the contents page. You could have looked at the first entry in the 
manual, which is the quick reference guide, which has a section on 
'Three-dimensional point patterns' which would have listed all the available 
functionality for three-dimensional point patterns. You could have searched for 
'three dimensional'.

> I was somewhat disappointed that, given how many people are/were
   > involved in this package, not one (after approx 24 hours) had tried to
   > help answer the OP's question.

That's not a complaint about the documentation. It's a complaint that no-one 
responded
to your query within 24 hours. Seriously? No-one is obliged to provide this 
level of service.
Twenty-four hours is a pretty short time scale for a response to a question 
that was not
addressed to anyone in particular. R-help is not a commonly used forum for 
asking questions about spatstat.
If you wanted a quick answer you could have emailed the package authors 
directly.

> I should have noted that my comments weren't directed towards the main
> authors, but to all people listed in the description file, which is
 > many, including some R core members.

The Description file says clearly that there are three main authors: Baddeley, 
Turner and Rubak with email addresses given.
The others are people who have contributed something at some time in the past.
I'm not sure what you hoped to achieve by addressing comments to a wider 
audience - most of whom are not listening on this frequency.

 > It's just I strongly feel that good documentation is crucial (especially in 
 > open source),

So do we; that's why we have put so much effort into documentation, including 
writing a whole book.

> I started reading the pcf function first.
> This function has the same problem, it doesn't clearly describe the function 
> arguments.
> It doesn't say whether it applies to 2d, 3d or higher-dimensional data.
> After reading it, I had no idea whether the function could be applied to 3d 
> data or not.
> In my opinion this is not sufficient.
> Descriptions of function arguments and return values should be clear.

pcf is generic.
The argument 'X' analysed in 'pcf(X)' could be any kind of spatial data.

The help file for a generic does not go into specific detail about 'X'; that is 
documented in the help files for the relevant methods.

The help file for the generic usually includes cross-references (under 'See 
Also') to some of the available methods.
Alternatively, to find out what classes of objects have a 'pcf' method, you can 
type 'methods(pcf)' in R with the package loaded. If you're reading a PDF, the 
methods will be listed consecutively in the file.

This would have revealed that there is a 'pcf.ppp' and a couple of other 
options.
The help for 'pcf.ppp' says that 'X' should be "a point pattern (object of 
class 'ppp')".
The help for 'ppp' or 'ppp.object' says that this class 

Re: [R] How can I solve an error after installing RStudio

2020-04-29 Thread Jeff Newmiller
Ah, no, this mailing list is about R, not RStudio. It is _possible_ that your 
problem could be with R because RStudio requires that R be installed, but you 
would need to explain how an error appears when you use RGui or R (from the 
command line) to separate any RStudio issues from R issues. If the error only 
appears when you use RStudio then you need to ask for help on their help forum.

On April 29, 2020 7:34:21 AM PDT, Vahid Borji  wrote:
>Hi there,
>
>I downloaded Rstudio and installed it on my laptop. When I want to open
>Rstudio I see the below message: The program can't start because
>api-ms-win-runtime-|1-1-0.dll is missing from your computer. Try
>reinstalling the program to fix this problem.
>
>Could you please help me how I can solve this error and work with
>RStudio?
>(I have R on my laptop and work with it without any problem.)
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fwd: How can I solve an error after installing RStudio

2020-04-29 Thread Bert Gunter
Neglected to cc. R-help


-- Forwarded message -
From: Bert Gunter 
Date: Wed, Apr 29, 2020 at 7:40 AM
Subject: Re: [R] How can I solve an error after installing RStudio
To: Vahid Borji 


No. You have to go to the RStudio website/help pages. RStudio is
separate software from R.

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, Apr 29, 2020 at 7:35 AM Vahid Borji  wrote:
>
> Hi there,
>
> I downloaded Rstudio and installed it on my laptop. When I want to open
> Rstudio I see the below message: The program can't start because
> api-ms-win-runtime-|1-1-0.dll is missing from your computer. Try
> reinstalling the program to fix this problem.
>
> Could you please help me how I can solve this error and work with RStudio?
> (I have R on my laptop and work with it without any problem.)
>
> [[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.


[R] How can I solve an error after installing RStudio

2020-04-29 Thread Vahid Borji
Hi there,

I downloaded Rstudio and installed it on my laptop. When I want to open
Rstudio I see the below message: The program can't start because
api-ms-win-runtime-|1-1-0.dll is missing from your computer. Try
reinstalling the program to fix this problem.

Could you please help me how I can solve this error and work with RStudio?
(I have R on my laptop and work with it without any problem.)

[[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] what is the expected behavior of layout.show(n)

2020-04-29 Thread Yousri Fanous
Hello

Load package: ACSWR
> data(sample)
> layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0),2,6,byrow=T),respect=F)
> hist(sample[,1],main="Hist for sample I",xlab="sample 1",ylab="freq")
> hist(sample[,2],main="Hist for sample II",xlab="sample 2",ylab="freq")
> hist(sample[,3],main="Hist for sample III",xlab="sample 3",ylab="freq")
> hist(sample[,4],main="Hist for sample IV",xlab="sample 4",ylab="freq")
> hist(sample[,5],main="Hist for sample V",xlab="sample 5",ylab="freq")

This works as expected: Histograms 1-3 are displayed on the first row and
histograms 4 and 5 on the second row

However when I use layout.show to check the layout , it appears that
layout.show(3) consumes the first 3 locations

> layout(matrix(c(1,1,2,2,3,3,0,4,4,5,5,0),2,6,byrow=T),respect=F)
> layout.show(3)
> hist(sample[,1],main="Hist for sample I",xlab="sample 1",ylab="freq")
> hist(sample[,2],main="Hist for sample II",xlab="sample 2",ylab="freq")
> hist(sample[,3],main="Hist for sample III",xlab="sample 3",ylab="freq")
> hist(sample[,4],main="Hist for sample IV",xlab="sample 4",ylab="freq")
> hist(sample[,5],main="Hist for sample V",xlab="sample 5",ylab="freq")

Now the first row shows 3 empty rectangles and histogram 1 and 2 are
displayed on row 2 while histograms 3-5 are displayed on the top row in a
different graph / page

If I use layout.show(5) then each histogram is displayed on a separate
sheet as if the layout was fully consumed

Few questions here:
1) in case of layout.show(3) why the layout was still remembered / recycled
2) with layout.show(5) why was the layout totally dismissed. I expected at
least it would restart over with 3 graphs in first row and 2 graphs in
second row to be consistent in behavior with layout.show(3)
3) layout.show(x) purpose is to check if my layout is correct. It must not
leave any side effect on the main plots.
>From the help of function layout this line relates to layout.show

layout.show(n) plots (part of) the current layout, namely the outlines of
the next n figures.

It does not describe the behavior I am seeing

4) Finally is there a way to undo the effect of layout.show except re-enter
my layout again?

Yousri

Software Developer
IBM Canada

[[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] Package 'coin' - How to extract rho

2020-04-29 Thread Achim Zeileis

On Wed, 29 Apr 2020, Blume Christine wrote:


Dear Achim,

Many thanks indeed. Yes, I had thought about this too and, fortunately, 
the bootstrapping confirms the results from the "normal" test. However, 
I was wondering whether it is mathematically acceptable to report the 
pvals from bootstrapping, but non-bootstrapped correlation coefficients. 
Does someone have an opinion on this?


First, coin doesn't do bootstrapping tests, it does permutation tests.

Second, reporting the rho coefficient from the original sample is surely 
ok, no matter whether you used a bootstrap test, unconditional asymptotic 
test, or permutation test. At least I wouldn't see any reason, not to do 
so.


Best,
Z


-Ursprüngliche Nachricht-
Von: Achim Zeileis 
Gesendet: Mittwoch, 29. April 2020 13:56
An: Blume Christine 
Cc: Jim Lemon ; torsten.hoth...@uzh.ch; 
r-help@r-project.org
Betreff: Re: [R] Package 'coin' - How to extract rho

Christine,

thanks for the example. As far as I can see, the "coin" package does not explicitly compute 
Spearman's rho. This is probably also the reason why it isn't reported in the test output. Thus, you would 
have to do this "by hand" using cor(..., method = "spearman").

Hope that helps,
Achim


On Wed, 29 Apr 2020, Blume Christine wrote:


Dear Jim,



Many thanks for following up on this. Sure, I can provide a sample code. At the 
end of the code you see that I extract the p-value and the test statistic. 
However, I cannot find the correlation coefficient rho anywhere in the object 
“r”.



Best,

Christine



if(!require(pacman)) install.packages("pacman")

pacman::p_load(sn, fGarch, coin)



# Happiness

central_tendency_sim <- 0

dispersion_sim <- 1

skewness_sim <- 1.5



N_sim <- 1



Happiness <- seq(from = 0,

  to = 10,

  length.out = N_sim)



# City size

central_tendency_sim <- 3

dispersion_sim <- 1

skewness_sim <- 1.5



Citysize <- seq(from = 1,

   to = 5,

   length.out = N_sim)



# create dataframe

datastat <- data.frame(Happiness, Citysize)



# Bootstrapped correlation

r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution
= "approximate", alternative = c("two.sided"))

r

pvalue(r)

statistic(r)





-Ursprüngliche Nachricht-
Von: Jim Lemon 
Gesendet: Mittwoch, 29. April 2020 05:53
An: Blume Christine 
Cc: r-help@r-project.org
Betreff: Re: [R] Package 'coin' - How to extract rho



Hi Christine,

I noticed that your question did not receive a reply. As I don't know exactly 
what you have tried, it is a bit difficult to suggest a solution. If you are 
still unable to get this to work, could you provide an example of your present 
code and data if necessary?



Jim



On Mon, Apr 27, 2020 at 3:09 AM Blume Christine 
mailto:christine.bl...@sbg.ac.at>> wrote:






I am using the 'coin' package to compute bootstrapped correlations. I am able 
to extract the p-value with confidence intervals as well as the test statistic 
Z. However, I am unable to find rho, i.e. the correlation coefficient. Can 
someone help?







Kind regards,



Christine











[[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] Package 'coin' - How to extract rho

2020-04-29 Thread Blume Christine
Dear Achim,

Many thanks indeed. Yes, I had thought about this too and, fortunately, the 
bootstrapping confirms the results from the "normal" test. However, I was 
wondering whether it is mathematically acceptable to report the pvals from 
bootstrapping, but non-bootstrapped correlation coefficients. Does someone have 
an opinion on this?

Best,
Christine


-Ursprüngliche Nachricht-
Von: Achim Zeileis  
Gesendet: Mittwoch, 29. April 2020 13:56
An: Blume Christine 
Cc: Jim Lemon ; torsten.hoth...@uzh.ch; 
r-help@r-project.org
Betreff: Re: [R] Package 'coin' - How to extract rho

Christine,

thanks for the example. As far as I can see, the "coin" package does not 
explicitly compute Spearman's rho. This is probably also the reason why it 
isn't reported in the test output. Thus, you would have to do this "by hand" 
using cor(..., method = "spearman").

Hope that helps,
Achim


On Wed, 29 Apr 2020, Blume Christine wrote:

> Dear Jim,
>
>
>
> Many thanks for following up on this. Sure, I can provide a sample code. At 
> the end of the code you see that I extract the p-value and the test 
> statistic. However, I cannot find the correlation coefficient rho anywhere in 
> the object “r”.
>
>
>
> Best,
>
> Christine
>
>
>
> if(!require(pacman)) install.packages("pacman")
>
> pacman::p_load(sn, fGarch, coin)
>
>
>
> # Happiness
>
> central_tendency_sim <- 0
>
> dispersion_sim <- 1
>
> skewness_sim <- 1.5
>
>
>
> N_sim <- 1
>
>
>
> Happiness <- seq(from = 0,
>
>   to = 10,
>
>   length.out = N_sim)
>
>
>
> # City size
>
> central_tendency_sim <- 3
>
> dispersion_sim <- 1
>
> skewness_sim <- 1.5
>
>
>
> Citysize <- seq(from = 1,
>
>to = 5,
>
>length.out = N_sim)
>
>
>
> # create dataframe
>
> datastat <- data.frame(Happiness, Citysize)
>
>
>
> # Bootstrapped correlation
>
> r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution 
> = "approximate", alternative = c("two.sided"))
>
> r
>
> pvalue(r)
>
> statistic(r)
>
>
>
>
>
> -Ursprüngliche Nachricht-
> Von: Jim Lemon 
> Gesendet: Mittwoch, 29. April 2020 05:53
> An: Blume Christine 
> Cc: r-help@r-project.org
> Betreff: Re: [R] Package 'coin' - How to extract rho
>
>
>
> Hi Christine,
>
> I noticed that your question did not receive a reply. As I don't know exactly 
> what you have tried, it is a bit difficult to suggest a solution. If you are 
> still unable to get this to work, could you provide an example of your 
> present code and data if necessary?
>
>
>
> Jim
>
>
>
> On Mon, Apr 27, 2020 at 3:09 AM Blume Christine 
> mailto:christine.bl...@sbg.ac.at>> wrote:
>
>>
>
>> I am using the 'coin' package to compute bootstrapped correlations. I am 
>> able to extract the p-value with confidence intervals as well as the test 
>> statistic Z. However, I am unable to find rho, i.e. the correlation 
>> coefficient. Can someone help?
>
>>
>
>> Kind regards,
>
>> Christine
>
>>
>
>>
>
>> [[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] [FORGED] Re: pair correlation function of 3D points

2020-04-29 Thread Eric Leroy
Dear all,
I am sorry to see all the reactions I provoked from a newbie user. Anyway, 
thank you for the answer I think that the pcf3est function responds to my 
question. 
Indeed the spatstat is a very impressive library and I am very grateful to the 
the developers. 
Best regards 

Eric LEROY 
Responsable de la plateforme microscopie électronique 
ICMPE - UMR 7182 
2/8, rue Henri Dunant
94320 THIAIS 
T : 01.49.78.12.09
F : 01.49.78.12.03


> Le 29 avr. 2020 à 13:04, Ege Rubak  a écrit :
> 
> Dear all,
> 
> I see two issues here:
> 
> 1. A new user has a hard time finding and using a specific function in
> spatstat. As package authors we are always interested in such reports
> and we then try to improve documentation, which is indeed a very
> important part of any software project. The package is **very**
> actively developed and documented by mainly Adrian and to a lesser
> extend by Rolf and I. All the other people listed as
> "authors"/"contributors" have contributed things such as a single new
> function, a bug report, a documentation improvement, etc. Many of them
> might not even be aware that they are mentioned on this list. This list
> has developed over many years, and it is unfortunate if it gives the
> impression that a lot of people are ready to help within 24 hours of a
> question being posted on the general R help list because we cannot give
> such guarantee -- you will have better luck with GitHub, the `spatstat`
> tag on stackoverflow or the R SIG-GEO mail list, but still no 24 hour
> guarantee is provided.
> 
> 2. Abby replies in a very impolite tone towards the spatstat authors
> and suggests that the package isn't fit for CRAN, which I consider a
> direct insult to Adrian and all the hard work he has done to keep a
> very well-documented package on CRAN since 2002. It would have been
> nice to get a constructive suggestion on how to improve documentation
> rather than a message about the alleged poor quality of the spatstat
> package based on the documentation of a single function. If anyone
> (Abby?) has spare time available for going through the documentation
> and suggest improvements, add cross references etc. that's most
> welcome. However, we would like to receive any suggestions in normal
> polite manner via the project's GitHub page or by direct email to the
> authors.
> 
> Regards,
> Ege
> 
>> On Wed, 2020-04-29 at 17:31 +1200, Abby Spurdle wrote:
>> I should have noted that my comments weren't directed towards the
>> main
>> authors, but to all people listed in the description file, which is
>> many, including some R core members.
>> 
>> Also, overall, I'm impressed by the effort here. It's just I strongly
>> feel that good documentation is crucial (especially in open source),
>> and I was somewhat disappointed that, given how many people are/were
>> involved in this package, not one (after approx 24 hours) had tried
>> to
>> help answer the OP's question.
>> 
 *If* it does what it claims ...
>>> 
>>> Why would you doubt that it does what it claims?
>> 
>> Because I didn't test it.
>> 
>>> Wouldn't the first thing that one would try be:
>>>   ??"pp3"
>> 
>> No, because I was reading the PDF version of the documentation.
>> 
>>> Of course I'm biased, but IMHO spatstat is documented not only
>>> "properly", but superbly well! :-)
>> 
>> I started reading the pcf function first.
>> This function has the same problem, it doesn't clearly describe the
>> function arguments.
>> It doesn't say whether it applies to 2d, 3d or higher-dimensional
>> data.
>> After reading it, I had no idea whether the function could be applied
>> to 3d data or not.
>> 
>> In my opinion this is not sufficient.
>> Descriptions of function arguments and return values should be clear.
>> 
>> But here's a bigger problem.
>> The documentation says the pcf function is a generic, but the pcf3est
>> function isn't a method.
>> And the pcf documentation (along with the three methods) don't
>> reference the pcf3est function.
>> 
>> I found the pcf function via Googling the subject.
>> But unless someone goes through a list of all the help topics,
>> they're
>> unlikely to find the pcf3est function.
> -- 
> Ege Rubak, Associate Professor,
> Department of Mathematical Sciences, Aalborg University
> Skjernvej 4A, 9220 Aalborg East, Denmark
> Phone: (+45)99408861
> Mobile: (+45)30230252
> Email: ru...@math.aau.dk

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] [Posible SPAM] Re: Stopwords: Topic modelling con LDA

2020-04-29 Thread miriam . alzate
Hola,

Acabo de calcular tf-idf y me surge una duda. ¿Habría un valor de idf o
tf-idf que se considerara como umbral para establecer que una palabra es
muy común o no? Los valores de idf en mis datos van entre 0 y 3.78 y los
de tf-idf ente 0 y 0.07.

Un saludo

El Mar, 28 de Abril de 2020, 12:53, Carlos Ortega escribió:
> Hola,
> Yo de primeras los quitaría para qué otros topics aparecen.
>
> Y también aplicaría tf-idf a tus comentarios. Con tf-idf seguro que
> desaparecen como relevantes esas palabras comunes, será otra forma de
> confirmar que es buena la decisión de hacer el análisis eliminandolas.
>
> Saludos,
> Carlos Ortega
> https://protection.puc.rediris.es/fmlurlsvc/?fewReq=:B:JVI2PTg1Nip6MT0iPCplaDE8PTY8PSp/ZWtibXh5fmkxNW1qPG49bm09PzluaDtpPzk9aG5uPj89bm0/bj06bjpvOWk7PDtuaSp4MT05NDQ8Oz0+Pz4qfWVoMTw/X01+fFVmPD47OTg0ITw/X01+fFVgPD47OTg0Kn5vfHgxYWV+ZW1hIm1gdm14aUx5Ym16bX5+bSJpfypvMTU8=http%3a%2f%2fwww.qualityecellence.es
>
> El mar., 28 abr. 2020 a las 11:44,  escribió:
>
>> Buenos días,
>>
>> Estoy realizando un análisis de topic models con el método LDA. En
>> principio, he quitado del análisis las palabras "stopwords" universales.
>> A
>> la hora de ver los topics y sus palabras más frecuentes encuentro que
>> son
>> muy similares y hay palabras que aparecen en todos los topics. Los
>> textos
>> que estoy analizando son opiniones de consumidores sobre una categoría
>> concreta de cosméticos, por lo que la temática es muy concreta y puede
>> ser
>> que en todas las opiniones se hable de cosas similares.
>>
>> Mi pregunta es,  incluiríais estas palabras que me aparecen en todos los
>> topics o casi todos como stopwords?  Hay alguna forma de refinar más el
>> análisis y que haya más diferencias entre topics?
>>
>> Este es el código que estoy usando:
>>
>> Reviews_dtm <-text_df12star %>%
>>   unnest_tokens(word, text) %>%
>>   anti_join(stop_words)%>%
>>   count(Brand, word) %>%
>>   cast_dtm(Brand, word, n)
>>
>>
>> Reviews_lda <- LDA(Reviews12_dtm, k = 15, control = list(seed = 2016))
>>
>> Un saludo
>>
>> Miriam
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>
>
> --
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
>

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


Re: [R] Package 'coin' - How to extract rho

2020-04-29 Thread Achim Zeileis

Christine,

thanks for the example. As far as I can see, the "coin" package does not 
explicitly compute Spearman's rho. This is probably also the reason why it 
isn't reported in the test output. Thus, you would have to do this "by 
hand" using cor(..., method = "spearman").


Hope that helps,
Achim


On Wed, 29 Apr 2020, Blume Christine wrote:


Dear Jim,



Many thanks for following up on this. Sure, I can provide a sample code. At the 
end of the code you see that I extract the p-value and the test statistic. 
However, I cannot find the correlation coefficient rho anywhere in the object 
“r”.



Best,

Christine



if(!require(pacman)) install.packages("pacman")

pacman::p_load(sn, fGarch, coin)



# Happiness

central_tendency_sim <- 0

dispersion_sim <- 1

skewness_sim <- 1.5



N_sim <- 1



Happiness <- seq(from = 0,

  to = 10,

  length.out = N_sim)



# City size

central_tendency_sim <- 3

dispersion_sim <- 1

skewness_sim <- 1.5



Citysize <- seq(from = 1,

   to = 5,

   length.out = N_sim)



# create dataframe

datastat <- data.frame(Happiness, Citysize)



# Bootstrapped correlation

r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution = "approximate", 
alternative = c("two.sided"))

r

pvalue(r)

statistic(r)





-Ursprüngliche Nachricht-
Von: Jim Lemon 
Gesendet: Mittwoch, 29. April 2020 05:53
An: Blume Christine 
Cc: r-help@r-project.org
Betreff: Re: [R] Package 'coin' - How to extract rho



Hi Christine,

I noticed that your question did not receive a reply. As I don't know exactly 
what you have tried, it is a bit difficult to suggest a solution. If you are 
still unable to get this to work, could you provide an example of your present 
code and data if necessary?



Jim



On Mon, Apr 27, 2020 at 3:09 AM Blume Christine 
mailto:christine.bl...@sbg.ac.at>> wrote:






I am using the 'coin' package to compute bootstrapped correlations. I am able 
to extract the p-value with confidence intervals as well as the test statistic 
Z. However, I am unable to find rho, i.e. the correlation coefficient. Can 
someone help?







Kind regards,



Christine











[[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] Package 'coin' - How to extract rho

2020-04-29 Thread Blume Christine
Dear Jim,



Many thanks for following up on this. Sure, I can provide a sample code. At the 
end of the code you see that I extract the p-value and the test statistic. 
However, I cannot find the correlation coefficient rho anywhere in the object 
“r”.



Best,

Christine



if(!require(pacman)) install.packages("pacman")

pacman::p_load(sn, fGarch, coin)



# Happiness

central_tendency_sim <- 0

dispersion_sim <- 1

skewness_sim <- 1.5



N_sim <- 1



Happiness <- seq(from = 0,

   to = 10,

   length.out = N_sim)



# City size

central_tendency_sim <- 3

dispersion_sim <- 1

skewness_sim <- 1.5



Citysize <- seq(from = 1,

to = 5,

length.out = N_sim)



# create dataframe

datastat <- data.frame(Happiness, Citysize)



# Bootstrapped correlation

r <- spearman_test(Happiness ~ Citysize, data = datastat, distribution = 
"approximate", alternative = c("two.sided"))

r

pvalue(r)

statistic(r)





-Ursprüngliche Nachricht-
Von: Jim Lemon 
Gesendet: Mittwoch, 29. April 2020 05:53
An: Blume Christine 
Cc: r-help@r-project.org
Betreff: Re: [R] Package 'coin' - How to extract rho



Hi Christine,

I noticed that your question did not receive a reply. As I don't know exactly 
what you have tried, it is a bit difficult to suggest a solution. If you are 
still unable to get this to work, could you provide an example of your present 
code and data if necessary?



Jim



On Mon, Apr 27, 2020 at 3:09 AM Blume Christine 
mailto:christine.bl...@sbg.ac.at>> wrote:

>

> I am using the 'coin' package to compute bootstrapped correlations. I am able 
> to extract the p-value with confidence intervals as well as the test 
> statistic Z. However, I am unable to find rho, i.e. the correlation 
> coefficient. Can someone help?

>

> Kind regards,

> Christine

>

>

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