Re: [R] extracting data files names with odd numbers from folder

2022-04-03 Thread Jeff Newmiller
You need to learn regular expression patterns... there are lots of languages 
that use them, and tutorial websites that teach them to you. They are not the 
same as filename globbing patterns, and list.files uses regex because they are 
much more flexible.

Here is an example:

list.files( pattern = "[135]\\.csv$" )

On April 3, 2022 10:28:04 PM PDT, CHANCE CARTER  wrote:
>I have a selection of data files saved as:
>File1.csv
>File2.csv
>File3.csv
>File4.csv
>.
>.
>.
>File100.csv
>
>I need to extract the odd numbered files.
>I have tried using the list.files function but I do not understand how to set 
>pattern ="???" in order to extract the odd file names
>
>list.files(path, pattern= "",... )
>
>   [[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] ggplot2

2022-04-03 Thread Richard Vickery
Hi there,

I am finally getting to some material I had problems with in university,
where I was introduced to R - one of those that because of time
constraints, I had challenges figuring out, particularly because I decided
long ago on using Fedora Linux. The book, "Understanding Statistics Using
R" by Andy Field et. al., says to install ggplot2 into R and the version of
R that the dnf command installs will neigher install this package nor
'scales'. The result I get is below, and I attempted installing the
packages via the tar command, and that neither worked, and I attempted
library("ggplot2") and R said the package was unavailable. What can I do to
move forward?

Thanks,

Richard

[[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] Plotting proportions

2022-04-03 Thread Jim Lemon
Hi Nick,
If you can bear using R base graphics, the plotrix package has a
function named "getYmult" that allows you to adjust for the aspect
ratio of any plot area.

Jim

On Sun, Apr 3, 2022 at 11:14 PM Nick Wray  wrote:
>
> Hello  If you plot a square in the default R studio window you see a
> rectangle.  Does anyone know what the proportions of the sides of this
> rectangle are?  Thanks Nick Wray
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] binom.test & p-value

2022-04-03 Thread Rui Barradas

Hello,

Can you post your computations? Assuming a two-sided test, mine are


x <- 6
n <- 26
p <- 0.1

cmb <- sapply(x:n, \(i) choose(n, i))
sum(cmb * p^(x:n) * (1 - p)^(n - (x:n)))
#[1] 0.03985931

binom.test(x=6, n=26, p=0.1)$p.value
#[1] 0.03985931


The result are equal to one another.

Às 19:00 de 03/04/2022, Sigbert Klinke escreveu:

Hi,

for the specific example binom.test(x=6, n=26, p=0.1) I get as p-value 
0.03986. The default approach to decide whether I can reject the null or 
or not is to compare the p-value with the given significance level. 
Using a significance level of 0.05 this will lead to reject the null 
hypothesis.


However, computing things by hand it turned out that the critical values 
are 0 and 6. Since the test statistic is also 6 I can not reject the 
null hypothesis.


I found the discussion under 
https://stat.ethz.ch/pipermail/r-help/2009-February/380341.html and I 
understand that a p-value is not well defined if we have a asymmmetric 
(discrete) distribution under the null.


At least I would have expected some hint in the documentation for 
binom.test.


Sigbert



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] binom.test & p-value

2022-04-03 Thread Sigbert Klinke

Hi,

for the specific example binom.test(x=6, n=26, p=0.1) I get as p-value 
0.03986. The default approach to decide whether I can reject the null or 
or not is to compare the p-value with the given significance level. 
Using a significance level of 0.05 this will lead to reject the null 
hypothesis.


However, computing things by hand it turned out that the critical values 
are 0 and 6. Since the test statistic is also 6 I can not reject the 
null hypothesis.


I found the discussion under 
https://stat.ethz.ch/pipermail/r-help/2009-February/380341.html and I 
understand that a p-value is not well defined if we have a asymmmetric 
(discrete) distribution under the null.


At least I would have expected some hint in the documentation for 
binom.test.


Sigbert

--
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-int
https://hu.berlin/mmstat-ar

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Plotting proportions

2022-04-03 Thread Bert Gunter
... and following up on Rui's reply, assuming that the default (in R,
not RStudio) "m" is being used, I would assume that the aspect ratio
in the RStudio device depends on the layout of your windows. Also, you
might do better asking here, https://community.rstudio.com/ , than on
this list.

Bert Gunter

On Sun, Apr 3, 2022 at 8:26 AM Rui Barradas  wrote:
>
> Hello,
>
> There's a graphics parameter for aspect ratio that you can set asp=1 on
> a plot by plot basis. But you also need to change pty. From ?par:
>
> pty
> A character specifying the type of plot region to be used; "s" generates
> a square plotting region and "m" generates the maximal plotting region.
>
>
>
> old_par <- par(pty = "s")
> plot(1, asp = 1)
> par(old_par)
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 14:13 de 03/04/2022, Nick Wray escreveu:
> > Hello  If you plot a square in the default R studio window you see a
> > rectangle.  Does anyone know what the proportions of the sides of this
> > rectangle are?  Thanks Nick Wray
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Plotting proportions

2022-04-03 Thread Rui Barradas

Hello,

There's a graphics parameter for aspect ratio that you can set asp=1 on 
a plot by plot basis. But you also need to change pty. From ?par:


pty
A character specifying the type of plot region to be used; "s" generates 
a square plotting region and "m" generates the maximal plotting region.




old_par <- par(pty = "s")
plot(1, asp = 1)
par(old_par)


Hope this helps,

Rui Barradas

Às 14:13 de 03/04/2022, Nick Wray escreveu:

Hello  If you plot a square in the default R studio window you see a
rectangle.  Does anyone know what the proportions of the sides of this
rectangle are?  Thanks Nick Wray

[[alternative HTML version deleted]]

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


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


[R] ODP: Modificatio of function body within a function

2022-04-03 Thread Grzegorz Smoliński
Thank you, Bert!

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