Re: [R] Timezone question

2023-08-17 Thread Marc Schwartz via R-help
Hi Dennis,

I believe that it may be as simple as:

> format(Sys.time(), "%z")
[1] "-0400"

Where "%z" returns the offset from UTC as a character vector, and where I am in:

> Sys.timezone()
[1] "America/New_York"

There may be some subtleties, and I would suggest reading the relevant help 
files for ?strptime and the above two functions.

Regards,

Marc Schwartz


-Original Message-
From: R-help mailto:r-help-boun...@r-project.org>> on behalf of Dennis Fisher 
mailto:fis...@plessthan.com>>
Date: Thursday, August 17, 2023 at 4:31 PM
To: mailto:r-help@r-project.org>>
Subject: [R] Timezone question


R 4.3.1
OS X


Colleagues


Is there a simple way to determine the timezone offset for my present location. 
For example, during standard time in the US, the offset from GMT is 8 hours in 
California.


Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com <http://www.plessthan.com/> <http://www.plessthan.com/>;>

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


Re: [R] R Tools Security Posture

2023-05-17 Thread Marc Schwartz via R-help
Hi,

An additional resource that was not listed below is the R Software Development 
Life Cycle (SDLC) document that is available here:

  https://www.r-project.org/certification.html

which addresses a subset of the issues raised.

Regards,

Marc Schwartz


On May 17, 2023 at 4:52:27 AM, Ivan Krylov (krylov.r...@gmail.com 
(mailto:krylov.r...@gmail.com)) wrote:

> В Tue, 16 May 2023 13:47:19 +
> "MAJID, Ayesha \(NHS ENGLAND - X26\) via R-help"  
> пишет:
>
> > * When was the application last updated?
> > * How often is it updated?
>
> This information is publicly available at
> by looking for "Release plans". You
> can reach this page by starting at and
> clicking the "Developer Pages" link. The developer pages are admittedly
> harder to navigate than the main website, but I think that they could
> answer some of your other questions too.
>
> You can also obtain this information by looking for "News" under
> and by checking the dates of all released
> versions of R at .
>
> > * Is the source code anywhere? If so where is
>
> Yes, you can download release source code by following the "download R"
> link at , ending up at
> https://cloud.r-project.org/ (or your preferred CRAN mirror) and
> clicking the link for the currently-latest version, R-4.3.0.tar.gz.
>
> The link to the Subversion repository containing yet unreleased code
> can be located at https://developer.r-project.org/.
>
> > and is it secure?
>
> What's the threat model?
>
> > * Are there any common vulnerabilities?
>
> What would be considered a vulnerability in a piece of software that
> was never supposed to be a security boundary?
>
> (Will R run arbitrary code typed at its prompt? Yes, by design. Is it
> possible to feed maliciously-constructed data into R's unserialize()
> and cause arbitrary code execution this way? Probably, but typing code
> at the prompt is much easier. Can third-party R packages that start TCP
> servers be convinced to run arbitrary code on attacker's behalf?
> Consider that a given.)
>
> > * Do your employees (e.g., developers or system administrators)
> > have access to customer data?
>
> By itself, R processes any data fed into it locally, on the computer
> where it's running, without contacting R developers about it.
>
> The same cannot be guaranteed about third-party packages, although
> there are tests and reviews at both CRAN and Bioconductor in order to
> prevent the packages from doing anything considered "anti-social". (See
> for more
> information on this.) A sufficiently motivated malicious actor could
> circumvent them, of course, but that can be said about anything.
>
> If someone at NHS wants to use R, they will probably want to use CRAN
> and Bioconductor packages too. Potentially, they might need packages
> published elsewhere as well. All these packages will have to be
> reviewed separately from R, because they are maintained by different
> people.
>
> > * Does R require third party authorization/connections?
>
> No, but shouldn't you be more concerned with third-party software
> dependencies?
>
> (Did you mean to ask these questions at the public mailing list open
> for J. Random Hackers like me to answer?)
>
> --
> 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] PROP_TEST function from INFER package

2023-05-15 Thread Marc Schwartz via R-help
Hi,

You are using the prop_test() function from the infer CRAN package, with an 
argument set for an example using the prop_test() function from the rstatix 
CRAN package.

They are **not** the same function, and do not take the same arguments, even 
though they have the same name.

Read the help page for the prop_test() function in the infer package, where 'x' 
is supposed to be a data frame, not a vector, and there is no 'n' argument.

Regards,

Marc Schwartz


On May 15, 2023 at 7:26:16 AM, alfredo.rocc...@fastwebnet.it 
(alfredo.rocc...@fastwebnet.it (mailto:alfredo.rocc...@fastwebnet.it)) wrote:

> Dear all,
>
> I'm trying to replicate the same example you can find in:
> https://rpkgs.datanovia.com/rstatix/reference/prop_test.html
>
> but I get the following get this error message:
>
>
>
> > library(infer)
>
> > prop_test(x = 95, n = 160, p = 0.5, detailed = TRUE)
>
> Error: Please supply a response variable that is not `NULL`.
>
> >
>
>
>
> > strsplit(version[['version.string']], ' ')[[1]][3]
>
> [1] "4.3.0"
>
> >
>
> > packageVersion("infer")
>
> [1] '1.0.4'
>
>
>
> Anybody can give any help?
>
> Thank you a lot,
>
> Alfredo
>
>

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

2023-04-12 Thread Marc Schwartz via R-help
Hi,

You do not need to use third party packages for date or date/time objects in R.

If you review ?as.Date, you will see that there are two default formats for 
Date objects that are specified in the 'tryFormats' argument:

  tryFormats = c("%Y-%m-%d", "%Y/%m/%d")

If your date character vector does not conform to either one, which it does not 
in this case, then you need to explicitly specify the input format, the details 
of which are specified in ?strptime.

Thus:

> as.Date("12 APR 2023", format = "%d %b %Y")
[1] "2023-04-12"

> str(as.Date("12 APR 2023", format = "%d %b %Y"))
 Date[1:1], format: "2023-04-12"

> class(as.Date("12 APR 2023", format = "%d %b %Y"))
[1] "Date"

where the %d defines the day of the month number, %b defines the abbreviated 
month and %Y defines the four digit year. The spaces in between each specifier 
in the format argument reflect that there are spaces in the source vector, as 
opposed to hyphens (e.g. 12-APR-2023) or slashes (e.g. 12/APR/2023).

Note that once your vector is a Date class object, you can then manipulate them 
as dates and perform various operations on them. You can then use format() to 
alter the output format as you may need for other purposes, in which case, the 
formatted output is coerced back to a character vector, even though the 
internal storage is still a Date class object.

Regards,

Marc Schwartz



On April 12, 2023 at 10:34:26 AM, akshay kulkarni (akshay...@hotmail.com 
(mailto:akshay...@hotmail.com)) wrote:

> dear members,
> I want to convert "12 APR 2023" into a Date object. I tried as_Date() from 
> lubridate, but it is not working:
>
> > as_date("12 APR 2023")
> [1] NA
> Warning message:
> All formats failed to parse. No formats found.
> > as_date("12-APR-2023")
> [1] NA
> Warning message:
> All formats failed to parse. No formats found.
>
> I am looking for a shorthand way of doing it. Of course, one can convert APR 
> to 4 and get the job done, but I ma looking for a short and elegant code
>
> please help...
>
> THanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Marc Schwartz via R-help
Hi,

You were on the right track using stack(), but you just pass the entire data 
frame as a single object, not the separate columns:

> stack(NamesWide)
  values   ind
1    Tom Name1
2   Dick Name1
3  Larry Name2
4  Curly Name2

Note that stack also returns the index (second column of 'ind' values), which 
tells you which column in the source data frame the stacked values originated 
from.

Thus, if you just want the actual data:

> stack(NamesWide)$values
[1] "Tom"   "Dick"  "Larry" "Curly"

returns a vector, or:

> stack(NamesWide)[, 1, drop = FALSE]
  values
1    Tom
2   Dick
3  Larry
4  Curly

which returns a data frame with a single column named 'values'.

Regards,

Marc Schwartz


On April 3, 2023 at 11:08:59 AM, Sparks, John (jspa...@uic.edu 
(mailto:jspa...@uic.edu)) wrote:

> Hi R-Helpers,
>
> Sorry to bother you, but I have a simple task that I can't figure out how to 
> do.
>
> For example, I have some names in two columns
>
> NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly"))
>
> and I simply want to get a single column
> NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly"))
> > NamesLong
> Names
> 1 Tom
> 2 Dick
> 3 Larry
> 4 Curly
>
>
> Stack produces an error
> NamesLong<-stack(NamesWide$Name1,NamesWide$Names2)
> Error in if (drop) { : argument is of length zero
>
> So does bind_rows
> > NamesLong<-dplyr::bind_rows(NamesWide$Name1,NamesWide$Name2)
> Error in `dplyr::bind_rows()`:
> ! Argument 1 must be a data frame or a named atomic vector.
> Run `rlang::last_error()` to see where the error occurred.
>
> I tried making separate dataframes to get around the error in bind_rows but 
> it puts the data in two different columns
> Name1<-data.frame(c("Tom","Dick"))
> Name2<-data.frame(c("Larry","Curly"))
> NamesLong<-dplyr::bind_rows(Name1,Name2)
> > NamesLong
> c..TomDick.. c..LarryCurly..
> 1 Tom  
> 2 Dick  
> 3 Larry
> 4 Curly
>
> gather makes no change to the data
> NamesLong<-gather(NamesWide,Name1,Name2)
> > NamesLong
> Name1 Name2
> 1 Tom Larry
> 2 Dick Curly
>
>
> Please help me solve what should be a very simple problem.
>
> Thanks,
> John Sparks
>
>
>
>
>
> [[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] (Off-Topic) Time for a companion mailing list for R packages?

2022-01-13 Thread Marc Schwartz via R-help
unity replies are reasonable to expect. For 
others, communicating with the package maintainer directly may be the 
only recourse, because there is perhaps not broad experience with the 
package in the community. It may be difficult for the useR of such a 
package to make that distinction a priori, unless they (hopefully) take 
the time to search the list archives first, perhaps using rseek.org or 
Google, which is also recommended.


I always begin with the assumption that the question that I have has 
been asked before, and hopefully an answer will also be present. That 
may be in the relevant documentation, including package vignettes where 
available, or otherwise online here or elsewhere. Certainly, if there is 
a bug or a reasonable suspicion of one in a third party package, the 
package maintainer should be the primary point of contact.


Regards,

Marc Schwartz


Eric Berger wrote on 1/13/22 12:25 PM:

Re: constructive criticism to make this list more useful to more people:

Suggestion 1: accommodate questions related to non-base-R packages
This has been addressed by many already. The current
de facto situation is that such questions are asked and often answered.
Perhaps the posting guide should be altered so that such questions fall
within the guidelines.

Suggestion 2: expand beyond plain-text mode
 I assume there is a reason for this restriction but
it seems to create a lot of delay and often havoc. Also, many questions on
this list relate to graphics which is an important part of R (even base R)
and such questions may often be more easily communicated with images.

Eric



<...earlier content snipped...>

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

2021-12-31 Thread Marc Schwartz via R-help

Hi,

I presume that you mean RHEL 8, and not just RH 8?

In either case, there is a list specifically for using R on RHEL/Fedora 
based Linux derivative distributions:


https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

You should subscribe to that list and post your query there, as the 
RHEL/Fedora R maintainers are active on that list. They can give you 
guidance on compiling R from source, if you really need to do that, or 
to suggest that you use the existing RPMs for R that they maintain and 
make available.


Regards,

Marc Schwartz

kap4lin wrote on 12/31/21 12:38 PM:

Hi,

Before I proceed with the error output, is this the right list for help on
compiling R from source. If not, please point me in the right direction.

The error itself is related to this:
https://stackoverflow.com/questions/53610178/installation-of-r-fails-because-of-undefined-reference-to-libiconv


Kap Lin



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

2021-11-12 Thread Marc Schwartz via R-help

Hi Rich,

You don't show the actual code that you used, and I do not use ggplot, 
but if you want to use RGB hex codes to define a color, you need to use 
'#' as a prefix for the 6 character RGB code:


For example:

> plot(1:10, col = "FF3030")
Error in plot.xy(xy, type, ...) : invalid color name 'FF3030'

versus:

plot(1:10, col = "#FF3030")

the latter which includes the '#' and works to generate the plot.

Otherwise, as Avi apparently replied separately, use colors() or 
colours() to see the actual color text names and ?colors for more help.


Regards,

Marc Schwartz

Rich Shepard wrote on 11/12/21 2:58 PM:
I have an R color chart downloaded from the Web March 4, 2015. Using 
it to
set ggplot2 colors R responds with 'Error: Unknown colour name: 
FF3030' for

a number of these colors.

There are several different color charts for R when I look for a new 
one but
I cannot tell which one has all colors recognized by the latest R 
version.


Rich


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

2021-11-05 Thread Marc Schwartz via R-help

Hi,

Not sure where you have been looking, but on CRAN:

https://cran.r-project.org/index.html

there is a box at the top of the main page to Download R for macOS, 
which brings you to:


https://cran.r-project.org/bin/macosx/

The first version there, 4.1.2, which is the pkg binary for macOS 10.13 
and higher for Intel CPUs is the one that you want.


Note that there is also a macOS specific FAQ here:

https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

and finally, a macOS specific help list here:

https://stat.ethz.ch/mailman/listinfo/r-sig-mac

You will also likely want to install XQuartz, which is available here:

https://www.xquartz.org

Regards,

Marc Schwartz


Mark Don Young wrote on 11/5/21 10:59 AM:

I am having trouble finding a version of R install compatible with my mac.
I have an older Macbook pro 2016 with the latest version of Big Slur 11.6.
Intel core i5 2.9 Ghz-Dual-Core.
Is there a version of R compatible with my computer?
Thanks
Mark


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

2021-10-29 Thread Marc Schwartz via R-help

Ken Peng wrote on 10/29/21 2:39 AM:

I saw runif(1) can generate a random num, is this the true random?


runif(1)

[1] 0.8945383

What's the other better method?

Thank you.


Hi,

You do not indicate your use case, and that can be important.

The numbers generated by R's default RNGs are "pseudo random" (PRNGs), 
which means that for most general purpose applications, such as common 
Monte Carlo simulations or randomized clinical trial treatment 
allocations, as suggested by the other replies, they will work fine.


As PRNGs, the actual pseudo-random permutations can be replicated by 
setting the same 'seed' value each cycle for the PRNG in use.


For example:

> runif(5)
[1] 0.6238892 0.8307422 0.4955693 0.4182567 0.9818217

> runif(5)
[1] 0.2423170 0.4129066 0.9213000 0.8290358 0.1644403

will yield two different, pseudo-random, sequences.

However:

> set.seed(1)
> runif(5)
[1] 0.2655087 0.3721239 0.5728534 0.9082078 0.2016819

> set.seed(1)
> runif(5)
[1] 0.2655087 0.3721239 0.5728534 0.9082078 0.2016819

will yield the same sequence given the use of the same seed value before 
each call to runif().


Thus, the sequences will appear to be random, but given a specific 
algorithm and seed value, they are deterministic.


That repeatable behavior can be important if one wishes to come back at 
some future date and replicate the exact same output sequence, presuming 
other factors have not changed in the mean time, such as occurred with R 
version 3.6.0, which is referenced in ?Random, where a default changed 
to improve behavior.


Also, some R functions may use simulation or resampling approaches to 
create various parameters, and you may wish to replicate the same result 
with each iteration. Setting the seed value prior to the relevant 
function call can enable that.


Also, review the resources at https://www.random.org for additional 
references on the differences between PRNGs and other implementations, 
especially if you might need something closer to a "true" RNG for more 
rigorous work.


Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] I'd like to request that my R CRAN package is not tested on Solaris OS

2021-10-22 Thread Marc Schwartz via R-help

Hi,

Just to add some additional comments that may be helpful.

1. The CRAN repository policy here:

  https://cran.r-project.org/web/packages/policies.html

notes:

"Package authors should make all reasonable efforts to provide 
cross-platform portable code. Packages will not normally be accepted 
that do not run on at least two of the major R platforms. Cases for 
Windows-only packages will be considered, but CRAN may not be the most 
appropriate place to host them."


That would seem to infer that, with reasonable justification, one may be 
able to make a request of the CRAN maintainers to exclude at least one 
of the OS platforms from testing. A request that would be at the 
discretion of the CRAN maintainers and Solaris, in light of the low 
market prevalence, may be a more common exclusion as you have noted below.



2. If you wish to test your package on Solaris, in the absence of using 
a VM, there is a blog post here:


  https://blog.r-hub.io/2020/05/14/checking-your-r-package-on-solaris/

that you may find helpful.


Eric has suggested posting to r-package-devel, and I would agree in 
terms of a larger and focused R package development audience. Albeit, 
you would eventually need to make a direct request to the CRAN 
maintainers (c...@r-project.org) to exclude Solaris from testing.


You have specified a deadline below which is only 5 days away, and not 
likely a reasonable constraint, given the volunteer service nature of 
the folks that maintain CRAN. I would suggest that you contact them 
using the e-mail address above, without the deadline, and afford them 
the opportunity to reply to you with what may be reasonable next steps 
given the issues you face.


Regards,

Marc Schwartz



Eric Berger wrote on 10/22/21 9:01 AM:

Hi Lampros,
I cannot answer your question but I believe the correct place to post
such a question would be the r-package-devel list

https://stat.ethz.ch/mailman/listinfo/r-package-devel

Good luck


On Fri, Oct 22, 2021 at 2:13 PM lampros mouselimis
 wrote:


Dear R-help team,

I'm the maintainer of the textTinyR package. Currently the package fails on
the Solaris Operating System (OS), you can see the results in the following
weblink: https://cran.r-project.org/web/checks/check_results_textTinyR.html

All my packages are tested on Solaris OS automatically but I never check my
R packages before submitting to CRAN on Solaris OS because I don't have any
experience using it. I also won't be in place to fix this error (even if I
utilize a Virtual Machine). Due to the fact that my package works on Linux,
Windows and Macintosh (I can fix the errors in all these three OS because I
have installations in my Computer) can I request to exclude the textTinyR
package from the Solaris OS testing / CRAN checking (that means the Solaris
test frameworks will not appear in the CRAN Package test results page)?
Moreover, whom should I send an e-mail to make this request?

I processed the data of all current packages on CRAN
<https://cran.r-project.org/web/checks/check_summary_by_package.html> and
there are 153 submitted packages that are not tested on Solaris (I attach
the csv file of these packages in this e-mail), which means it's possible
for a package to not be tested on this OS.

I'd like an answer before the 27th October otherwise the package will be
removed from CRAN.

Thank you in advance and for your time,
Lampros Mouselimis


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Sample size Determination to Compare Three Independent Proportions

2021-08-10 Thread Marc Schwartz via R-help
can assume that the expected proportion of "Yes" values in each group 
is 0.25


For the alternative hypotheses, for example,  we can set  p1 = .25, 
p2=.25, p3=.35



Again thank you very much in advance.

abou

__

*AbouEl-Makarim Aboueissa, PhD
*
*
*
*Professor, Statistics and Data Science*
*Graduate Coordinator*
*Department of Mathematics and Statistics
*
*University of Southern Maine*



On Mon, Aug 9, 2021 at 10:53 AM Marc Schwartz <mailto:marc_schwa...@me.com>> wrote:


Hi,

You are going to need to provide more information than what you have
below and I may be mis-interpreting what you have provided.

Presuming you are designing a prospective, three-group, randomized
allocation study, there is typically an a priori specification of the
ratios of the sample sizes for each group such as 1:1:1, indicating
that
the desired sample size in each group is the same.

You would also need to specify the expected proportions of "Yes" values
in each group.

Further, you need to specify how you are going to compare the
proportions in each group. Are you going to perform an initial omnibus
test of all three groups (e.g. 3 x 2 chi-square), possibly followed by
all possible 2 x 2 pairwise comparisons (e.g. 1 versus 2, 1 versus 3, 2
versus 3), or are you just going to compare 2 versus 1, and 3 versus 1,
where 1 is a control group?

Depending upon your testing plan, you may also need to account for p
value adjustments for multiple comparisons, in which case, you also
need
to specify what adjustment method you plan to use, to know what the
target alpha level will be.

On the other hand, if you already have the data collected, thus have
fixed sample sizes available per your wording below, simply go ahead
and
perform your planned analyses, as the notion of "power" is largely an a
priori consideration, which reflects the probability of finding a
"statistically significant" result at a given alpha level, given that
your a priori assumptions are valid.

Regards,

Marc Schwartz


AbouEl-Makarim Aboueissa wrote on 8/9/21 9:41 AM:
 > Dear All: good morning
 >
 > *Re:* Sample Size Determination to Compare Three Independent
Proportions
 >
 > *Situation:*
 >
 > Three Binary variables (Yes, No)
 >
 > Three independent populations with fixed sizes (*say:* N1 = 1500,
N2 = 900,
 > N3 = 1350).
 >
 > Power = 0.80
 >
 > How to choose the sample sizes to compare the three proportions
of “Yes”
 > among the three variables.
 >
 > If you know a reference to this topic, it will be very helpful too.
 >
 > with many thanks in advance
 >
 > abou
 > __
 >
 >
 > *AbouEl-Makarim Aboueissa, PhD*
 >
 > *Professor, Statistics and Data Science*
 > *Graduate Coordinator*
 >
 > *Department of Mathematics and Statistics*
 > *University of Southern Maine*
 >



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Sample size Determination to Compare Three Independent Proportions

2021-08-09 Thread Marc Schwartz via R-help

Hi,

You are going to need to provide more information than what you have 
below and I may be mis-interpreting what you have provided.


Presuming you are designing a prospective, three-group, randomized 
allocation study, there is typically an a priori specification of the 
ratios of the sample sizes for each group such as 1:1:1, indicating that 
the desired sample size in each group is the same.


You would also need to specify the expected proportions of "Yes" values 
in each group.


Further, you need to specify how you are going to compare the 
proportions in each group. Are you going to perform an initial omnibus 
test of all three groups (e.g. 3 x 2 chi-square), possibly followed by 
all possible 2 x 2 pairwise comparisons (e.g. 1 versus 2, 1 versus 3, 2 
versus 3), or are you just going to compare 2 versus 1, and 3 versus 1, 
where 1 is a control group?


Depending upon your testing plan, you may also need to account for p 
value adjustments for multiple comparisons, in which case, you also need 
to specify what adjustment method you plan to use, to know what the 
target alpha level will be.


On the other hand, if you already have the data collected, thus have 
fixed sample sizes available per your wording below, simply go ahead and 
perform your planned analyses, as the notion of "power" is largely an a 
priori consideration, which reflects the probability of finding a 
"statistically significant" result at a given alpha level, given that 
your a priori assumptions are valid.


Regards,

Marc Schwartz


AbouEl-Makarim Aboueissa wrote on 8/9/21 9:41 AM:

Dear All: good morning

*Re:* Sample Size Determination to Compare Three Independent Proportions

*Situation:*

Three Binary variables (Yes, No)

Three independent populations with fixed sizes (*say:* N1 = 1500, N2 = 900,
N3 = 1350).

Power = 0.80

How to choose the sample sizes to compare the three proportions of “Yes”
among the three variables.

If you know a reference to this topic, it will be very helpful too.

with many thanks in advance

abou
__


*AbouEl-Makarim Aboueissa, PhD*

*Professor, Statistics and Data Science*
*Graduate Coordinator*

*Department of Mathematics and Statistics*
*University of Southern Maine*



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Data is not properly written in csv file

2021-06-21 Thread Marc Schwartz via R-help

Hi,

If each of the extracted tables do not have consistent content and 
structure, that may be causing problems as you append each to the same file.


You might want to modify your loop so that each table gets written to a 
different CSV file and see what that looks like.


Also, review ?write.table and take note of the default arguments that 
are used for write.csv(), as noted in the CSV Files section, and in the 
Examples.


Regards,

Marc Schwartz

Sri Priya wrote on 6/20/21 11:03 AM:

Dear R Users,

I am working on extracting tables from PDF and I am writing that in a csv
file. When I executed the code, the tables were not properly written in the
csv file.

Here is my code:

library(tabulizer)
# Location of pdf file.
location <- '
http://keic.mica-apps.net/wwwisis/ET_Annual_Reports/Religare_Enterprises_Ltd/RELIGARE-2017-2018.pdf
'

# Extract the table
out <- extract_tables(location)
for(i in 1:length(out))
{
 write.table(out[i], file='Output.csv',append=TRUE, sep=",",quote =
FALSE)
}
  I enclosed the screenshot of the output file. In that you can see
the tables are incomplete.

Any help would be appreciated.

Thanks
Sripriya.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Crashes while pasting a graphic to clipboard on Windows

2021-06-21 Thread Marc Schwartz via R-help

Hi,

R version 3.6.3 was released back in February of 2020, so well over a 
year old, and version 4.1.0 is the current version.


I don't use Windows, and it is not clear if there was a Windows specific 
bug present at that time that may have been resolved since then. There 
have been a fair number of changes to the graphics engine and perhaps 
other related functionality.


Unless you are constrained by local IT policies, I would urge you to 
upgrade your R installation to the current release version, preferably 
with a fully clean install, given the major version upgrade such as this 
would be.


Regards,

Marc Schwartz

Gabriel Toro wrote on 6/21/21 4:19 PM:

I am using version 3.6.3 on Windows. I recently noticed that R crashes when 
pasting graphics to the clipboard (both as metafiles and as images). I saw some 
old (~ 2 years old) references to the problem on Google, but no recent ones. Is 
there a way around this problem?

Thanks,

Gabriel


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

2021-05-27 Thread Marc Schwartz via R-help

Hi,

A quick clarification:

The regular expression is a single quoted character vector, not a 
character vector on either side of the | operator:


"MLH1|MSH2"

not:

"MLH1"|"MSH2"

The | is treated as a special character within the regular expression. 
See ?regex.


grep(), when value = FALSE, returns the index of the match within the 
source vector, while when value = TRUE, returns the found character 
entries themselves.


Thus, you need to be sure that your ifelse() incantation is matching the 
correct values.


In the case of grepl(), it returns TRUE or FALSE, as Rui noted, thus:

  CRC$MMR.gene <- ifelse(grepl("MLH1|MSH2",CRC$gene.all), "Yes", "No")

should work.

Regards,

Marc Schwartz


Kai Yang via R-help wrote on 5/27/21 11:23 AM:

  Hi Rui,thank you for your suggestion.
but when I try the solution, I got message below:

Error in "MLH1" | "MSH2" :   operations are possible only for numeric, logical 
or complex types

does it mean, grepl can not work on character field?
Thanks,KaiOn Thursday, May 27, 2021, 01:37:58 AM PDT, Rui Barradas 
 wrote:
  
  Hello,


ifelse needs a logical condition, not the value. Try grepl.


CRC$MMR.gene <- ifelse(grepl("MLH1"|"MSH2",CRC$gene.all), "Yes", "No")


Hope this helps,

Rui Barradas

Às 05:29 de 27/05/21, Kai Yang via R-help escreveu:

Hi List,
I wrote the code to create a new variable:
CRC$MMR.gene<-ifelse(grep("MLH1"|"MSH2",CRC$gene.all,value=T),"Yes","No")
   


I need to create MMR.gene column in CRC data frame, ifgene.all column contenes 
MLH1 or MSH2, then the MMR.gene=Yes, if not,MMR.gene=No

But, the code doesn't work for me. Can anyone tell how to fix the code?

Thank you,

Kai


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

2021-05-24 Thread Marc Schwartz via R-help

Hi Roger,

I can't speak to the details here, albeit, there was a thread back in 
April on R-Devel (also not the right list for this topic), where one of 
the Fedora maintainers provided some insights for CentOS 7.x, where 
there were missing/incompatible tool chain issues.


I would recommend re-posting this to r-sig-fedora, which is focused upon 
R on Red Hat and Fedora based Linux distributions, including CentOS:


  https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

The Fedora/EPEL R maintainers do monitor and respond on that list, and 
can likely provide you with more informed replies.


Regards,

Marc Schwartz

Roger Bos wrote on 5/24/21 3:41 PM:

Dear all,

I seem to be having an impossible time install R on my centos 8 virtual
machine (I know centos 8 is no longer maintained, but it is a work server
so I have no choice in the matter.).  I installed EPEL and enabled
PowerTools, but I cannot install R due to conflicts in the requirements for
openblas-devel.  Could some help me get past this issue?  Thanks in
advance, Roger

[RCOAdmin@usd1sapp101 ~]$ sudo dnf install R
CentOS-8 - PowerTools
   14 kB/s | 4.3 kB
 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64
30 kB/s |  15 kB
 00:00
Extra Packages for Enterprise Linux 8 - x86_64
52 kB/s |  15 kB
 00:00
Error:
  Problem: package R-devel-4.0.5-1.el8.x86_64 requires R-core-devel =
4.0.5-1.el8, but none of the providers can be installed
   - package R-4.0.5-1.el8.x86_64 requires R-devel = 4.0.5-1.el8, but none
of the providers can be installed
   - package R-core-devel-4.0.5-1.el8.x86_64 requires openblas-devel, but
none of the providers can be installed
   - conflicting requests
   - nothing provides openblas(x86-32) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.i686
   - nothing provides openblas-threads(x86-32) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.i686
   - nothing provides openblas(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
   - nothing provides openblas-threads(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to
use not only best candidate packages)
[RCOAdmin@usd1sapp101 ~]$ sudo dnf install openblass-devel
Last metadata expiration check: 0:00:31 ago on Mon 24 May 2021 09:34:56 PM
CEST.
No match for argument: openblass-devel
Error: Unable to find a match: openblass-devel
[RCOAdmin@usd1sapp101 ~]$ sudo dnf install openblas-devel
Last metadata expiration check: 0:00:43 ago on Mon 24 May 2021 09:34:56 PM
CEST.
Error:
  Problem: cannot install the best candidate for the job
   - nothing provides openblas(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
   - nothing provides openblas-threads(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to
use not only best candidate packages)
[RCOAdmin@usd1sapp101 ~]$ sudo dnf install openblas-devel --nobest
Last metadata expiration check: 0:00:52 ago on Mon 24 May 2021 09:34:56 PM
CEST.
Error:
  Problem: conflicting requests
   - nothing provides openblas(x86-32) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.i686
   - nothing provides openblas-threads(x86-32) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.i686
   - nothing provides openblas(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
   - nothing provides openblas-threads(x86-64) = 0.3.3-5.el8 needed by
openblas-devel-0.3.3-5.el8.x86_64
(try to add '--skip-broken' to skip uninstallable packages)
[RCOAdmin@usd1sapp101 ~]$

[[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] [R-pkgs] New CRAN Package: BI - Generate James (1996) and Bang (2004) Blinding Indexes

2021-05-17 Thread Marc Schwartz via R-packages

Hi All,

Version 1.0.0 of the new BI package is now on CRAN.

The BI package will generate the James Blinding Index, as described in 
James et al (1996, https://pubmed.ncbi.nlm.nih.gov/8841652/) and the 
Bang Blinding Index, as described in Bang et al (2004, 
https://pubmed.ncbi.nlm.nih.gov/15020033/).


These are measures to assess whether or not satisfactory blinding has 
been maintained in a randomized, controlled, clinical trial. These can 
be generated for trial subjects, research coordinators and principal 
investigators, based upon standardized questionnaires that have been 
administered, to assess whether or not they can correctly guess to which 
treatment arm (e.g. placebo or treatment) subjects were assigned at 
randomization.



The package is available from:

  https://CRAN.R-project.org/package=BI

and is maintained on Github:

  https://github.com/marcschwartz/BI


Warm regards,

Marc Schwartz

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

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

2021-04-14 Thread Marc Schwartz via R-help

Hi,

When you experience errors with a third party package like that, one of 
the first steps to take is to review the results of CRAN testing on the 
package. That is available via the "CRAN checks:" link on the package page:


  https://cran.r-project.org/web/packages/XLConnect/index.html

That link takes you to:

  https://cran.r-project.org/web/checks/check_results_XLConnect.html

where you can see that there are NOTEs and ERRORs being reported across 
multiple platforms.


I would therefore contact the package maintainer and inquire as to the 
current status of the package, plans to resolve the outstanding issues, 
and a workaround in the mean time.


From a review of the Issues page on the package's Github site, there 
appear to be a number of such reports already:


  https://github.com/miraisolutions/xlconnect/issues

So you may want to review those communications first.

Regards,

Marc Schwartz


Bernard McGarvey wrote on 4/14/21 1:42 PM:

I installed the "XLConnect" package which appears to be successful and then tried to load the 
"XLConnect" library and got an error as shown below. Any ideas as to where to look for the source of the 
error? The word "release" in the error message makes me think it is some issue with the version of 
"XLConnect" but that is just a guess.

I am running the latest version of R available on CRAN on Windows 10.


install.packages("XLConnect")

Installing package into ‘E:/Data/OneDrive/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 
'https://cran.rstudio.com/bin/windows/contrib/4.0/XLConnect_1.0.3.zip'
Content type 'application/zip' length 29498979 bytes (28.1 MB)
downloaded 28.1 MB
package ‘XLConnect’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpARt8Er\downloaded_packages


library(XLConnect)

Error: package or namespace load failed for ‘XLConnect’:
.onLoad failed in loadNamespace() for 'XLConnect', details:
call: system2("cat", c("/etc/*-release"), stdout = TRUE, stderr = TRUE)
error: '"cat"' not found


library("XLConnect")

Error: package or namespace load failed for ‘XLConnect’:
.onLoad failed in loadNamespace() for 'XLConnect', details:
call: system2("cat", c("/etc/*-release"), stdout = TRUE, stderr = TRUE)
error: '"cat"' not found



Thanks



Bernard McGarvey

Director, Fort Myers Beach Lions Foundation, Inc.

Retired (Lilly Engineering Fellow).




[[alternative HTML version deleted]]

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



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


Re: [R] Help with changing date format in R

2021-01-20 Thread Marc Schwartz via R-help
Hi,

Internally, once you have a Date class object in R, the "printed" output 
displayed will be the default, which I believe is influenced by your locale. 
See ?format.Date.

That being said, in your example data below, 07022020, could be either July 2, 
2020, or February 7, 2020. How do you know which one is correct, since both are 
legal conversions?

Thus, you need some other flag value to determine which conversion is correct.

Can you use the observer values as a flag?

If so, then you can use a conditional statement (e.g. ?ifelse) to make the 
conversion.

For example:

  d$date <- ifelse(d$observer %in% c(vector, of, observers), 
   as.Date(d$date, format = "%d%m%Y"),
   as.Date(d$date, format = "%m%d%Y"))

Also, you might not want to overwrite the original values, and create a new 
column, in the case of errors.

Regards,

Marc Schwartz


> On Jan 20, 2021, at 11:08 AM, krissievdh  wrote:
> 
> Hi,
> 
> I have a big database where one-third of the data is in a different date
> format than the rest. I'll add an example table to show you.
> 
> | plot | observer  | date|
> | 1 | K  | 31012020  |
> | 2 | K  | 07022020  |
> | 3 | B  | 01282020  |
> | 4 | B  | 01292020  |
> So I have two different date formats; the first is in d m y while the other
> one is in m d y.
> 
> My question is how can I change all the date data into the same format?
> Preferably in dd/mm/yy. (31-01-2020)
> I know I could use:
> d$date <- as.Date(d$date, format = "%d%m%Y")
> d$date <- as.Date(d$date, format = "%m%d%Y")
> 
> but I can only do one and then it doesn't work. Is there a way i can use
> the first line for the date of observer K and the other line for the date
> of observer B?
> 
> Thanks

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


Re: [R] Readxl on Mac

2020-12-01 Thread Marc Schwartz via R-help


> On Dec 1, 2020, at 1:51 PM, Dennis Weygand  wrote:
> 
> From the following lines of code on an iMac running Catalina 10.15.7
> 
> 
> library(readxl)
> fname <-  "/Volumes/SD/LabData/Lorentz/Lorentz.xlsx"
> 
> Helm <- read_excel(fname,sheet="Helmholtz")
> 
> I get the following annoying error:
> Error: Evaluation error: zip file
> 
> To me this makes no sense: the file in question is not a zip file. The
> excel file in question, however, is either open on excel, or recently
> opened in excel.
> Does anyone know about this error, and what to do about it?
> I am running R version 3.5.1
> 
> Thanks for any assistance you can provide.


Hi,

Current generation MS Office files (ending with an 'x' in the file extension) 
are ZIP compressed XML files. Thus, the zip error is relevant.

If the file that you are referencing actually exists, since the error can 
indicate a non-existent file (error in name and/or path), it is possible that 
the file is still open, and read_excel() presumably requires an exclusive read 
on the file, thus cannot open it in that manner.

You might be sure that the file is not in use by Excel or another application, 
precluding an exclusive lock on the file. If so, close out the other 
application.

Another possibility is that the Excel file is password protected, and thus 
cannot be read directly, without saving it in an unprotected fashion.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] [R-pkgs] WriteXLS Version 6.1.0 - Bug Fix Release

2020-11-25 Thread Marc Schwartz via R-packages
Hi All,

WriteXLS version 6.1.0 has been released and is in the process of becoming 
available via CRAN.

This is a bug fix release, as in version 6.0.0, there were occasions where 
certain integer values in source data frames, containing specific patterns of 
trailing and embedded zeros, were written to the Excel worksheets as left 
justified text values, as opposed to right justified numeric values.

Please download and install the updated version at your convenience.

Thanks and regards,

Marc Schwartz

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

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 pass a character string with a hyphen

2020-11-17 Thread Marc Schwartz via R-help
Hi,

You might want to look at ?shQuote, which wraps text in single quotes, if the 
source text does not include them, or double quotes otherwise, as might be used 
in a shell setting, where you are passing arguments that may have spaces or 
other characters that may be evaluated.

My guess is that the API that you are passing the character vector to may be 
parsing/evaluating the '-' and only seeing the first part of the passed value.

So, for example:

> shQuote("-")
[1] "'-'"


See if that works.

Regards,

Marc Schwartz


> On Nov 17, 2020, at 3:43 PM, Jeff Reichman  wrote:
> 
> R-Help
> 
> How does one pass a character string containing a hyphen? I have a function
> that accesses an api if I hard code the object, for example
> 
> key_key <- "-" 
> 
> it works but when I pass the key  code to the function (say something like
> key_code <- code_input)  it returns only . So R is seeing a string with
> a negative operator I'm assuming
> 
> Jeff
> 

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


Re: [R] Language environment

2020-11-17 Thread Marc Schwartz via R-help


> On Nov 17, 2020, at 8:00 AM, Steven Yen  wrote:
> 
> In R, I was able to set the language environment by fixing the line
> 
> in file "C:\Program Files\R\R-4.0.3\etc\Rconsole", line 70 below, set 
> language to EN:
> 
> language = EN
> 
> In RStudio, I am not able to do that, except to include the line
> 
> Sys.setenv(LANG="en");
> 
> in every one of my program file. That's too much work. Any idea? Thank you!
> 


Hi,

You may be better served using and/or posting to RStudio's own support site:

  https://support.rstudio.com/

as they are a separate product from R itself.

It sounds like there may be somewhat different session startup processes for 
RStudio, and they would be the best resource to assist you.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Data Table not rendering properly using R shiny

2020-11-07 Thread Marc Schwartz via R-help
Hi,

Please drop R-Devel as a cc: from this thread for further replies.

This topic is definitely not relevant there and cross-posting is not needed, 
but does require manual moderation.

Thanks,

Marc Schwartz

> On Nov 7, 2020, at 10:23 AM, Bert Gunter  wrote:
> 
> Better to post on  RStudio support, I think. Shiny is an RStudio package
> and product and this list if for R language/programming help. The two are
> separate.
> 
> 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 Sat, Nov 7, 2020 at 2:43 AM Ritwik Mohapatra  wrote:
>> 
>> Hi All,
>> 
>> I have a data output as below.I want to display them in an interactive html
>> report using shiny but the data table is not rendering properly and instead
>> giving NA values.
>> 
>> 
>> max_usage_hours_per_region<-setNames(aggregate(df3_machine_region$sum_as_hours~df3_machine_region$Region,df3_machine_region,max),c("Region","Sum_as_Hours"))
>> 
>> Region Sum_as_Hours
>> 1 Africa 1156.0833
>> 2 Americas 740.1667
>> 3 APAC 740.2833
>> 4 Europe 1895.2000
>> 5 PDO 1053.3500
>> 6 UK 0.
>> 
>> 
>> Rshiny code:
>> 
>> library(shiny)
>> 
>> ui <- fluidPage(
>> selectInput("Region","Select
>> Region",max_usage_hours_per_region$Region,selected = TRUE),
>> tableOutput("table")
>> )
>> server <- function(input, output) {
>> output$table <- renderTable(
>> max_usage_hours_per_region[input$Region,])
>> }
>> shinyApp(ui = ui, server = server)
>> 
>>[[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] backslash in xtable (generate latex code from R)

2020-11-06 Thread Marc Schwartz via R-help
Hi,

It looks like xtable is "sanitizing" special characters in the LaTeX output by 
default, by adding a double backslash, so that LaTeX will process the 
characters as literals, rather than specials. It is not parsing the boundary 
'$' characters to define insertion of math symbols inside text mode.

You have 'sanitize.colnames.function = identity', which is why the column name 
is output 'as is'.

You would seem to need to do the same thing for the text content within the 
table content:

> print(xtable(mytable), include.rownames = F, 
sanitize.colnames.function = identity, 
sanitize.text.function = identity)
% latex table generated in R 4.0.3 by xtable 1.8-4 package
% Fri Nov  6 07:54:51 2020
\begin{table}[ht]
\centering
\begin{tabular}{l}
  \hline
$\beta_0$ \\ 
  \hline
aa \\ 
  bb \\ 
  cc$\alpha_1$ \\ 
   \hline
\end{tabular}
\end{table}


Regards,

Marc Schwartz


> On Nov 6, 2020, at 7:39 AM, John  wrote:
> 
> I'd like to have $\alpha_1$ in my table, and the column name is $\beta_0$
> 
> library(xtable)
> mytable <- data.frame(beta_0 = c("aa","bb","cc$\\alpha_1$"))
> colnames(mytable) <- "$\\beta_0$"
> print(xtable(mytable), include.rownames = F, sanitize.colnames.function =
> identity)
> 
> 
> No problem with \beta_0, but a problem with \alpha_1:
> 
> \begin{table}[ht]
> \centering
> \begin{tabular}{l}
>  \hline
> $\beta_0$ \\
>  \hline
> aa \\
>  bb \\
>  cc\$$\backslash$alpha\_1\$ \\
>   \hline
> \end{tabular}
> \end{table}
> 
> How may I fix the $\alpha_1$? Thanks!

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


Re: [R] colMeans function

2020-11-04 Thread Marc Schwartz via R-help
Hi,

You might want to become familiar with the ?str and ?dim functions, which can 
help you identify the structure of the objects that you are passing to 
colMeans().

In the first case, flights[2] is a data frame with a single column, so will 
have two dimensions with a row and column structure.

In the second case, flights$month is a single numeric vector within the data 
frame and does not have a row and column dimension structure.

If you used flights[[2]], that would be equivalent to flights$month, in 
referencing a single numeric vector.

So, if you used:

str(flights[2])
dim(flights[2])

str(flights$month)
dim(flights$month)

you would see the difference.

Regards,

Marc Schwartz


> On Nov 4, 2020, at 8:26 AM, Engin Yılmaz  wrote:
> 
> Dear
> I use *flights* database library(nycflights13)
> 
> The following code is working as
> 
> colMeans(flights[2])
> 
> * 6.54851*
> 
> but other code is  not working as
> 
> colMeans(flights$month)
> 
> *Error in colMeans(flights$month) : *
> *  'x' must be an array of at least two dimensions*
> 
> *flights[2]* is equal to the *month *column in database
> 
> *Sincerely*
> Engin YILMAZ

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

2020-10-29 Thread Marc Schwartz via R-help


> On Oct 29, 2020, at 6:35 PM, H  wrote:
> 
> On 10/29/2020 01:49 PM, Marc Schwartz wrote:
>>> On Oct 29, 2020, at 1:29 PM, H  wrote:
>>> 
>>> I tried to install the fredr package yesterday to access the data series 
>>> hosted by the St. Louis Fed but my installation of R, version 3.6, tells me 
>>> it is not available from a cran repository.
>>> 
>>> I could not find any information on this on the fredr information package 
>>> and was wondering if anyone here might know?
>> 
>> Hi,
>> 
>> When that happens, check the CRAN page for the package:
>> 
>>  https://cran.r-project.org/web/packages/fredr/index.html
>> 
>> where you will see that the package has been archived as a result of a lack 
>> of response by the maintainer to problems with the package.
>> 
>> The archive link on the above page allows you to download the last version 
>> of the source package tarball, however, the check results for the package 
>> show numerous issues.
>> 
>> You may want to contact the package maintainer (sboy...@gmail.com) to see 
>> what the current status of the package is, and if they plan to resolve the 
>> issues. If not, consider alternative approaches.
>> 
>> You should also consider updating your R installation, as 3.6.0 is well over 
>> a year old at this point. 4.0.3 is the current stable release.
>> 
>> Regards,
>> 
>> Marc Schwartz
> 
> Thank you. That is very surprising! I would have thought there would be 
> sufficient number of users and interest enough for this important package 
> that it would be maintained!
> 
> As for R 3.6, it is the latest version in the repository for my operating 
> system, CentOS/RHEL...


Hi,

On your first point, the number of users is largely irrelevant, if the package 
maintainer no longer has the interest or the time to continue to support it. It 
is possible, in that scenario, that an interested user, who has the time and 
interest, might engage in a process to take over such maintenance.

Keep in mind that package maintainers are, in the vast majority of cases, 
volunteers. Their motivations for creating and maintaining CRAN packages will 
vary.

I did a quick check and found that there are discussions in the Issues section 
of the package's Github repo:

  https://github.com/sboysel/fredr

that suggest that such discussions are indeed taking place. So perhaps the 
situation with CRAN will be resolved in time. Again, you should contact the 
maintainer to get a better sense of their plans and possible timeline.

With respect to CentOS/RHEL, you might post to r-sig-fedora, which focuses on R 
issues on RH derived Linux distros, to see if there are any plans to update R 
for your version of the distribution:

  https://stat.ethz.ch/mailman/listinfo/r-sig-fedora

The R RPM maintainers, like Tom Callaway, follow that list.

Regards,

Marc

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

2020-10-29 Thread Marc Schwartz via R-help


> On Oct 29, 2020, at 1:29 PM, H  wrote:
> 
> I tried to install the fredr package yesterday to access the data series 
> hosted by the St. Louis Fed but my installation of R, version 3.6, tells me 
> it is not available from a cran repository.
> 
> I could not find any information on this on the fredr information package and 
> was wondering if anyone here might know?


Hi,

When that happens, check the CRAN page for the package:

  https://cran.r-project.org/web/packages/fredr/index.html

where you will see that the package has been archived as a result of a lack of 
response by the maintainer to problems with the package.

The archive link on the above page allows you to download the last version of 
the source package tarball, however, the check results for the package show 
numerous issues.

You may want to contact the package maintainer (sboy...@gmail.com) to see what 
the current status of the package is, and if they plan to resolve the issues. 
If not, consider alternative approaches.

You should also consider updating your R installation, as 3.6.0 is well over a 
year old at this point. 4.0.3 is the current stable release.

Regards,

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

2020-10-26 Thread Marc Schwartz via R-help
> On Oct 26, 2020, at 10:02 AM, Therneau, Terry M., Ph.D. via R-help 
>  wrote:
> 
> In one of my plot functions it is convenient to use clipping to restrict the 
> range of some 
> output.
> But at the end of the function I'd like to turn it off, i.e., so that a 
> subsequent use of 
> legend(), text() or whatever is not affected.
> I don't quite see how to do this -- it seems that the only way to turn off 
> clip is with a 
> new plot.


Terry,

At the end of the example on ?clip, there is:

  do.call("clip", as.list(usr))  # reset to plot region

where 'usr' is the value of:

  usr <- par("usr")

called after the very first plot is generated.

The indication is that by using the final line of code in the example, the 
clipping region is reset to the plot region, probably also based upon any 
change to par("xpd") that may be relevant in your use case.

Does that help?

Regards,

Marc Schwartz

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

2020-10-23 Thread Marc Schwartz via R-packages
Hi All,

WriteXLS version 6.0.0 has been released and is available on CRAN.

The key changes are:

1. More robust handling of embedded newline ('\n') and carriage return ('\r') 
characters, double quotes, and two character sequences of a backslash character 
('\') followed by another character, within a data value, has been implemented. 
An indirect consequence of this more robust handling, is better support for 
multiline cells in the resultant Excel worksheet.

2. New 'AllText' argument to globally handle/overcome Excel's default 
reformatting of erstwhile numeric values with leading and/or trailing zeros. 
This option enhances prior improvements to preserving leading and/or trailing 
zeros on a worksheet cell specific basis.

3. Updated Perl libraries are included as apropos.


Regards,

Marc Schwartz

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

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

2020-10-20 Thread Marc Schwartz via R-help
Hi,

One additional option that you might want to look at is to use ?writeLines with 
'useBytes = TRUE', where the default is FALSE.

Windows, as Duncan notes, is problematic with extended encodings, and you can 
actually get conflicted encoding of text, based upon what is used within R, 
versus the local system encoding set by the OS.

There is an added step of complexity with writeLines(), of having to pre-format 
the line(s) to be output to conform to CSV required formatting. So you would 
need to paste() together each output line first using field delimiters, double 
quotes, etc. prior to output. 

Essentially, mimic the default formatting of write.csv(), on a line by line 
basis, and then output the resulting object to a text file, with a single call 
to writeLines().

Regards,

Marc Schwartz


> On Oct 20, 2020, at 10:28 AM, Duncan Murdoch  wrote:
> 
> You don't say, but I'd guess you're using Windows.  In your code page, the 
> character Å is probably not representable.  At some point in the sequence of 
> operations involved in printing the dataframe R puts the string into the 
> native encoding, and since that's impossible on your system, it substitutes 
> the  instead.  The fact that you can sometimes display it is because 
> internally R uses UTF-8 as much as it can, and it can represent the character.
> 
> One fix for this is to switch from Windows to some other OS.  The others all 
> have proper support for UTF-8.
> 
> You might have luck changing your Windows code page to one that includes the 
> Å, but then there'll be some other characters that are missed.
> 
> You should definitely investigate Eberhard's advice, and test non-base 
> packages like readr.  They are all written much more recently than the base 
> functions, and might have proper support for out-of-code-page characters.
> 
> Duncan Murdoch
> 
> On 20/10/2020 8:20 a.m., Jinsong Zhao wrote:
>> Hi there,
>> Why the same string is displayed in different form?
>>  > abc[,1]
>> [1] "Åland"   "Afghanistan"
>>  > abc
>>   name
>> 1land
>> 2 Afghanistan
>> And more...
>>  > dput(abc, "aa.txt")
>>  > dget("aa.txt")
>>   name
>> 1land
>> 2 Afghanistan
>>  > dget("aa.txt")[,1]
>> [1] "land""Afghanistan"
>> Best,
>> Jinsong
>> On 2020/10/20 17:13, Jinsong Zhao wrote:
>>> Hi there,
>>> 
>>> I tried to export the names of country to a csv file with write.csv().
>>> In the resulted file, Åland was coverted to land. Is there any way
>>> could prevent this happening? Thanks!
>>> 
>>>  > abc
>>> [1] "Åland"
>>>  > write.table(abc, file = "")
>>> "x"
>>> "1" "land"
>>> 
>>> Best,
>>> Jinsong

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

2020-10-06 Thread Marc Schwartz via R-help
Hi,

What OS are you on? 

It has been years since I used ActiveState, but it looks like you now need to 
create an account with them prior to downloading the installation files. They 
seem to give you the option of creating an account with them, or using Github. 
I would opt for the former, even though I have a Github account.

If you are on Windows, an alternative Perl distribution is Strawberry Perl:

  http://strawberryperl.com

Regards,

Marc Schwartz

> On Oct 6, 2020, at 11:21 AM, Philip  wrote:
> 
> I’m getting nowhere with this.  From the website below  I clicked on the 
> ActivePerl 5.26 button which seems to lead me into creating projects on the 
> Cloud rather than downloading the software to my hard drive.
> 
>https://www.activestate.com/products/perl/downloads/
> 
> Can someone give me some advise?  What the website is trying to do seems 
> rather shady.
> 
> Thanks,
> Philip

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] 2 KM curves on the same plot

2020-09-29 Thread Marc Schwartz via R-help
Hi John,

>From the looks of the first plot, it would appear that perhaps you are engaged 
>in a landmark analysis in an oncology setting, with the landmark time set at 5 
>years. On the off chance that you are not familiar with the pros and cons of 
>that methodology, Google "landmark analysis", which should yield a number of 
>references.

With respect to the plot itself, here is one approach, in addition to the one 
that Jim suggested. This will use a 1 x 2 matrix of plot regions, and adjust 
the various axes accordingly.

library(survival)

## Create two models with the same data for this use, the second adding 150 to 
the event times
## to mimic a landmark time at 150 weeks

fit <- survfit(Surv(time, status) ~ x, data = aml)
fit2 <- survfit(Surv(time, status) ~ x, data = aml)
fit2$time <- fit2$time + 150

## create the x 1 x 2 plot matrix
par(mfrow = c(1, 2))

## Set the plot region margins so there is no space to the right
par(mar = c(4, 4, 4, 0))

## Fix the plot limits for consistency
## xaxs = "i" removes the default 4% extensions to the plot region limits
plot(fit, axes = FALSE, xlim = c(0, 150), ylim = c(0, 1), xaxs = "i")

axis(1, at = seq(0, 150, 50), line = -1)
axis(2, las = 1)

## Set the plot region margins so there is no space to the left
par(mar = c(4, 0, 4, 4))

## Set the plot limits for the second time interval
plot(fit2, axes = FALSE, xlim = c(150, 300), ylim = c(0, 1), xaxs = "i")

axis(1, at = seq(150, 300, 50), line = -1)
axis(4, las = 1)

## Draw the vertical line at 150 weeks
axis(2, at = seq(0, 1, 0.2), labels = FALSE, lty = "dashed")


Regards,

Marc Schwartz


> On Sep 28, 2020, at 8:33 PM, array chip via R-help  
> wrote:
> 
> Hello,
> 
> Can anyone suggest a simple way to generate a Kaplan-Meier plot with 2 
> survfit objects, just like this one: 
> 
> https://drive.google.com/file/d/1fEcpdIdE2xYtA6LBQN9ck3JkL6-goabX/view?usp=sharing
> 
> Suppose I have 2 survfit objects: fit1 is for the curve on the left (survtime 
> has been truncated to the cutoff line: year 5), fit2 is for the curve on the 
> right (minimum survival time is at the cutoff line: year 5), but if I do the 
> following:
> 
> plot(fit1, col=1:2)
> lines(fit2,col=1:2)
> 
> Then I will have an horizontal line on the top that connect from 0 to 4 
> years, which I do not want that to be drawn (see blue arrow below):
> 
> https://drive.google.com/file/d/178mQGlhnaOg9PA-oE-W_W5CtrGD03ljH/view?usp=sharing
> 
> Can anyone have a strategy to make this kind of plot happen?
> 
> Thanks,
> 
> John
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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] R Implementation of the James and/or Bang RCT Blinding Assessment Indices

2020-09-24 Thread Marc Schwartz via R-help
Hi All,

I am wondering if anyone has an R implementation of the James (1996) and/or 
Bang (2004) blinding assessment indices for randomized, controlled clinical 
trials. Ideally, I am looking for both.

I have Googled, search using rseek.org, and checked the CRAN clinical trials 
task view and came up empty handed.

Thanks in advance for any leads!

Regards,

Marc Schwartz

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

2020-09-19 Thread Marc Schwartz via R-help


> On Sep 19, 2020, at 1:44 PM, Duncan Murdoch  wrote:
> 
> On 18/09/2020 1:39 p.m., Shapira, Leeor via R-help wrote:
>> Can you please let me know the End of Life and End of Vendor Support dates 
>> for CRAN R for Windows 3.6.3? Thank you.
> 
> R doesn't have either of those.  There is no vendor support ever.  It is free 
> software; it is up to its users to support it.  On the other hand, it is free 
> software, so you can use it forever.
> 
> In practice, there is de facto support from its authors in that they are very 
> responsive to bug reports.  That ends with the next release, so 3.6.3 support 
> ended in April, 2020 when R 4.0.0 was released.
> 
> Another way to think of support and end of life equivalents is to ask how 
> long CRAN will provide the source code to packages for it.  There are no time 
> limits on that, though it can be some work to find a set and tools to build 
> them if you are using older releases.
> 
> And finally, you might want to know how long CRAN will keep updating binary 
> packages for R 3.6.3.  I think that should continue until the release of R 
> 4.1.0, sometime around April 2021.
> 
> Duncan Murdoch


Hi,

Just to add on to Duncan's comments, you may want to read the Software 
Development Life Cycle (SDLC) document here:

  https://www.r-project.org/certification.html

That will give you insights into R's development, release and maintenance 
timelines.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] question including crossover trials in meta-analysis

2020-09-14 Thread Marc Schwartz via R-help
Hi,

Bert has pointed you to some R specific packages for meta-analyses via the Task 
View.

It sounds like you may need to first address some underlying conceptual issues, 
which strictly speaking, is off-topic for this list.

That being said, a quick Google search came up with some possible resources, 
beyond the Cochrane reference:

  https://academic.oup.com/ije/article/31/1/140/655940

  https://onlinelibrary.wiley.com/doi/abs/10.1002/jrsm.1236

  https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0133023


Perhaps with additional conceptual background, that might assist in enabling 
you to make use of the R packages that provide relevant functionality.

Another option, if you want to stay with the dmetar package, would be to 
contact the package maintainer for some guidance relative to how to use the 
functionality in the package given your specific use case.

Regards,

Marc Schwartz


> On Sep 14, 2020, at 3:14 PM, Bert Gunter  wrote:
> 
> Did you first try a web search? -- you should always do this before posting
> here.
> 
> "meta-analysis in R" brought up this:
> 
> https://CRAN.R-project.org/view=MetaAnalysis
> 
> Have you looked at this task view yet?
> 
> 
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> 
> On Mon, Sep 14, 2020 at 11:50 AM Belgers, V. (Vera) <
> v.belg...@amsterdamumc.nl> wrote:
> 
>> Dear sir/madam,
>> Thank you in advance for taking the time to read my question. I am
>> currently trying to conduct a meta-analysis combining parallel and
>> crossover trials. According to the Cochrane Handbook, I can include
>> crossover trials by using t-paired statistics. So far, I have managed to
>> conduct a meta-analysis and forest plot of the parallel trials using the
>> dmetar package, but I did not succeed in including the crossover trials. I
>> do have the raw data of most of these crossover trials.
>> Does anybody know how to add crossover trials to the meta-analysis?
>> With kind regards,
>> Vera Belgers

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Survival Object - is 12month survival = 365days

2020-09-04 Thread Marc Schwartz via R-help
here the times values are now in months over the range of values, instead of 
days.

I don't use the lubridate package, so there may be other options for you there, 
but the above will work, if your underlying time intervals in the source data 
frame for the model are still in days as a unit of measurement. 

Using the base graphics functions, albeit perhaps you are using ggplot or 
similar, you can plot the above model with axis markings at the irregular time 
intervals, using something like the following:

plot(fit, xaxt = "n", las = 1, xlim = c(0, 36 * 30.44))
axis(1, at = c(1, 2, 3, 6, 12, 24, 36) * 30.44, labels = c(1, 2, 3, 6, 12, 24, 
36), cex.axis = 0.65)

This essentially truncates the x axis to 36 months, since the intervals in the 
example colon dataset go to about 9 years or so, and does not label the x axis. 
Bearing in mind that the underlying x axis unit is in days, the axis() function 
then places labels at the irregular intervals. You could then annotate the plot 
further as you may desire.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 4.0.2 not running on macOS 10.15.6

2020-09-04 Thread Marc Schwartz via R-help
Hi Mike,

The installation interface has a minimal process, where what may be optional 
components are left to you to install on your own. Thus, the Installation and 
Admin manual references these, as does the macOS FAQ, but the wording may leave 
open to interpretation what may or may not be required, based upon your 
specific use case. In some use cases, XQuartz would not be required and you 
need to go to a third party site to obtain it, much like you would need to for 
MacTeX or similar.

With respect to the lists, each R list is moderated by a volunteer, thus will 
require a subscription in order to get your posts sent out without manual 
intervention by the list admins/moderators. For example, I am one of the two 
Admins for R-Devel, along with Martin Mächler, thus spend some amount of time 
having to manually approve posts where the poster is not, and does not become a 
subscriber.

Once you subscribe, and your first post is approved, subsequent posts can get 
through without manual intervention, which is appreciated.

If you do not want to keep getting posts from the lists, once your issue is 
resolved, you can return to the list interface, sign into your account, and 
disable getting the posts. Of course, if you need to interact again in the 
future, you would need to remember to re-enable the posts being sent, as 
responses to posts do not always include you as a cc:.

Digests are available, but can be more complicated to interact with, in some 
cases, depending upon your e-mail client, if you should want to reply to a 
specific post. You can set this in your account settings for the relevant list 
if you wish.

One option for you to consider, is that I have server side filters/rules set up 
for the R lists (and others) that I subscribe to. These then move each e-mail 
from my main inbox to the relevant online (IMAP) sub-folder for organization. 
Thus, it keeps my inbox clean and let's me review relevant posts in a more 
efficient and focused manner.

Regards,

Marc


> On Sep 4, 2020, at 11:43 AM, Mike Feher  wrote:
> 
> Good morning Marc,
> 
> Thank you kindly for your quick response.  I had read prior to installation 
> that I might have needed or wanted to install some different packages to 
> support R, but did not catch that XQuartz was a requirement.  (I also never 
> got prompted for various options during the installation of R-4.0.2.pkg.)
> 
> Regarding email lists, perhaps you can assist with this question: While I 
> don't mind becoming a registered member, I prefer not to get email traffic 
> from groups as I have in the past (I actually really hate email for a lot of 
> reasons these days), so I'm wondering, is there a way to get a digest (I 
> thought I saw that) of just a weekly summary of information or questions 
> posted, rather than getting CC:d on every back-and-forth within the user 
> community?  Also, do I have to become an approved user to the R mailing list 
> community or anything like that?  Or are all posts moderated?
> 
> Now that the weekend is upon me, I'll have some time to come up to speed on 
> all this.  Thanks for your patience.
> 
> Thanks again!
> Mike
> 
> On Fri, Sep 4, 2020 at 8:05 AM Marc Schwartz  wrote:
> 
> > On Sep 3, 2020, at 9:26 PM, Michael Feher  wrote:
> > 
> > Greetings,
> > 
> > I am a brand-new user to R and want to install and run this on my iMac 
> > running macOS 10.15.6.  I successfully downloaded the correct package, 
> > installed it with no problems (I was not given any options for Tcl/Tk or 
> > Texinfo), and started it up as any other normal app.  Some introductory 
> > commands like license() and help() worked just fine.  But when I went to 
> > execute demo(), it just beach-balled.  I’ve had to force-quit R a number of 
> > times.
> > 
> > Yes, I read the Mac installation instructions.
> > 
> > Thanks in advance.
> > 
> > Mike
> 
> 
> Hi,
> 
> Sounds like you need to install XQuartz:
> 
>   https://www.xquartz.org
> 
> which is referenced in the macOS installation instructions and the macOS 
> specific FAQ.
> 
> Also, be aware that there is a macOS specific e-mail list here:
> 
>   https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 
> which is where macOS specific R issues should be posted.
> 
> You will need to re-install XQuartz any time you upgrade/install a new 
> version of R.
> 
> Regards,
> 
> Marc Schwartz
> 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 4.0.2 not running on macOS 10.15.6

2020-09-04 Thread Marc Schwartz via R-help


> On Sep 3, 2020, at 9:26 PM, Michael Feher  wrote:
> 
> Greetings,
> 
> I am a brand-new user to R and want to install and run this on my iMac 
> running macOS 10.15.6.  I successfully downloaded the correct package, 
> installed it with no problems (I was not given any options for Tcl/Tk or 
> Texinfo), and started it up as any other normal app.  Some introductory 
> commands like license() and help() worked just fine.  But when I went to 
> execute demo(), it just beach-balled.  I’ve had to force-quit R a number of 
> times.
> 
> Yes, I read the Mac installation instructions.
> 
> Thanks in advance.
> 
> Mike


Hi,

Sounds like you need to install XQuartz:

  https://www.xquartz.org

which is referenced in the macOS installation instructions and the macOS 
specific FAQ.

Also, be aware that there is a macOS specific e-mail list here:

  https://stat.ethz.ch/mailman/listinfo/r-sig-mac

which is where macOS specific R issues should be posted.

You will need to re-install XQuartz any time you upgrade/install a new version 
of R.

Regards,

Marc Schwartz

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

2020-08-31 Thread Marc Schwartz via R-help
> On Aug 31, 2020, at 6:55 AM, Christofer Bogaso  
> wrote:
> 
> Hi,
> 
> I am trying to establish a connection to a Oracle DB from R and used below
> code which is failing every time I try -
> 
>> library(RJDBC)
> Loading required package: DBI
>> jdbcDriver =JDBC("oracle.jdbc.OracleDriver",classPath="ojdbc5.jar")
> 
> *** caught segfault ***
> address 0x854961, cause 'memory not mapped'
> 
> Traceback:
> 1: .jinit(classPath)
> 2: JDBC("oracle.jdbc.OracleDriver", classPath = "ojdbc5.jar")
> 
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> Selection:
> 
> 
> Below is my session info -
> 
>> sessionInfo()
> R version 4.0.2 (2020-06-22)
> Platform: x86_64-apple-darwin17.0 (64-bit)
> Running under: macOS Catalina 10.15.6
> 
> Matrix products: default
> BLAS:
> /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
> LAPACK:
> /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
> 
> locale:
> [1] C/UTF-8/C/C/C/C
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> other attached packages:
> [1] RJDBC_0.2-8  DBI_1.1.0rJava_0.9-13
> 
> loaded via a namespace (and not attached):
> [1] compiler_4.0.2
> 
> I downloaded the JAR file from
> https://www.oracle.com/database/technologies/jdbcdriver-ucp-downloads.html
> 
> Can you please help me to understand why it is failing?


Hi,

I am copying Simon here, as he is the package author/maintainer for RJDBC.

Typically, segfault's can indicate some kind of version mismatch in the 
components that have been installed.

Since there are multiple pieces to this installation, between the packages and 
the underlying Java installation on your Mac, I would defer to Simon's more 
intimate knowledge here.

In searching for related issues, I noted some other posts on multiple OSs, and 
some issues raised on Simon's Github repo for the package.

Also, I am torn between suggesting that this be re-posted to r-sig-db, which is 
specific to R and database interfaces, and r-sig-mac, which is specific to R on 
macOS. 

However, I will defer to Simon on how he might prefer to handle follow up 
discussion on your issue.

Regards,

Marc Schwartz

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

2020-08-08 Thread Marc Schwartz via R-help
Hi,

I was initially going to think that the change in the RNG might be the source, 
however, that change was made in 3.6.0 and would have applied to runif() and 
sample():

"sample.kind can be "Rounding" or "Rejection", or partial matches to these. The 
former was the default in versions prior to 3.6.0: it made sample noticeably 
non-uniform on large populations, and should only be used for reproduction of 
old results. See PR#17494 for a discussion."

Three other possibilities:

1. Read news() for your local 4.0.2 installation, as there are some changes 
that were made, including some changes to round() that could be applicable here.

2. Check to see if the version of glmnet is the same on both machines. There 
have been changes to that package that might be relevant here and you might 
read the README and NEWS files for the package on CRAN to see if there is any 
relevant information there.

3. There is always a chance that different hardware and OS versions could lead 
to issues, especially out to a number of decimal places that could alter 
results. If you or via an Admin, have the ability to update the remote machine 
(both R and installed packages), that can help to reduce the number of 
variables at play here.

Regards,

Marc Schwartz


> On Aug 7, 2020, at 4:24 PM, Kevin Egan  wrote:
> 
> I posted this question:
> 
> I am currently using R , RStudio , and a remote computer (using an R script) 
> to run the same code. I start by using set.seed(123) in all three versions of 
> the code, then using glmnet to assess a matrix. Ultimately, I am having 
> trouble reproducing the results between my local and the remote computer's 
> results. I am using R version 4.0.2 locally, and R version 3.6.0 remote.
> 
> After running several tests, I'm wondering if there is a difference between 
> the two versions in R which may lead to slightly different coefficients. If 
> anyone has any insight I would appreciate it.
> 
> Thanks.
> 
> and found that there were slight differences between using rnorm with R-4.0.2 
> and R-3.6.0 but did not find any differences for runif between both systems. 
> In my original code, I am using rnorm and was wondering if this may be the 
> reason I am finding slight differences in coefficients for glmnet and lars 
> testing between using my local computer (R-4.0.2) and my remote computer 
> (R-3.6.0). I am running my code locally on a MacOSX and remote on what I 
> believe is an HPC.
> 
> Thanks.

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


Re: [R] levels

2020-07-15 Thread Marc Schwartz via R-help


> On Jul 15, 2020, at 4:31 AM, andy elprama  wrote:
> 
> Dear R-users,
> 
> Something strange happened within the command "levels"
> 
> R version 3.6.1
> name <- c("a","b","c")
> values <- c(1,2,3)
> data <- data.frame(name,values)
> levels(data$name)
> [1] "a" "b" "c"
> 
> R version 4.0
> name <- c("a","b","c")
> values <- c(1,2,3)
> data <- data.frame(name,values)
> levels(data$name)
> [1] NULL
> 
> What is happening here?


Hi,

The default value for 'stringsAsFactors' for data.frame() and read.table() 
changed from TRUE to FALSE in version 4.0.0, per the news() file:

"R now uses a stringsAsFactors = FALSE default, and hence by default no longer 
converts strings to factors in calls to data.frame() and read.table()."


Using 4.0.2:

data <- data.frame(name, values, stringsAsFactors = TRUE)

> levels(data$name)
[1] "a" "b" "c"


If you see behavioral changes from one version of R to another, especially 
major version increments, check the news() file.

Regards,

Marc Schwartz

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

2020-07-01 Thread Marc Schwartz via R-help
Michael,

Thanks for the reminder on that.

Frederik, sometimes, with an emphasis on sometimes, the r-sig-* lists are 
willing to go beyond narrow R programming assistance, and offer domain specific 
conceptual assistance, which would otherwise be off-topic for r-help.

You might look through the archives of that list to get a sense for the subject 
matter that has been covered there:

  https://stat.ethz.ch/pipermail/r-sig-meta-analysis/ 
<https://stat.ethz.ch/pipermail/r-sig-meta-analysis/>

I might also mention that a Google search using "meta analysis in R", comes up 
with a number of relevant hits, including various tutorials.

Regards,

Marc


> On Jul 1, 2020, at 1:07 PM, Michael Dewey  wrote:
> 
> Dear Frederik
> 
> There is also a mailing list dedicated to meta-analysis in R
> 
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis//
> 
> Michael
> 
> 
> On 01/07/2020 16:40, Marc Schwartz via R-help wrote:
>> Hi,
>> It sounds like you will want to engage in a meta-analysis.
>> There is a CRAN task view here:
>>   https://cran.r-project.org/web/views/MetaAnalysis.html
>> that would be relevant in pointing you to tools in R that can support that 
>> approach.
>> That being said, the details of specific methodologies and conceptual 
>> assistance would be beyond the scope of this list. You should consider 
>> consulting a local statistician for assistance with that, if needed.
>> Regards,
>> Marc Schwartz
>>> On Jul 1, 2020, at 11:27 AM, Frederik Feys  wrote:
>>> 
>>> Hello everyone
>>> 
>>> I have some studies with results from the same outcome scale. I want to 
>>> merge them into 1 summarised estimated result and its standard deviation. 
>>> How do I do that in R?
>>> 
>>> Thank you very much for your help!
>>> Frederik
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> -- 
> Michael
> http://www.dewey.myzen.co.uk/home.html


[[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 summarize results from studies?

2020-07-01 Thread Marc Schwartz via R-help
Hi,

It sounds like you will want to engage in a meta-analysis.

There is a CRAN task view here:

  https://cran.r-project.org/web/views/MetaAnalysis.html

that would be relevant in pointing you to tools in R that can support that 
approach.

That being said, the details of specific methodologies and conceptual 
assistance would be beyond the scope of this list. You should consider 
consulting a local statistician for assistance with that, if needed.

Regards,

Marc Schwartz

> On Jul 1, 2020, at 11:27 AM, Frederik Feys  wrote:
> 
> Hello everyone
> 
> I have some studies with results from the same outcome scale. I want to merge 
> them into 1 summarised estimated result and its standard deviation. How do I 
> do that in R?
> 
> Thank you very much for your help!
> Frederik

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

2020-06-20 Thread Marc Schwartz via R-help
Hi Ben,

How about something like this:

f <- function(x, y = NULL) {

  if (is.null(y)) 
y <- x

  x + y
}

> f(3, 4)
[1] 7

> f(3)
[1] 6

Regards,

Marc Schwartz


> On Jun 20, 2020, at 7:15 AM, Benjamin Tyner  wrote:
> 
> Greetings,
> 
> Occasionally, I desire to call a function with one argument set to equal to 
> another. Here is a toy example:
> 
>f <- function(x, y) {
> 
>x + y
>}
> 
>f(x = 3, y = x) # Error in f(x = 3, y = x) : object 'x' not found
> 
> So far, the most concise way I found to accomplish this is:
> 
>f(x = 3, y = local(sys.frame(1)$x)) # evaluates to 6
> 
> but I dislike this solution because local() creates a new environment. Surely 
> there must be a better way?
> 
> Note: I'm not interested in solutions that require modifying or currying f.
> 
> Regards,
> Ben
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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] R Software Risk Analysis

2020-06-19 Thread Marc Schwartz via R-help
Hi All,

We need to get clarification from Kristin as to what kinds of issues are raised 
in the context of a risk analysis from her IT people.

Since Kristin's wording indicated:

  "...all programs that our employees/providers use must be vetted through the 
IT Department by way of a Risk Analysis."

that tells me that the risk analysis is *not* in reference to a software 
validation in the FDA sense of regulated clinical trials, not to mention that 
such validation is entirely on the end user, and not on the software publisher, 
in either case.

To reference various FDA related materials, such as the current R FDA guidance 
document and the 2015 FDA statistical software clarifying statement are not 
likely to be helpful here, and I say that as one of the co-authors of the R FDA 
document, along with Frank Harrell, Tony Rossini and Ian Francis. 

The general use by all employees context that Kristin references also suggests 
that one of the commercial vendors of R may or may not be helpful here either, 
unless they specifically provide consulting services and/or documentation to 
support their implementation of R and how it would conform to Kristin's IT 
department requirements, and not for use in an FDA-like trials setting.

For a general IT risk analysis, there is likely to be some kind of check-list 
or form that is required, and it will likely have questions such as:

1. Can R access operating system level commands - Yes

2. Can R access a local or remote file system, to create/read/delete files and 
folders - Yes

3. Can R access the internet to read remote locations and download files from 
servers - Yes

4. Can R alter operating system environment variables - Yes

5. Does the R installer require Administrative level privileges - Yes, with 
some qualifications, depending upon the platform

6. Does R provide end user documentation - Yes

and so forth.

There may be requirements set by Kristin's IT department where such 
characteristics will eliminate R from consideration, albeit, many commercial 
and open source applications would also have similar functionality. 

It may simply be a matter of her IT people understanding whether R provides or 
does not provide certain functionality, so that they know how it will perform 
in their environment, and what, if any, additional security measures may be 
required or need to be adjusted to enable required functionality.

Thus, in the absence of more detail from Kristin as to what is specifically 
required, it is hard to know how to respond, within the context here, of a 
community based support list, and within the R community at large, where we all 
volunteer our time.

Regards,

Marc Schwartz

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

2020-05-22 Thread Marc Schwartz via R-help
Hi,

You appear to have installed Debian on a Chromebook, presumably to overcome the 
limitations otherwise present in Chrome OS.

Since the questions you pose are specific to Debian, there is an R e-mail list 
focused on the use of R on Debian based computers:

  https://stat.ethz.ch/mailman/listinfo/r-sig-debian

You should subscribe to that list and post your queries there to avail yourself 
of a focused audience, which may include folks that have installed a Debian 
based Linux distribution on a Chromebook.

Regards,

Marc Schwartz


> On May 22, 2020, at 9:49 AM, Luigi Marongiu  wrote:
> 
> Hello,
> I have tried to upgrade R to 4.0. I have added `deb
> http://cloud.r-project.org/bin/linux/debian buster-cran40/` to
> `/etc/apt/sources.list`
> (but I removed cran35). Btu when I run `apt-get update; apt-get install
> r-base r-base-dev` I get an error. I think it depends on r-base-core, since
> it depends on these obsolete libraries:
> ```
> $ sudo apt-get install r-base-core
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> Some packages could not be installed. This may mean that you have
> requested an impossible situation or if you are using the unstable
> distribution that some required packages have not yet been created
> or been moved out of Incoming.
> The following information may help to resolve the situation:
> 
> The following packages have unmet dependencies:
> r-base-core : Depends: libc6 (>= 2.27) but 2.24-11+deb9u4 is to be
> installed
>   Depends: libcurl4 (>= 7.28.0) but it is not installable
>   Depends: libgfortran5 (>= 8) but it is not installable
>   Depends: libicu63 (>= 63.1-1~) but it is not installable
>   Depends: libpcre2-8-0 (>= 10.32) but it is not going to be
> installed
>   Recommends: r-recommended but it is not going to be installed
>   Recommends: r-base-dev but it is not going to be installed
>   Recommends: r-doc-html but it is not going to be installed
> E: Unable to correct problems, you have held broken packages.
> ```
> How can I upgrade these libraries on Chromebook?
> Thank you
> 
> -- 
> Best regards,
> Luigi

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

2020-05-15 Thread Marc Schwartz via R-help
Hi, 

For the usual R text to date conversions, you need a complete date. Since you 
are missing the day of the month in your source text, you would need to impute 
that part before making the conversion.

Also, since you don't appear to need to worry about time of day, just use 
as.Date(), instead of as.POSIXct().

In this case, use ?sub to add the day of the month to the source text, for 
which I will impute the 15th, and then make the conversion:

## Single value for now
x <- "11-1993"

> sub("-", "-15-", x)
[1] "11-15-1993"

> as.Date(sub("-", "-15-", x), format = "%m-%d-%Y")
[1] "1993-11-15"


Regards,

Marc Schwartz



> On May 15, 2020, at 5:38 AM, Poizot Emmanuel  
> wrote:
> 
> Dear all,
> 
> I've a data frame with a column "Date":
> 
> [1] 11-1993 11-1993 11-1993 11-1993 11-1993 11-1993 11-1996 11-1996 11-1996
> [10] 11-1996 11-1996 11-1996 02-1998 02-1998 02-1998 02-1998 02-1998 02-1998
> [19] 11-1998 11-1998 11-1998 11-1998 11-1998 11-1998 10-2001 10-2001 10-2001
> [28] 10-2001 10-2001 10-2001 02-2003 02-2003 02-2003 02-2003 02-2003 02-2003
> [37] 11-2004 11-2004 11-2004 11-2004 11-2004 11-2004 11-2005 11-2005 11-2005
> [46] 11-2005 11-2005 11-2005 11-2007 11-2007 11-2007 11-2007 11-2007 11-2007
> [55] 10-2008 10-2008 10-2008 10-2008 10-2008 10-2008 03-2009 03-2009 03-2009
> [64] 03-2009 03-2009 03-2009 10-2012 10-2012 10-2012 10-2012 10-2012 10-2012
> [73] 12-2017 12-2017 12-2017 12-2017 12-2017 12-2017 12-2018 12-2018 12-2018
> [82] 12-2018 12-2018 12-2018
> 
> I want to convert that into real dates:
> as.POSIXct(Date, format="%m-%Y") always return "NA" values.
> Where am I wrong ?
> 
> regards

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

2020-05-08 Thread Marc Schwartz via R-help



> On May 8, 2020, at 11:02 AM, Jeff Newmiller  wrote:
> 
> You seem to be confusing R and RStudio... so yeah, wrong mailing list. I 
> don't know exactly where you should post either. Perhaps the GitHub issues 
> page for RStudio?
> 
> On May 6, 2020 12:54:43 PM PDT, Andrew Swift via R-help 
>  wrote:
>> Sorry, wasn’t sure exactly where to post this but I noticed that with R
>> 4.0.0 when running a Mac in Dark Mode that the Function Hints at the
>> bottom of the Console and Editor windows become invisible.  
>> Thanks. 


Hi,

Actually, I am not sure that is the case. 

See the attached screen capture of the default R.app (which I do not use) when 
the desktop is set to dark mode, which I also do not use.

When in light mode, those hints in the lower left hand corner are black, and 
they switch to white in dark mode, making them almost impossible to see.

For Andrew, if this is correct, and you are not referring to RStudio per Jeff, 
you should post this to r-sig-mac:
  
  https://stat.ethz.ch/mailman/listinfo/r-sig-mac

Otherwise, if it is RStudio, they have their own support here:

   https://support.rstudio.com/hc/en-us

Regards,

Marc Schwartz




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] A behaviour pattern that I find mysterious.

2020-02-26 Thread Marc Schwartz via R-help


> On Feb 26, 2020, at 8:09 PM, Rolf Turner  wrote:
> 
> 
> Consider the following:
> 
> x <- letters[1:5]
> x < 0
> 
> This gives
> 
>> [1] FALSE FALSE FALSE FALSE FALSE
> 
> which kind of makes sense, I guess, though I would a priori have expected all 
> NAs.
> 
> But then do:
> 
> x[3] <- "*"
> x < 0
> 
> This gives
> 
>> [1] FALSE FALSE  TRUE FALSE FALSE
> 
> which puzzles me.  Why is "*" considered to be less than 0?
> 
> At one point I made the conjecture that it had something to do with the 
> ordering of ASCII characters, but it does not seem to.  A little more 
> investigation led me to conjecture that all ASCII characters except real-live 
> letters and numerals come out as being less than 0.
> 
> Can anyone explain the rationale to me?  Not that it matters a damn. Just 
> idle curiosity.
> 
> cheers,
> 
> Rolf Turner
> 

Rolf,

Does this help?

>From ?"<":

"If the two arguments are atomic vectors of different types, one is coerced to 
the type of the other, the (decreasing) order of precedence being character, 
complex, numeric, integer, logical and raw."

Thus:

> c(0, x)
[1] "0" "a" "b" "*" "d" "e"

> sort(c(0, x))
[1] "*" "0" "a" "b" "d" "e"


Thus, "*" is less than "0", at least in my locale, and presumably yours, since 
lexical sort ordering is locale dependent.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] citing old(er) versions of packages

2020-01-16 Thread Marc Schwartz via R-help


> On Jan 16, 2020, at 12:03 PM, Ivan Calandra  wrote:
> 
> Dear useRs,
> 
> I want to cite the packages I have used in my analyses for a paper. I
> have recorded through sessionInfo() which packages and which versions I
> used for a given analysis.
> 
> I know how to cite a package using the citation() function, but the
> problem is that in the meantime, I have updated these packages.
> citation() returns the citation for the actual installed version. And
> citations change over time (e.g. with more people getting involved in
> the development and maintenance of a package).
> 
> Now the question is how do I find out how to cite a given, not actual
> version of a package?
> 
> Thank you in advance.
> Best regards,
> Ivan


Hi,

If you know the package versions that you wish to cite and they are no longer 
installed locally, you can use the content of either the CITATION file for the 
package, if included, or the content of the DESCRIPTION file, for the relevant 
version of the package. 

The easiest way to do this may be to download the source tarball for the 
package from the CRAN archive for the package or wherever the package is 
located, if not on CRAN.

An alternative, if the package is stored in an online VC system (e.g. Github), 
is that you may be able to read the relevant file from that system for the 
version of the file that is tagged appropriately.

Regards,

Marc Schwartz

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

2019-12-27 Thread Marc Schwartz via R-help


> On Dec 27, 2019, at 10:42 AM, Paul Bernal  wrote:
> 
> Dear friends,
> 
> Hope you are all doing well. I need to find a way to convert ascii numbers
> to six digit binary numbers:
> 
> I am working with this example, I converted the string to ascii, and
> finally to decimal, but I am having trouble converting the decimal numbers
> into their six digit binary representation. The code below is exactly what
> I have so far:
> 
> ascii_datformat <- utf8ToInt("133m@ogP00PD;88MD5MTDww@2D7k")
> ascii_datformat
> 
> Base <- ascii_datformat - 48
> 
> ifelse(Base > 40, Base-8, Base)
> 
> x <- rev(intToBits(Base))
> dec2bin <- function(x) paste(as.integer(rev(intToBits(x))), collapse = "")
> dec2bin
> 
> any guidance will be greatly appreciated,
> 
> Best regards,
> 
> Paul


You might look at the intToBin() function in Henrik's R.utils package on CRAN:

https://cran.r-project.org/web/packages/R.utils/index.html

Regards,

Marc Schwartz

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

2019-10-15 Thread Marc Schwartz via R-help


> On Oct 15, 2019, at 5:19 AM, Subhamoy Chakraborty 
>  wrote:
> 
> Dear All,
> 
> Here is the error that I am encountering :-
> 
>> sessionInfo()
> R version 3.3.3 (2017-03-06)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.5 LTS
> 
> locale:
> [1] LC_CTYPE=en_IN   LC_NUMERIC=C LC_TIME=en_IN
> [4] LC_COLLATE=en_IN LC_MONETARY=en_INLC_MESSAGES=en_IN
> [7] LC_PAPER=en_IN   LC_NAME=CLC_ADDRESS=C
> [10] LC_TELEPHONE=C   LC_MEASUREMENT=en_IN LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
>> load("onlyTN.rda")
> Error: bad restore file magic number (file may be corrupted) -- no data
> loaded
> In addition: Warning message:
> file ‘onlyTN.rda’ has magic number 'RDX3'
>  Use of save versions prior to 2 is deprecated
>> 
> 
> Can someone please help me  ?
> 
> Thank you,
> Subhamoy


Hi,

You need to upgrade your version of R to at least 3.5.0, preferably newer, 
which is presumably the version under which the data file was saved.

Note from news(), under 3.6.1, in the section regarding SIGNIFICANT 
USER-VISIBLE CHANGES for 3.6.0:

Serialization format version 3 becomes the default for serialization and saving 
of the workspace (save(), serialize(), saveRDS(), compiler::cmpfile()). 
Serialized data in format 3 cannot be read by versions of R prior to version 
3.5.0. Serialization format version 2 is still supported and can be selected by 
version = 2 in the save/serialization functions. The default can be changed 
back for the whole R session by setting environment variables 
R_DEFAULT_SAVE_VERSION and R_DEFAULT_SERIALIZE_VERSION to 2. For maximal 
back-compatibility, files ‘vignette.rds’ and ‘partial.rdb’ generated by R CMD 
build are in serialization format version 2, and resave by default produces 
files in serialization format version 2 (unless the original is already in 
format version 3).


Regards,

Marc Schwartz

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

2019-08-26 Thread Marc Schwartz via R-help


> On Aug 26, 2019, at 6:24 AM, CHATTON Anne via R-help  
> wrote:
> 
> Hello everybody,
> 
> I am trying to accommodate the R codes provided by Donohue for sample size 
> calculation in the package "longpower" with lmmpower function to estimate the 
> post-hoc power (asked by a reviewer) of a binary GEE model with a three-way 
> interaction (time x condition x continuous predictor) given a fixed sample 
> size. In other words instead of the sample size I would like to estimate the 
> power of my study. 
> 
> Could anyone please help me to modify these codes as to obtain the power I'm 
> looking for. 
> 
> I would really appreciate receiving any feedback on this subject.
> 
> Yours sincerely,
> 
> Anne


Hi,

Three comments:

1. Don't calculate post hoc power. Do a Google search and you will find a 
plethora of papers and discussions on why not, including these:

  The Abuse of Power: The Pervasive Fallacy of Power Calculations for Data 
Analysis
  The American Statistician, February 2001, Vol. 55, No. 1
  https://www.vims.edu/people/hoenig_jm/pubs/hoenig2.pdf

  Post Hoc Power: Tables and Commentary
  https://stat.uiowa.edu/sites/stat.uiowa.edu/files/techrep/tr378.pdf

  Observed power, and what to do if your editor asks for post-hoc power analyses
  
http://daniellakens.blogspot.com/2014/12/observed-power-and-what-to-do-if-your.html

  Retraction Watch:
  Statisticians clamor for retraction of paper by Harvard researchers they say 
uses a “nonsense statistic”
  
https://retractionwatch.com/2019/06/19/statisticians-clamor-for-retraction-of-paper-by-harvard-researchers-they-say-uses-a-nonsense-statistic/

  PubPeer Comments on the paper cited in the above RW post:
  https://pubpeer.com/publications/4399282A80691D9421B497E8316CF6

  A discussion on Frank's Data Methods forum also related to the same paper 
cited above:
  "Observed Power" and other "Power" Issues
  
https://discourse.datamethods.org/t/observed-power-and-other-power-issues/731/30


2. If you are still compelled (voluntarily or involuntarily), you may want to 
review the vignette for the longpower package which may have some insights, 
and/or contact the package maintainer for additional guidance on how to 
structure the code. See the vignette here:

  https://cran.r-project.org/web/packages/longpower/vignettes/longpower.pdf


3. Don't calculate post hoc power.


Regards,

Marc Schwartz

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

2019-08-05 Thread Marc Schwartz via R-help


> On Aug 5, 2019, at 7:03 AM, e-mail ma015k3113 via R-help 
>  wrote:
> 
> Dear All, can anyone point me towards information for connecting to a Oracle 
> instance via DSN. I have already established a ODBC connection.
> 
> Sorry if this is very elementary-I am just getting started with R after using 
> SAS for almost 2 decades.
> 
> Kind regards
> 
> Ahson


Hi,

Look at the RODBC package on CRAN by Prof. Ripley:

  https://cran.r-project.org/web/packages/RODBC/index.html

and be sure to read the package vignette for additional information:

  https://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf

There is also the r-sig-db e-mail list, which is focused in this domain, and 
where follow up questions should be posted:

  https://stat.ethz.ch/mailman/listinfo/r-sig-db

Regards,

Marc Schwartz

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

2019-07-22 Thread Marc Schwartz via R-help
Hi,

In addition to Patrick's comments, which are spot on, other versions of the GPL 
(e.g. 3.0) and other GPL compatible licenses that are or may be relevant to the 
list of packages that are listed below need to be assessed as well. There are 
differences, some more nuanced than others, between GPL compatible licenses and 
how they may affect what you can or cannot do.

If you are going to build a presumably for profit business around open source 
software, then you need to invest in legal counsel with expertise in the 
relevant areas of open source software and intellectual property rights, to get 
appropriate legal opinions on what it is you plan to build, how it will 
interact with R and the packages you list below, and what all of that means for 
your product.

Regards,

Marc Schwartz


> On Jul 22, 2019, at 1:28 PM, Patrick (Malone Quantitative) 
>  wrote:
> 
> You're in the wrong place. This is for help with R programming.
> 
> But you shouldn't be asking us either way, as we (at least most of us)
> aren't lawyers. Get your attorney to study the GNU-GPL-2.0 and tell
> you what you need to and can do for your purposes.
> 
> Pat
> 
> On Mon, Jul 22, 2019 at 1:23 PM ANAMIKA KUMARI  wrote:
>> 
>> Hello Team,
>> 
>> This mail is in reference to understanding R  license and also usage of  R
>> language to develop commercialised product.
>> 
>> I am working on one product of mine that uses R and python language.I am
>> trying to understand the licensing issue if any related to R, if I am going
>> to commercialise my product and keep my work proprietary.
>> 
>> I need your help to understand it. R comes under GNU-GPL-2.0. Now, do I
>> need to share source code of my product. if, I am moving planning  to move
>> it to production or I can keep my code Proprietary.
>> 
>> Please note that I am just using R and its packages to  develop my own
>> statistical tool and api and Have not done any changes to existing R code.
>> 
>> Please refer below for all R-packages used in my code:-
>> 
>>   1.
>> *R-3.4.4 *
>>   2. *'spacyr'*
>>   3.
>> *'jsonlite' *
>>   4.
>> *'lubridate' *
>>   5.
>> *'data.table' *
>>   6.
>> *'png' *
>>   7.
>> *'maps' *
>>   8.
>> *'countrycode' *
>>   9.
>> *'humaniformat' *
>>   10.
>> *'ngram' *
>>   11.
>> *'stringr' *
>>   12.
>> *'slam' *
>>   13.
>> *'tm' *
>>   14.
>> *'lsa' *
>>   15.
>> *'RTextTools' *
>>   16.
>> *'stringi' *
>>   17.
>> *'plumber' *
>>   18. *"Rook"*
>>   19. *"pdftools"*
>>   20. *'tokenizers'*
>>   21. *'zoo'*
>>   22. *"tidyr"*
>>   23. *"reqres"*
>>   24. *"rJava"*
>>   25. *"tiff"*
>>   26. *"splitstackshape"*
>>   27. *"stringdist"*
>>   28. *"RJSONIO"*
>>   29. *"ropensci/tabulizer"*
>>   30. *"staplr"*
>>   31. *"SparseM"*
>>   32. *"randomForest"*
>>   33. *"e1071"*
>>   34. *"ipred"*
>>   35. *"caTools"*
>>   36. *RCMD INSTALL maxent_1.3.3.1.tar.gz*
>>   37. *RCMD INSTALL tree_1.0-39.tar.gz*
>>   38. *RCMD INSTALL RTextTools_1.4.2.tar.gz*
>> 
>> 
>> *Any help from you will be highly appreciated as I am literally stuck at a
>> dead end.*
>> 
>> *Regards*
>> *Anamika Kumari*

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Marc Schwartz via R-help
Hi Heather,

I would defer to the mixed models experts, but I think that the basic approach 
using nested random effects seems to make sense.

I don’t know that there is a dependency of glmer()/lme4 on metafor for this 
specific use case, but would defer to Wolfgang on that point.

Regards,

Marc


> On Jul 3, 2019, at 10:40 AM, Heather H Kettrey  wrote:
> 
> Hi Marc and Wolfgang,
> 
> Thanks for your help. Is the following interpretation of your exchange 
> correct?
> 
> I need to use the glmer() function in the lme4 package (first installing the 
> devel version of metaphor). I can specify both site and matched pairing as 
> random effects using (1 | site / id).
> 
> Is this understanding correct?
> 
> Thanks,
> 
> Heather 
> 
> Heather Hensman Kettrey, PhD
> Assistant Professor of Sociology
> Clemson University
> From: Wolfgang Viechtbauer 
> Sent: Wednesday, July 3, 2019 9:15:50 AM
> To: Marc Schwartz
> Cc: Heather H Kettrey; R-help
> Subject: Re: [R] Conditional Logistic Regression with Multilevel Data [using 
> clogistic() in Epi and lmer() in lme4???]
>  
> Ouch, that was a brain fart on my part!
> 
> But indeed, since we can fit a 'single-site model' using glmer() (as shown), 
> we should be able to just add 'site' as another random effect with (1 | site 
> / id).
> 
> Best,
> Wolfgang
> 
> On July 3, 2019 1:26:54 PM GMT+02:00, Marc Schwartz  
> wrote:
> >Wolfgang,
> >
> >Perhaps I am missing something here, but with clogit(), or Heather's
> >initial attempt at using clogistic(), as both have 'strata' arguments,
> >wouldn't the 'strata' argument need to be able to accept a nested
> >structure, along the lines of strata(id / site)?
> >
> >On the page that you link to below, I don't see an example of that type
> >of nesting structure.
> >
> >The mixed effects models would generally support a nested random
> >effects specification, if that makes sense here.
> >
> >Regards,
> >
> >Marc Schwartz
> >
> >
> >> On Jul 3, 2019, at 4:41 AM, Viechtbauer, Wolfgang (SP)
> > wrote:
> >> 
> >> Dear Heather,
> >> 
> >> You can do this with clogit() from the 'survival' package, using
> >strata(). See:
> >> 
> >>
> >https://urldefense.proofpoint.com/v2/url?u=http-3A__www.metafor-2Dproject.org_doku.php_tips-3Aclogit-5Fpaired-5Fbinary-5Fdata&d=DwIFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BBiFu06xLWCETvNuhD6uw-_crP2zH6EmpC772CQach0&m=PP2LCJ_pE4EwJysp-nsvWt8oIJqJ0nhFvSMBuh7T-ww&s=dvbBssAbENU3KBtLTcWb64QHTComM-RmP8my38CxhW0&e=
> > 
> >> 
> >> You can also use lme4::glmer(), glmmML::glmmML(), or
> >metafor::rma.glmm() for that. [1]
> >> 
> >> [1] Rerunning this example, I noticed a slight issue with the
> >structuring of the output from rma.glmm() -- if you want to run that
> >example, install the 'devel' version of metafor as described here:
> >> 
> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__wviechtb.github.io_metafor_-23installation&d=DwIFaQ&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=BBiFu06xLWCETvNuhD6uw-_crP2zH6EmpC772CQach0&m=PP2LCJ_pE4EwJysp-nsvWt8oIJqJ0nhFvSMBuh7T-ww&s=POvfvp_zMlzeLnfGS2EavvZp1-P_0utedAIqz994QkI&e=
> >>  
> >> 
> >> Best,
> >> Wolfgang

[[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] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-03 Thread Marc Schwartz via R-help
Wolfgang,

Perhaps I am missing something here, but with clogit(), or Heather's initial 
attempt at using clogistic(), as both have 'strata' arguments, wouldn't the 
'strata' argument need to be able to accept a nested structure, along the lines 
of strata(id / site)?

On the page that you link to below, I don't see an example of that type of 
nesting structure.

The mixed effects models would generally support a nested random effects 
specification, if that makes sense here.

Regards,

Marc Schwartz


> On Jul 3, 2019, at 4:41 AM, Viechtbauer, Wolfgang (SP) 
>  wrote:
> 
> Dear Heather,
> 
> You can do this with clogit() from the 'survival' package, using strata(). 
> See:
> 
> http://www.metafor-project.org/doku.php/tips:clogit_paired_binary_data
> 
> You can also use lme4::glmer(), glmmML::glmmML(), or metafor::rma.glmm() for 
> that. [1]
> 
> [1] Rerunning this example, I noticed a slight issue with the structuring of 
> the output from rma.glmm() -- if you want to run that example, install the 
> 'devel' version of metafor as described here:
> 
> https://wviechtb.github.io/metafor/#installation
> 
> Best,
> Wolfgang
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Heather H 
> Kettrey
> Sent: Tuesday, 02 July, 2019 14:59
> To: r-help@r-project.org
> Subject: [R] Conditional Logistic Regression with Multilevel Data [using 
> clogistic() in Epi and lmer() in lme4???]
> 
> I need to run some conditional logistic regression models on a multilevel 
> matched dataset (propensity score matched data from multiple research sites).
> 
> I can pretty easily use the clogistic() function in the Epi package to run 
> conditional logistic regression models on each separate/nested subset of the 
> data (e.g., data obtained from each research site separately). However, I 
> cannot figure out how to run an aggregate analysis (of all aggregated sites) 
> in a way that accounts for clustering.
> 
> When using unconditional logistic regression I can run the aggregate analysis 
> lmer() function in the lme4 package. However, I cannot figure out how to run 
> conditional logistic regression with the lmer() function (I am also open to 
> any other packages/functions that might work).
> 
> Thanks in advance for help with this.
> 
> Heather Hensman Kettrey, PhD
> Assistant Professor of Sociology
> Clemson University

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Conditional Logistic Regression with Multilevel Data [using clogistic() in Epi and lmer() in lme4???]

2019-07-02 Thread Marc Schwartz via R-help



> On Jul 2, 2019, at 8:58 AM, Heather H Kettrey  wrote:
> 
> I need to run some conditional logistic regression models on a multilevel 
> matched dataset (propensity score matched data from multiple research sites).
> 
> 
> I can pretty easily use the clogistic() function in the Epi package to run 
> conditional logistic regression models on each separate/nested subset of the 
> data (e.g., data obtained from each research site separately). However, I 
> cannot figure out how to run an aggregate analysis (of all aggregated sites) 
> in a way that accounts for clustering.
> 
> 
> When using unconditional logistic regression I can run the aggregate analysis 
> lmer() function in the lme4 package. However, I cannot figure out how to run 
> conditional logistic regression with the lmer() function (I am also open to 
> any other packages/functions that might work).
> 
> 
> Thanks in advance for help with this.
> 
> 
> Heather Hensman Kettrey, PhD
> 
> Assistant Professor of Sociology
> 
> Clemson University


A search does not seem to yield specific examples that are relevant.

That being said, it might be worthwhile posting to r-sig-mixed-models:

  https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

where experts in the domain of multi-level models reside.

There may be an approach using glmer() or an alternative package, where you can 
define the paired observations within sites in manner that makes sense for the 
clustering of data at the site level.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 select max data according to week?

2019-06-19 Thread Marc Schwartz via R-help
Hi All,

Is there a reason that the following was not considered?

> DF
 Date O3_Conc
1  2000-01-01   0.033
2  2000-01-02   0.023
3  2000-01-03   0.025
4  2000-01-04   0.041
5  2000-01-05   0.063
6  2000-01-06   0.028
7  2000-01-07   0.068
8  2000-01-08   0.048
9  2000-01-09   0.037
10 2000-01-10   0.042
11 2000-01-11   0.027
12 2000-01-12   0.035
13 2000-01-13   0.063
14 2000-01-14   0.035
15 2000-01-15   0.042
16 2000-01-16   0.028

> str(DF)
'data.frame':   16 obs. of  2 variables:
 $ Date   : Date, format: "2000-01-01" ...
 $ O3_Conc: num  0.033 0.023 0.025 0.041 0.063 0.028 0.068 0.048 0.037 0.042 ...


> aggregate(O3_Conc ~ cut(Date, breaks = "14 days"), data = DF, max)
  cut(Date, breaks = "14 days") O3_Conc
12000-01-01   0.068
22000-01-15   0.042


See ?cut.Date

Note that there is an error in Aisyah's original post, in that the value for 
the max concentration in the second 14 day window is 0.042, not 0.061.

Also, if one wanted to use actual calendar weeks, with a week starting on 
Sunday, as opposed to 14 day windows starting from the minimum date, you could 
use:

> aggregate(O3_Conc ~ cut(Date, breaks = "2 weeks", start.on.monday = FALSE), 
> data = DF, max)
  cut(Date, breaks = "2 weeks", start.on.monday = FALSE) O3_Conc
1 1999-12-26   0.068
2 2000-01-09   0.063


If desired, you could pre-create a column in the DF with the result of cut():

DF$TimeStartDays <- cut(DF$Date, breaks = "14 days")
DF$TimeStartWks <- cut(DF$Date, breaks = "2 weeks", start.on.monday = FALSE)

> DF
 Date O3_Conc TimeStartDays TimeStartWks
1  2000-01-01   0.0332000-01-01   1999-12-26
2  2000-01-02   0.0232000-01-01   1999-12-26
3  2000-01-03   0.0252000-01-01   1999-12-26
4  2000-01-04   0.0412000-01-01   1999-12-26
5  2000-01-05   0.0632000-01-01   1999-12-26
6  2000-01-06   0.0282000-01-01   1999-12-26
7  2000-01-07   0.0682000-01-01   1999-12-26
8  2000-01-08   0.0482000-01-01   1999-12-26
9  2000-01-09   0.0372000-01-01   2000-01-09
10 2000-01-10   0.0422000-01-01   2000-01-09
11 2000-01-11   0.0272000-01-01   2000-01-09
12 2000-01-12   0.0352000-01-01   2000-01-09
13 2000-01-13   0.0632000-01-01   2000-01-09
14 2000-01-14   0.0352000-01-01   2000-01-09
15 2000-01-15   0.0422000-01-15   2000-01-09
16 2000-01-16   0.0282000-01-15   2000-01-09

and then use:

> aggregate(O3_Conc ~ TimeStartDays, data = DF, max)
  TimeStartDays O3_Conc
12000-01-01   0.068
22000-01-15   0.042

> aggregate(O3_Conc ~ TimeStartWks, data = DF, max)
  TimeStartWks O3_Conc
1   1999-12-26   0.068
2   2000-01-09   0.063


Regards,

Marc Schwartz



> On Jun 19, 2019, at 10:45 AM, Eric Berger  wrote:
> 
> I just realized that my method as written only works if the entire date
> range is within a single calendar year.
> Here is a revised version that should handle the general case.
> 
> In this version I assume that the conversion from the original numbers to
> dates has already been done
> e.g. it can be done using ymd() as I showed before
> 
> library(dplyr)
> library(lubridate)
> 
> ## create some example data for 36 months from 2010
> d <- seq(from=as.Date("2010-01-01"),to=as.Date("2012-12-31"),by="1 day")
> conc <- runif(length(d)) # concentrations
> df <- data.frame( dt=d, conc=conc)
> df2 <- dplyr::mutate( df, wkpair=as.integer(floor((0:(nrow(df)-1))/14)) )
> df3 <- dplyr::group_by(df2,wkpair) %>%
>   dplyr::summarise(from=min(dt), to=max(dt), maxconc=max(conc)) %>%
>   dplyr::select(from,to,maxconc)
> df3
> 
> # A tibble: 79 x 3
>   from   to maxconc
>   
> 1 2010-01-01 2010-01-14   0.928
> 2 2010-01-15 2010-01-28   0.834
> 3 2010-01-29 2010-02-11   0.989
> 4 2010-02-12 2010-02-25   0.983
> 5 2010-02-26 2010-03-11   0.898
> 6 2010-03-12 2010-03-25   0.864
> 7 2010-03-26 2010-04-08   0.920
> 8 2010-04-09 2010-04-22   0.925
> 9 2010-04-23 2010-05-06   0.998
> 10 2010-05-07 2010-05-20   0.761
> # ... with 69 more rows
> 
> On Wed, Jun 19, 2019 at 5:08 PM Eric Berger  wrote:
> 
>> Hi Bert,
>> I agree that our interpretation is slightly different, which is why I
>> wrote:
>> "If one can take the actual week of the year as an acceptable definition
>> of week, then here's my approach."
>> 
>> Regards,
>> Eric
>> 
>> On Wed, Jun 19, 2019 at 5:04 PM Bert Gunter 
>> wrote:
>> 
>>> Eric:
>>> 
>>> I believe you're doing something different than I did. I broke up each
>>> month into biweekly perio

Re: [R] R-help mailing list archives

2019-06-11 Thread Marc Schwartz via R-help


> On Jun 11, 2019, at 4:03 AM, Martin Maechler  
> wrote:
> 
>>>>>> Brent via R-help 
>>>>>>on Sun, 9 Jun 2019 03:07:38 + writes:
> 
> [..]
> [..]
> [..]
> 
>> This email list's archives:
> 
>> Apologies in advance if this question has been asked and
>> answered many times already.
> 
>> But know that before posting this, in addition to a normal
>> web search, I tried to find prior discussions on this
>> email list.
> 
>> This is problematic.  The official site
>> https://stat.ethz.ch/mailman/listinfo/r-help says that the
>> only ways which partly work are the GMANE interfaces and
>> the Nabble one.
> 
> You misread what it tries to say. The first time it mentions 'archives'
> it gives you the link showing 'R-help Archives' which goes to
> 
>   https://stat.ethz.ch/pipermail/r-help/
> 
> which are the official R-help archives (on that same server stat.ethz.ch
> provided to the R community by the Math Dept. of ETH Zurich).
> They work "fine" but don't have a nice 1-click search interface.
> So you what has worked for ca 20 years
> {{ but people probably
>   mostly have not learned anymore thanks to the universally "fool
>   proof" search interface
> }}
> still works fine: Use  the site: trick,  i.e.,
> 
> where I found that adding "pipermail" is also somewhat important
> to find more mailing list answers (than R help pages which are
> also served from there).
> E.g., 
>  site:stat.ethz.ch pipermail R windows GUI scaling
> 
> finds a lot (but maybe nothing relevant to your search), notably
> with Google;
> a bit less unfortunately  with my usual search engine "Duck Duck
> Go" (which is *not* keeping track as much as Google of everything I do )
> 
> 
>> I got a Error 522 page from GMANE.
> 
> Yes, unfortunately...  Should probably remove that link from the
> R-help info page; it has gone for several years now AFAIK.
> 
> Martin Maechler
> ETH Zurich and R Core Team
> 
> 
> 
>> Nabble returned 2 hits for variations on the search terms
>> "rgui high dpi 4k"
>> http://r.789695.n4.nabble.com/Font-Size-for-View-under-Linux-td4746104.html
>>
>> http://r.789695.n4.nabble.com/Bug-report-problems-with-saving-plots-on-a-Windows-PC-with-4k-monitor-wrong-picture-size-td4752183.html
>> None are relevant here.
> 


Hi,

Just to amplify Martin's comments, if you go to the main R Project web site, 
you will find, in the left hand navigation links the following:

Search:
https://www.r-project.org/search.html

and 

Getting Help:
https://www.r-project.org/help.html

both of which eventually link to search resources such as rseek.org, which are 
dedicated to R related searches.

Using rseek.org and the "All" tab, with the same search phrase as above, though 
not quoted, led to the following two hits:

R-Devel from 2015:
https://stat.ethz.ch/pipermail/r-devel/2015-September/071732.html

A Microsoft support note:
https://support.microsoft.com/en-my/help/4091364/windows-10-fix-blurry-apps

It is not clear to me if either is helpful here in the end as I do not have a 
4K display, but at least shows alternative results using rseek.org.

Note that rseek.org, includes other sources beyond the official R e-mail list 
archives, which is why the MS note comes up. You can narrow the results by 
using the various tab options at the top of the page.

Regards,

Marc Schwartz

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

2019-06-07 Thread Marc Schwartz via R-help
Hi Martin,

See inline below...

> On Jun 7, 2019, at 9:25 AM, Martin Maechler  
> wrote:
> 
>>>>>> Marc Schwartz via R-help 
>>>>>>on Fri, 7 Jun 2019 09:07:21 -0400 writes:
> 
>> Hi, Ok, some additional tweaks.
> 
>> Relative to Bert's pointing out the aesthetic issues,
>> certainly, those are attributes that can be adjusted as
>> Nick may require. I was focused more on the primary
>> issue. Using "..." is an easy way to pass additional
>> parameters to plot.default() as Bert indicated.
> 
>> To Duncan's point, here is a modification of my original
>> function to allow for the passing of an expression, rather
>> than pre-creating a function and passing that:
> 
>> plotFx <- function(x, expr, ...) {
>>  expr <- substitute(expr)
>> y <- eval(expr)
>>  plot(x, y, main = paste0("Plot of y = ", deparse(expr)), ...)
>> }
> 
>> plotFx(1:10, x^2)
>> plotFx(1:10, cos(x))
>> plotFx(1:10, exp(x) + 1)
> 
> well yes
> 
> Ross/Robert/??  had invented  the  curve()   function to do
> something like that even before R got a version number !!
> and we (it may have been me) had added a
> 
> plot.function()   method for plot()  which behaved very
> similarly, also long before R version 1.0.x
> 
> Are you sure you don't want to use one of
> 
>plot(, ...)
> or
>curve(..)
> 
> instead of what you are doing now?


Very possibly, and thank you for rightly pointing those out Martin!

I think that, at least for me on initial reading, the focus was on the need for 
a plot title that combined the paste()d character vector of "Plot of y = " with 
the expression on 'x' itself, as perhaps opposed to the y axis labeling as 
generated by default in those two functions. My initial attempt with plotmath 
below, was incorrectly focused on the need for a TeX-like formatting of the 
title.

I guess, it will depend upon Nick's specific use case and labeling requirements 
and if the default approach in these two functions in creating the y axis 
labels, as opposed to a plot title, are satisfactory.

Also, unless I missing a nuance in the functions, with plot.function() calling 
curve() internally, they appear to allow the specification of the min/max range 
of x values to use and then plotting an equally spaced number of x values 
within that range (e.g. x <- seq(from, to, length.out = n)), rather than 
explicitly defining/passing a vector of x values to use. That may be something 
that Nick wishes to do.


> Look at the result of
> 
>  example(plot.function)
> 
> and
> 
>  example(curve)
> 
> to get a bit of a show-off of these ..


Indeed. Be aware that both functions are on the same help page, thus running 
the examples above will run the same code.


> 
>> There are likely additional tweaks that could be made, as Nick may require.
> 
>> Regards,
>> Marc
> 
> ... tweaks which may already be available in curve() / plot.function().
> At the time, I had invested many many man hours to tweak them to
> become as versatile as seemed feasible ...
> 
> Martin Maechler
> ETH Zurich and R Core


Indeed, and thank you again Martin for rightly pointing these out.

Regards,

Marc

> 
> 
> 
>>> On Jun 6, 2019, at 5:53 PM, Duncan Murdoch  wrote:
>>> 
>>> These look like very fragile suggestions.  Allow x^2 to be an argument 
>>> (named expr, for example) to plotFx, don't force a user to write a function 
>>> in a very particular way.  Then use deparse(substitute(expr)) in the title.
>>> 
>>> Duncan Murdoch
>>> 
>>> On 06/06/2019 4:33 p.m., Bert Gunter wrote:
>>>> Well, if you want to do it this way, note that as written, the y axis
>>>> default label isn't "nice," and you should anyway allow for additional
>>>> graphical arguments (either way). Also, slightly better I think is to use
>>>> the built-in access function, body():
>>>> plotFx <- function(x, fun, ...) {
>>>> plot(x, fun(x), main = paste0("Plot of y = ", deparse(body(fun))), ...)
>>>> }
>>>> x <- 1:10
>>>> f <- function(x) x^2
>>>> plotFx(x, f, col = "red", ylab = "y")
>>>> 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 Thu, Jun 6, 2019 at 12:19 PM Marc Schwartz  wrote:
>>>>> Hi,
>>>>> 
>>>>&

Re: [R] Pasting R code lines into labels

2019-06-07 Thread Marc Schwartz via R-help
Hi,

Ok, some additional tweaks.

Relative to Bert's pointing out the aesthetic issues, certainly, those are 
attributes that can be adjusted as Nick may require. I was focused more on the 
primary issue. Using "..." is an easy way to pass additional parameters to 
plot.default() as Bert indicated.

To Duncan's point, here is a modification of my original function to allow for 
the passing of an expression, rather than pre-creating a function and passing 
that:

plotFx <- function(x, expr, ...) {
   expr <- substitute(expr)
   y <- eval(expr)
   plot(x, y, main = paste0("Plot of y = ", deparse(expr)), ...)
}

plotFx(1:10, x^2)
plotFx(1:10, cos(x))
plotFx(1:10, exp(x) + 1)


There are likely additional tweaks that could be made, as Nick may require.

Regards,

Marc

> On Jun 6, 2019, at 5:53 PM, Duncan Murdoch  wrote:
> 
> These look like very fragile suggestions.  Allow x^2 to be an argument (named 
> expr, for example) to plotFx, don't force a user to write a function in a 
> very particular way.  Then use deparse(substitute(expr)) in the title.
> 
> Duncan Murdoch
> 
> On 06/06/2019 4:33 p.m., Bert Gunter wrote:
>> Well, if you want to do it this way, note that as written, the y axis
>> default label isn't "nice," and you should anyway allow for additional
>> graphical arguments (either way). Also, slightly better I think is to use
>> the built-in access function, body():
>> plotFx <- function(x, fun, ...) {
>>plot(x, fun(x), main = paste0("Plot of y = ", deparse(body(fun))), ...)
>> }
>> x <- 1:10
>> f <- function(x) x^2
>> plotFx(x, f, col = "red", ylab = "y")
>> 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 Thu, Jun 6, 2019 at 12:19 PM Marc Schwartz  wrote:
>>> Hi,
>>> 
>>> Sorry for the misfire on the first attempt.
>>> 
>>> After seeing the clarifications, I thought about a possible way to do
>>> this, perhaps a little more simply, while encapsulating the plotting in a
>>> function:
>>> 
>>> plotFx <- function(x, fun) {
>>>   plot(x, fun(x), main = paste0("Plot of y = ", deparse(fun)[2]))
>>> }
>>> 
>>> So let's say that you have:
>>> 
>>> x <- 1:10
>>> 
>>> f <- function(x) x^2
>>> plotFx(x, f)
>>> 
>>> f <- function(x) cos(x)
>>> plotFx(x, f)
>>> 
>>> f <- function(x) exp(x) + 1
>>> plotFx(x, f)
>>> 
>>> 
>>> In the case of the first function, you get:
>>> 
>>>> deparse(f)
>>> [1] "function (x) " "x^2"
>>> 
>>> for the second:
>>> 
>>>> deparse(f)
>>> [1] "function (x) " "cos(x)"
>>> 
>>> and for the third:
>>> 
>>>> deparse(f)
>>> [1] "function (x) " "exp(x) + 1"
>>> 
>>> 
>>> Thus, the "deparse(fun)[2]" snippet within the internal paste0() function
>>> call, gets you the second, textual part of the function body, which can
>>> then be passed as a character vector to the titles or other labels as
>>> needed.
>>> 
>>> A potential gotcha that I would envision, is that the default width in the
>>> character vector resulting from deparse() is 60. Thus, by default the
>>> function body would broken up into multiple character segments, no longer
>>> than approximately 60 characters each. Thus, if you envision that you might
>>> end up with very long formulae on x, you may need to adjust the
>>> width.cutoff argument in the deparse() call, and likely need to do some
>>> additional formatting of the labels in the plot as apropos.
>>> 
>>> There may be other functional nuances that I am missing here, but this may
>>> be a suitable approach.
>>> 
>>> Regards,
>>> 
>>> Marc
>>> 
>>> 
>>>> On Jun 6, 2019, at 2:11 PM, Bert Gunter  wrote:
>>>> 
>>>> Yes, plot(z,y,..)
>>>> 
>>>> Bert
>>>> 
>>>> On Thu, Jun 6, 2019 at 9:21 AM Nick Wray 
>>> wrote:
>>>> 
>>>>> Thanks Bert, that is exactly what I wanted.  I think that you meant
>>>>> plot(z,y... in the last line?
>>>>> 
>>>>> Nick
>>>>> 

Re: [R] Pasting R code lines into labels

2019-06-06 Thread Marc Schwartz via R-help
Hi,

Sorry for the misfire on the first attempt.

After seeing the clarifications, I thought about a possible way to do this, 
perhaps a little more simply, while encapsulating the plotting in a function:

plotFx <- function(x, fun) {
  plot(x, fun(x), main = paste0("Plot of y = ", deparse(fun)[2]))
}

So let's say that you have:

x <- 1:10

f <- function(x) x^2
plotFx(x, f)

f <- function(x) cos(x)
plotFx(x, f)

f <- function(x) exp(x) + 1
plotFx(x, f)


In the case of the first function, you get:

> deparse(f)
[1] "function (x) " "x^2" 

for the second:

> deparse(f)
[1] "function (x) " "cos(x)" 

and for the third:

> deparse(f)
[1] "function (x) " "exp(x) + 1" 


Thus, the "deparse(fun)[2]" snippet within the internal paste0() function call, 
gets you the second, textual part of the function body, which can then be 
passed as a character vector to the titles or other labels as needed.

A potential gotcha that I would envision, is that the default width in the 
character vector resulting from deparse() is 60. Thus, by default the function 
body would broken up into multiple character segments, no longer than 
approximately 60 characters each. Thus, if you envision that you might end up 
with very long formulae on x, you may need to adjust the width.cutoff argument 
in the deparse() call, and likely need to do some additional formatting of the 
labels in the plot as apropos.

There may be other functional nuances that I am missing here, but this may be a 
suitable approach.

Regards,

Marc


> On Jun 6, 2019, at 2:11 PM, Bert Gunter  wrote:
> 
> Yes, plot(z,y,..)
> 
> Bert
> 
> On Thu, Jun 6, 2019 at 9:21 AM Nick Wray  wrote:
> 
>> Thanks Bert, that is exactly what I wanted.  I think that you meant
>> plot(z,y... in the last line?
>> 
>> Nick
>> 
>> On 06 June 2019 at 17:13 Bert Gunter  wrote:
>> 
>> ... and if you wanted too streamline the process, something like the
>> following could be encapsulated in a function:
>> 
>> fun <- quote(exp(x))
>> z <- 1:9
>> y <- eval(fun,list(x = z) )
>> plot(x, y, main = paste("Plot of y =", deparse(fun)))
>> 
>> Further details can be found in the "Computing on the Language" section of
>> the "R Language Reference" manual or from suitable tutorials on the web.
>> 
>> 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 Thu, Jun 6, 2019 at 8:55 AM Nick Wray via R-help < r-help@r-project.org>
>> wrote:
>> 
>> Thanks but that's not quite what I meant
>> I am trying out different functions and they don't necessarily vary in a
>> regular way (like say all being powers of x where it'd be simple to just
>> have a vector for the powers you want)
>> So I might have
>> y<-x^2
>> y<-cos(x)
>> y<-exp(x+1)
>> What I am after is a way of running these functions and then calling each
>> one into the labelling for the appropriate graph as I plot it.  So then I
>> would have something like
>> mainlab<-paste("Plot of ",function in question)
>> ...? Thanks Nick
>> 
>>> On 06 June 2019 at 16:40 Marc Schwartz < marc_schwa...@me.com> wrote:
>>> 
>>> 
>>> 
>>>> On Jun 6, 2019, at 11:19 AM, Nick Wray via R-help <
>> r-help@r-project.org> wrote:
>>>> 
>>>> Is there any way of taking a line of r code (eg y<-x^2) and pasting
>> that line of code, as is, into a label, so that for example I could then
>> have a plot label "Plot of y<-x^2"?
>>>> 
>>>> Thanks Nick Wray
>>> 
>>> 
>>> Hi,
>>> 
>>> See ?plotmath
>>> 
>>> An example:
>>> 
>>> x <- 1:10
>>> y <- x^2
>>> 
>>> plot(x, y, main = expression(paste("Plot of ", y %<-% x^2)))
>>> 
>>> 
>>> There are other incantations and examples on the help page above.
>>> 
>>> Regards,
>>> 
>>> Marc Schwartz
>>> 

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

2019-06-06 Thread Marc Schwartz via R-help


> On Jun 6, 2019, at 11:19 AM, Nick Wray via R-help  
> wrote:
> 
> Is there any way of taking a line of r code (eg y<-x^2) and pasting that line 
> of code, as is, into a label, so that for example I could then have a plot 
> label "Plot of y<-x^2"?
> 
> Thanks Nick Wray 


Hi,

See ?plotmath

An example:

x <- 1:10
y <- x^2

plot(x, y, main = expression(paste("Plot of ", y %<-% x^2)))


There are other incantations and examples on the help page above.

Regards,

Marc Schwartz

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

2019-06-03 Thread Marc Schwartz via R-help


> On Jun 3, 2019, at 12:13 PM, Christian Martin Hennig 
>  wrote:
> 
> Dear list members,
> 
> checking my updated version of prabclus with R-devel --as-cran I get a 
> mysterious note:
> 
> "* checking DESCRIPTION meta-information ... NOTE
> Checking should be performed on sources prepared by ‘R CMD build’."
> 
> (No further information is given on that one in 00check.log.)
> 
> But my source is in fact put together by R CMD build.
> 
> Can anybody tell me what could be wrong here and how to remove the note?
> 
> DESCRIPTION looks like this:
> 
> Package: prabclus
> Title: Functions for Clustering and Testing of Presence-Absence, 
> Abundance and Multilocus Genetic Data
> Version: 2.3-1
> Date: 2019-06-03
> Author: Christian Hennig ,
> Bernhard Hausdorf 
> Depends: R (>= 2.10), MASS, mclust
> Suggests: spdep, spatialreg, bootstrap, maptools, foreign, mvtnorm
> Description: Distance-based parametric bootstrap tests for clustering with
>   spatial neighborhood information. Some distance measures,
>   Clustering of presence-absence, abundance and multilocus genetical data
>   for species delimitation, nearest neighbor
>   based noise detection. Genetic distances between communities.
>   Tests whether various distance-based regressions
>   are equal. Try package?prabclus for on overview.
> Maintainer: Christian Hennig 
> License: GPL
> URL: https://www.unibo.it/sitoweb/christian.hennig/en/
> 
> Thanks,
> 
> Christian
> 


Hi Christian,

Two things:

1. This should be posted to R-package-devel, which is focused on R/CRAN package 
development:

  https://stat.ethz.ch/mailman/listinfo/r-package-devel


2. What are the exact commands that you used to build and then check the 
package?

"R CMD build" should result in a source tarball with the extension ".tar.gz", 
which should then be used fully in the "R CMD check" call.

Perhaps the file that you named in the R CMD check call is not correct?

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] [R-pkgs] WriteXLS version 5.0.0 now available

2019-05-28 Thread Marc Schwartz via R-packages
Hi all,

I am pleased to announce that WriteXLS version 5.0.0 is now available on CRAN:

  https://cran.r-project.org/web/packages/WriteXLS/index.html

This supersedes version 4.1.0 and should appear on your local CRAN mirror in 
due course, if not there already.

WriteXLS, first released in 2009, is a cross-platform, Perl-based R function to 
create Excel 2003 (XLS) and Excel 2007 (XLSX) files from one or more data 
frames. 

The primary change in this major new version is improved support for 
Unicode/UTF-8 variable width character sets, especially on Windows. This is 
accomplished via the use of writeLines(..., useBytes = TRUE), rather than 
write.table(), to create intermediate CSV files from the source R data frames. 
These exported CSV files are then parsed by Perl scripts to create the 
resultant Excel file.

The prior use of write.table() to create the CSV files could result in the 
re-encoding of the content of the CSV files into the locale of the computer 
upon which the code is running. This could result in the loss of the source 
character encoding used in the originating R data frames, where variable width 
character sets are in use. This was primarily an issue on Windows, given the 
limitations of Unicode/UTF-8 support on that OS.

I want to thank Hamid Moshen for first raising this issue in late March, 
providing test datasets in multiple Unicode/UTF-8 character sets that I could 
use to reproduce and correct the issues, and his testing of the changes 
required.

Warm regards,

Marc Schwartz

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

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


Re: [R] Help understanding the relationship between R-3.6.0 and RStudio

2019-05-17 Thread Marc Schwartz via R-help



> On May 17, 2019, at 2:02 PM, Bill Poling  wrote:
> 
> Hello.
> 
> I do not think I have had this problem (assuming it is a problem) in the past.
> 
> I downloaded and installed R3.6.0 which is indicted in the console when I 
> open R itself.
> 
> R version 3.6.0 RC (2019-04-24 r76423) -- "Planting of a Tree"
> Copyright (C) 2019 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> 
> However, in RStudio the sessionInfo() remains
> 
> R version 3.5.3 (2019-03-11)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 17134)
> 
> I also installed the latest version of RStudio 1.2.1335 as well "after" 
> installing R 3.6.0.
> 
> I also rebooted my computer.
> 
> I am not sure why this time the two do not seem to be (for lack of a better 
> word) in sink?
> 
> Thank you for any insight
> 
> WHP


Hi,

I don't use RStudio, which is a GUI/IDE on top of R, it is not R.

That being said, a quick Google search supports my intuition, which is that 
RStudio appears to be able to support multiple R version installations:

  
https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop

RStudio also has their own support venue:

  https://support.rstudio.com/hc/en-us

If I read correctly, it looks like you actually installed a "Release Candidate" 
(RC) version of 3.6.0 for Windows. So you probably want to visit a CRAN mirror 
and download the release version of 3.6.0:

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"

If you do not want to have multiple R versions on your computer, you can use 
the normal Windows application uninstall process to remove the older version(s).

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Bounding box on plotting files inserted into a LaTeX document

2019-05-16 Thread Marc Schwartz via R-help



> On May 16, 2019, at 7:04 PM, Patrick Connolly  
> wrote:
> 
> I'm trying to write basic latex code to insert a pdf graphic into a
> document.  I can use Rstudio to knit an Rmd file successfully
> inserting the plot into the document.  I can get the latex code if the
> "save tex" box is ticked, so I get the correct syntax used.  
> 
> I don't need all the fancy things that .Rmd files can handle.  I just
> want a simple .tex file.  However, if I try to use a pdf file normally
> produced by using the pdf device, I get a message about a missing
> bounding box.  So I thought it might work to use R to make an eps
> file, which pdflatex automatically converts to a pdf.  It does import
> the graphic, but it takes up a whole page, which indicates that it
> ignores the bounding box.
> 
> What does work is to use Rstudio interactively to export the graphic
> to a pdf file which pdflatex handles correctly.  But that's a clunky
> procedure which I'd like to avoid.  It must be possible since graphs
> were included in LaTeX documents for decades before there was Rstudio.
> 
> TIA


Patrick,

Are you explicitly calling postscript() in an R session to create the figure?

If so, see the Details section of ?postscript, which notes the following:

The postscript produced for a single R plot is EPS (Encapsulated PostScript) 
compatible, and can be included into other documents, e.g., into LaTeX, using 
\includegraphics{}. For use in this way you will probably want to use 
setEPS() to set the defaults as horizontal = FALSE, onefile = FALSE, paper = 
"special". Note that the bounding box is for the device region: if you find the 
white space around the plot region excessive, reduce the margins of the figure 
region via par(mar = ).

So essentially:

postscript("YourPlot.eps", width = 6.0, height = 6.0,
   horizontal = FALSE, onefile = FALSE, paper = "special")

Plot code here...

dev.off()



Note that instead of pdflatex, you can also use latex, followed by dvips and 
then ps2pdf, if you want to go that way with the CLI workflow. Might depend 
upon whether or not you use other PS specific markup in the .tex file, like 
pstricks. For example:

latex YourTeXFile.tex
dvips YourTeXFile -o YourTexFile.ps
ps2pdf YourTeXFile.ps YourTeXFile.pdf


Regards,

Marc Schwartz

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

2019-04-29 Thread Marc Schwartz via R-help
Hi Guys,

I suspect that this entry from news() for 3.6.0 is relevant:

"When loading namespaces, S3 method registrations which overwrite previous 
registrations are now noted by default (using packageStartupMessage())."


Always a good idea to read the NEWS file with a x.y point release. Peter 
usually includes it in his release announcement e-mail:

  https://stat.ethz.ch/pipermail/r-help/2019-April/462510.html


Regards,

Marc Schwartz


> On Apr 29, 2019, at 7:32 PM, Rolf Turner  wrote:
> 
> 
> On 30/04/19 11:08 AM, Bert Gunter wrote:
> 
>> Offlist, as this might be complete baloney.
> 
> Thanks Bert.
> 
> I am CC-ing this reply to the r-help list since your suggestion is *NOT* 
> complete baloney at all!
> 
>> What dependencies does your package have? -- is it possible that some of 
>> these dependent packages have made changes or added features that have 
>> ggplot2 etc. dependencies that cause these issues?
> 
> 
> 
> The package has no dependencies as such, but "Imports" a number of packages.  
> I tried loading these, one by one, and when I did
> 
> library(brms)
> 
> I got the message that was triggered by loading my package.  So that is the 
> source of the problem.  If it is indeed a problem.
> 
> The question remains:  is this message something that I (or the maintainer of 
> brms) should be worried about?
> 
> cheers,
> 
> Rolf
> 
>> On Mon, Apr 29, 2019 at 3:55 PM Rolf Turner > <mailto:r.tur...@auckland.ac.nz>> wrote:
>>I just installed the latest version of R on my laptop (running Ubuntu
>>18.04; used "sudo apt-get install r-base".)
>>Now when I load a package that I have written I get a message on screen:
>> > Registered S3 methods overwritten by 'ggplot2':
>> >   method from
>> >   [.quosures rlang
>> >   c.quosures rlang
>> >   print.quosures rlang
>> > Registered S3 method overwritten by 'dplyr':
>> >   method   from
>> >   as.data.frame.tbl_df tibble
>> > Registered S3 method overwritten by 'xts':
>> >   method from
>> >   as.zoo.xts zoo
>>What is the import of this (mysterious and cryptic) pronouncement?  I
>>don't understand it at all.  My package makes no use of ggplot2, dplyr
>>or xts.
>>Should I be worried?  Are there adjustments that I should make to my
>>package (e.g. to NAMESPACE)?
>>Thanks for any tips.
>>cheers,
>>Rolf Turner
>>-- 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] Error in pglm function when performing logit regression on Panel Data

2019-04-23 Thread Marc Schwartz via R-help


> On Apr 23, 2019, at 2:43 PM, Paul Bernal  wrote:
> 
> Dear friends,
> 
> The following error is generated when trying to fit a logistic regression
> with the pglm function:
> 
>> PGLM_Model2 <-
> pglm(dataframe2$TRANSIT~dataframe2$Draft+dataframe2$TOTALCOST+dataframe2$BUNKER+dataframe2$CHARTERVALUE,
> effect=c("twoways"), family=binomial('logit'), index=dataframe2$ID,
> data=dataframe2)
> Error in pdata.frame(data, index) :
>  'index' can be of length 3 at the most (one index variable for
> individual, time, group)
> 
> This doesn´t make sense to me because the maximum length for ID is 3 and I
> checked it twice.
> 
> A few things to keep in mind:
> 1. I am using R version 3.5.3
> 2. My worstation has Windows 8 and it is a 64-bit OS
> 
> I would like to know what I´m doing wrong and how to solve this issue (if
> possible). I provide a dput() of my dataset below:
> 
> dput(dataframe2)'



> Any guidance will be greatly appreciated,
> 
> Best regards,
> 
> Paul


Hi Paul,

I do not use pglm, but installed it.

Thanks for providing the dput() output of your data frame.

As is typical with R modeling functions, there is a reason for the 'data' 
argument, rather than specifying the 'dataframe$' prefix syntax for each DV and 
IV.

It shortens the code required to specify the formula, but perhaps more 
importantly, it defines the environment within which the function can find the 
variables to be used by the function, as specified by the various arguments.

In this case, that is critical, since, as per the examples in ?pglm, the 
'index' argument is to be specified as a character vector and not as the vector 
objects themselves. That is, use "ID" and not ID. Therefore, the function will 
search for the vector/column named "ID" within the dataframe2 object, which is 
the argument to 'data'.

Unfortunately, the help for the function does not make it clear that the value 
for 'index' should be a character vector, it simply says 'the index'. Thus one 
needs to look at the examples for some guidance.

You might want to point that out to the maintainer of the package (copied here 
now) as an improvement in the documentation.

Thus:

> pglm(TRANSIT ~ Draft + TOTALCOST + BUNKER + CHARTERVALUE, data = dataframe2, 
> effect = "twoways", family = binomial("logit"), index = "ID")
Maximum Likelihood estimation
Newton-Raphson maximisation, 0 iterations
Return code 100: Initial value out of range.


You now have other issues to deal with, which appear to be coming from the 
maxLik() function used from the package of the same name, which is a dependency 
for pglm, and I will leave those to you to resolve, probably using the 'start' 
argument to pglm().

Regards,

Marc Schwartz

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


Re: [R] Logistic Regression with Panel Data

2019-04-23 Thread Marc Schwartz via R-help


> On Apr 23, 2019, at 8:26 AM, Paul Bernal  wrote:
> 
> Dear friends, hope you are all doing great,
> 
> I would like to know if there is any R package that allows fitting of
> logistic regression to panel data.
> 
> I installed and loaded package plm, but from what I have read so far, plm
> only allows fitting of linear regression to panel data, not logistic.
> 
> Any help and/or guidance will be greatly appreciated,
> 
> Best regards,
> 
> Paul


Hi Paul,

You might look at the pglm package on CRAN.

Since there can be multiple methodologies that are apropos in this setting, 
such as GEE, mixed-effects, robust covariance matrix, etc., you might want to 
look at the CRAN task view that covers this domain:

  https://cran.r-project.org/web/views/Econometrics.html

Regards,

Marc Schwartz

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

2019-04-09 Thread Marc Schwartz via R-help



> On Apr 9, 2019, at 9:07 AM, bienvenidoz...@gmail.com wrote:
> 
> how to create
> u = (1, −1, 2, −2, . . . , 100, −100)  in r
> 
> Thanks
> Bienvenue

Hi,

See ?seq and ?rep

> rep(seq(100), each = 2) * c(1, -1)
  [1]1   -12   -23   -34   -45   -56   -67
 [14]   -78   -89   -9   10  -10   11  -11   12  -12   13  -13
 [27]   14  -14   15  -15   16  -16   17  -17   18  -18   19  -19   20
 [40]  -20   21  -21   22  -22   23  -23   24  -24   25  -25   26  -26
 [53]   27  -27   28  -28   29  -29   30  -30   31  -31   32  -32   33
 [66]  -33   34  -34   35  -35   36  -36   37  -37   38  -38   39  -39
 [79]   40  -40   41  -41   42  -42   43  -43   44  -44   45  -45   46
 [92]  -46   47  -47   48  -48   49  -49   50  -50   51  -51   52  -52
[105]   53  -53   54  -54   55  -55   56  -56   57  -57   58  -58   59
[118]  -59   60  -60   61  -61   62  -62   63  -63   64  -64   65  -65
[131]   66  -66   67  -67   68  -68   69  -69   70  -70   71  -71   72
[144]  -72   73  -73   74  -74   75  -75   76  -76   77  -77   78  -78
[157]   79  -79   80  -80   81  -81   82  -82   83  -83   84  -84   85
[170]  -85   86  -86   87  -87   88  -88   89  -89   90  -90   91  -91
[183]   92  -92   93  -93   94  -94   95  -95   96  -96   97  -97   98
[196]  -98   99  -99  100 -100


Regards,

Marc Schwartz

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

2019-04-05 Thread Marc Schwartz via R-help
Hi,

To supplement Bert's reply, there is not a specific SIG list for R in 
healthcare, however, there are a number of us, both in the pre-clinical and 
clinical realm, that participate here on R-Help.

As Bert noted, for genomic applications, the Bioconductor folks have their own 
lists.

If you have specific R programming related queries that are for applications 
such as clinical trials and related study types, feel free to ask here.

If you have more conceptual queries regarding statistical methodologies and 
related topics, those would be off-topic here, and you might wish to check out:

1. The MedStats group on Google
https://groups.google.com/forum/#!forum/medstats

2. datamethods group
https://discourse.datamethods.org


Regards,

Marc Schwartz


> On Apr 5, 2019, at 12:39 AM, Bert Gunter  wrote:
> 
> https://www.r-project.org/mail.html
> 
> Found immediately by a web search on "R Mailing lists" . Please make a
> minimal effort yourself before posting, or let us know if you have already
> done so but came up empty.
> 
> You might try here for genomics:
> https://www.bioconductor.org/help/support/
> 
> "Healtrhcare" and "Biology" are far too vague and all-encompassing, imo.
> This might be of some use to you, however:
> https://cran.r-project.org/web/views/
> 
> -- Bert
> 
> 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 Thu, Apr 4, 2019 at 8:34 PM H  wrote:
> 
>> Are there any SIGs for the use of R in healthcare or in genomics or
>> biology?
>>[[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] high p values

2019-03-19 Thread Marc Schwartz via R-help
Hi,

Since folks are taking the time to point out some subtle issues here, taking an 
example from the UCLA Stats web site:

https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faq-why-is-the-mann-whitney-significant-when-the-medians-are-equal/

Grp1 <- rep(c(-2, 0, 5), each = 20)
Grp2 <- rep(c(-1, 0, 10), each = 20)

> Grp1
 [1] -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2 -2  0  0
[23]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  5  5  5  5
[45]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
> Grp2
 [1] -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1  0  0
[23]  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 10 10 10 10
[45] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10

> median(Grp1)
[1] 0
> median(Grp2)
[1] 0

> wilcox.test(Grp1, Grp2)

Wilcoxon rank sum test with continuity correction

data:  Grp1 and Grp2
W = 1400, p-value = 0.03096
alternative hypothesis: true location shift is not equal to 0


So, in contrast to the original problem, here is an example where you have 
equal medians, but a significant test result.

The key concept is that the Wilcoxon Rank Sum test is not strictly a test of 
differences in medians. That is, the null hypothesis for the test is not that 
the medians are equal, and you are either accepting or rejecting that null. 

Javed, I would suggest spending some time with a good tutorial on 
non-parametric statistics.

Regards,

Marc Schwartz


> On Mar 19, 2019, at 6:25 PM, Jim Lemon  wrote:
> 
> Hi Javed,
> Easy.
> 
> A<-c(2000,2100,2300,2400,6900,7000,7040,7050,7060)
> median(A)
> [1] 6900
> B<-c(3300,3350,3400,3450,3500,7000,7100,7200,7300)
> median(B)
> [1] 3500
> wilcox.test(A,B,paired=FALSE)
> 
>   Wilcoxon rank sum test with continuity correction
> 
> data:  A and B
> W = 26.5, p-value = 0.233
> alternative hypothesis: true location shift is not equal to 0
> 
> Jim
> 
> On Wed, Mar 20, 2019 at 3:48 AM javed khan  wrote:
>> 
>> Hi
>> 
>> This is my function:
>> 
>> wilcox.test(A,B, data = data, paired = FALSE)
>> 
>> It gives me high p value, though the median of A column is 6900 and B
>> column is 3500.
>> 
>> Why it gives p value high if there is a difference in the median?
>> 
>> Regards

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Marc Schwartz via R-help



> On Mar 19, 2019, at 2:06 PM, Evan Cooch  wrote:
> 
> Just curious -- if R-help is a moderated list (which  in theory , it is -- my 
> posts have been 'modertated', to the degree that they aren't released to the 
> list until someone approves them), and if these 'statistics discussion' 
> questions are inappropriate to the mission (as described), then...why isn't 
> the 'moderator' (him/her/they) blocking on submission?
> 
> On 3/19/2019 1:59 PM, David Winsemius wrote:
>> Rhelp is not a forum for discussions of statistics. Instead it is for 
>> persons who have specific questions about the use of R.
>> 
>> Please read the list info page where you started the subscription process. 
>> And do read the Posting Guide. Both these are linked at the bottom of this 
>> response.
>> 
>> There are Web accessible forums that are set up to statistics.
>> 
> 

Evan,

While I cannot speak for the R-Help moderators, which is a 'larger' group, I am 
a co-moderator for R-Devel.

The initial moderation occurs when someone who has not subscribed to the list 
sends a post. The list software captures the post and sends the moderators a 
notification that there is a post from a non-subscriber requiring manual review.

If the post is not relevant to the specific R list and should be sent to 
another R list, where it is better suited given the focus of the topic, the 
post will be rejected and the poster informed of the reason. If it is not truly 
R related, per se, then a recommendation to send the post to StackExchange or 
similar will be send back to the poster, with a rejection of the post.

Once a sender's e-mail account has been approved to post, which generally means 
that they have both subscribed to the list in question and have sent at least 
one relevant post to the list, future posts are typically no longer moderated.

It is possible that once in a while, a moderator will miss something in the 
post content and approve it going to the list, but that should be a rare event.

A search of the R-Help archives suggests that Philip has posted previously, 
going to back at least 2011, which is likely why this particular post managed 
to not be moderated.

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Obtaining values of estimates from a regression; How do I get values from a list?

2019-02-22 Thread Marc Schwartz via R-help
Hi,

I was just about to reply with coef() when I saw John's reply come through.

Note that this is covered in An Introduction to R:

  
https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Generic-functions-for-extracting-model-information

If your model object is 'MOD', note that you can use:

  coef(MOD)

and 

  coef(summary(MOD))

depending upon the specific information that you need.

John provides the output of coef(fitchange) below. To contrast that with:

> coef(summary(fitchange))
   Estimate Std. Error   t value   Pr(>|t|)
(Intercept) -54.1010158 32.7217093 -1.653368 0.13685562
pre   0.6557661  0.3332963  1.967517 0.08466821


These extractor functions are also covered in some of the "See Also" sections 
of the help pages for the modeling functions such as ?lm.

A key advantage of using the extractor functions, is that they are independent 
of the underlying object structure. So, while it may be unlikely that the 
structure of these objects would change in the future, that is not guaranteed. 
Thus, using the extractor functions is more "future-proof" than directly 
accessing object components directly.

Regards,

Marc Schwartz


> On Feb 22, 2019, at 8:56 AM, Fox, John  wrote:
> 
> Dear John,
> 
> This seems to be more complicated than it needs to be. One normally uses 
> coef() to extract coefficients from a model object. Thus
> 
>> coef(fitchange)
> (Intercept) pre 
> -54.1010158   0.6557661 
>> coef(fitchange)[2]
>  pre 
> 0.6557661 
> 
> Best,
> John
> 
>  -
>  John Fox, Professor Emeritus
>  McMaster University
>  Hamilton, Ontario, Canada
>  Web: http::/socserv.mcmaster.ca/jfox
> 
>> On Feb 22, 2019, at 3:26 AM, Sorkin, John  wrote:
>> 
>> Problem solved:
>> 
>> summary(fitchange)$coefficients[2,1]
>> 
>> 
>> 
>> John David Sorkin M.D., Ph.D.
>> Professor of Medicine
>> Chief, Biostatistics and Informatics
>> University of Maryland School of Medicine Division of Gerontology and 
>> Geriatric Medicine
>> Baltimore VA Medical Center
>> 10 North Greene Street
>> GRECC (BT/18/GR)
>> Baltimore, MD 21201-1524
>> (Phone) 410-605-7119
>> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>> 
>> 
>> 
>> From: R-help  on behalf of Ivan Calandra 
>> 
>> Sent: Friday, February 22, 2019 2:58:47 AM
>> To: r-help@r-project.org
>> Subject: Re: [R] Obtaining values of estimates from a regression; How do I 
>> get values from a list?
>> 
>> I find that the str() function is really helpful to understand how an object 
>> is
>> structured, and therefore how to extract part(s) of it.
>> 
>> Try for example:
>> str(zz)
>> and it might help you understand why zz$coefficients[2,1] is what you were
>> looking for.
>> 
>> HTH
>> Ivan
>> 
>> --
>> Dr. Ivan Calandra
>> TraCEr, laboratory for Traceology and Controlled Experiments
>> MONREPOS Archaeological Research Centre and
>> Museum for Human Behavioural Evolution
>> Schloss Monrepos
>> 56567 Neuwied, Germany
>> +49 (0) 2631 9772-243
>> https://www.researchgate.net/profile/Ivan_Calandra
>> 
>> On February 22, 2019 at 8:50 AM Eric Berger  wrote:
>>> You have some choices
>>> 
>>> fitchange$coefficients[2]
>>> 
>>> zz$coefficients[2,1]
>>> 
>>> Note that class(zz$coefficients) shows that it is a matrix.
>>> 
>>> HTH,
>>> Eric
>>> 
>>> 
>>> On Fri, Feb 22, 2019 at 9:45 AM Sorkin, John 
>>> wrote:
>>> 
>>>> I am trying to obtain the coefficients from a regression (performed using
>>>> lm). I would like to get the value for the slope (i.e. estimate) for pre
>>>> from the following regression:
>>>> 
>>>> 
>>>> fitchange <- lm(post-pre~pre,data=mydata2)
>>>> 
>>>> 
>>>> I have tried the following without any success:
>>>> 
>>>> 
>>>> zz <- summary(fitchange)["coefficients"]
>>>> class(zz)
>>>> print(zz)
>>>> zz[[2,1]]
>>>> zz[2,1]
>>>> zz["pre","Estimate"]
>>>> 
>>>> 
>>>> I clearly don't know how to select elements from the list returned by the
>>>> summary function.
>>>> 
>>>> 
>>>> A reproducible version of my code follows:
>>>> 
&

Re: [R] matrix subset problem with factors

2019-02-20 Thread Marc Schwartz via R-help
Hi,

I get the same behavior in R 3.5.2 on macOS.

Others may feel differently, but I am not so sure that this is a bug, as 
opposed to perhaps the need to clarify in ?Extract, that the following, which 
is found under Atomic vectors:

"The index object i can be numeric, logical, character or empty. Indexing by 
factors is allowed and is equivalent to indexing by the numeric codes (see 
factor) and not by the character values which are printed (for which use 
[as.character(i)])."

also applies to the indexing of matrices and arrays.

Since matrices and arrays in R are vectors with 'dim' attributes, the behavior 
is essentially consistent as described above.

Thus, perhaps just add the second sentence above or similar wording to the 
section for Matrices and arrays.

Regards,

Marc Schwartz

> On Feb 20, 2019, at 4:23 AM, ঋষি ( ऋषि / rIsHi )  
> wrote:
> 
> Hi All,
> 
> I like to report this bug related to matrix subset by rownames when passed
> as factors. Now factors are may not be safe to use but then it should
> generate a warning message. Since many time we use values returned by some
> packages as factor to subset a matrix and which may result in a wrong
> calculation.
> 
> I wish if "factor" is not expected in matrix operation then it should throw
> an error/warning message.
> 
> Below are the codes to reproduce it.
> 
>> x <- matrix(1:9, nrow = 3, dimnames = list(c("X","Y","Z"),
> c("A","B","C")))
>> 
>> rNames <- as.factor(c("X","Z"))
>> # As some functions from different packages return factors and which
> could be overlooked
>> rNames
> [1] X Z
> Levels: X Z
>> 
>> x[rNames,]
>  A B C
> X 1 4 7
> Y 2 5 8
>> 
>> ## The intended matrix should return X and Z rows instead of X and Y
>> 
>> sessionInfo()
> R version 3.4.1 (2017-06-30)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.5 LTS
> 
> Matrix products: default
> BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
> LAPACK: /usr/lib/lapack/liblapack.so.3.0
> 
> locale:
> [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
> [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
> [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8
> [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
> [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
> 
> loaded via a namespace (and not attached):
> [1] compiler_3.4.1
>> 
> 
> 
> 
> With regards
> Rishi Das Roy

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Finding the Mean of a Specific Set of Columns

2019-02-14 Thread Marc Schwartz via R-help
On Feb 14, 2019, at 9:31 AM, Isaac Barnhart  wrote:
> 
> I am having trouble finding the mean of a specific part of my dataset. Here 
> is a sample of it:
> 
> plot lai leaf
> 1 104 82 1
> 2 104 167 2
> 3 104 248 3
> 4 104 343 4
> 5 104 377 5
> 6 105 64 1
> 7 105 139 2
> 8 105 211 3
> 9 105 296 4
> 10 105 348 5
> 11 106 94 1
> 12 106 167 2
> 13 106 243 3
> 14 106 281 4
> 15 106 332 5
> 16 108 83 1
> 17 108 382 2
> 18 108 320 3
> 19 108 146 4
> 20 108 129 5
> 
> I have many different plot numbers, none of which follow any kind of specific 
> numeric sequence (even though I have sorted them from smallest to largest). I 
> need to take the average (mean) of the LAI for each plot, and was wondering 
> if there was a way to specify the code to do this. For example: I need the 
> average of all the LAI measurements for each leaf of plot 104, 105, etc. Any 
> help would be appreciated. Thanks!


Hi, 

This is easy using base R functions. See ?aggregate, ?by and ?tapply for a 
starting place.

For example:

> aggregate(lai ~ plot, data = DF, FUN = mean)
  plot   lai
1  104 243.4
2  105 211.6
3  106 223.4
4  108 212.0

Regards,

Marc Schwartz

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

2019-01-30 Thread Marc Schwartz via R-help
Hi,

A quick Google search using "R periodicity" turned up the 'xts' package on CRAN:

  https://cran.r-project.org/web/packages/xts/index.html

Regards,

Marc Schwartz


> On Jan 30, 2019, at 2:24 PM, Sarah Goslee  wrote:
> 
> Hi Nick,
> 
> A quick look on rseek.org didn't turn anything up. It would help to
> know what websites you're referring to - they might be loading custom
> code.
> 
> Sarah
> 
> On Wed, Jan 30, 2019 at 2:17 PM Nick Wray via R-help
>  wrote:
>> 
>> I've found references on websites to an R function "periodicity", but 
>> there's no such built-in function as far as I can see in R studio.  I can't 
>> find reference to it being part of any package either.  Can anyone help with 
>> this?
>> 
>> 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.
> 
> 
> 
> -- 
> Sarah Goslee (she/her)
> http://www.numberwright.com
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

2019-01-17 Thread Marc Schwartz via R-help
Hi,

Just to emphasize Bert's e-mail with a hint, the 'mark.time' argument for 
plot.survfit() is FALSE by default.

Regards,

Marc Schwartz


> On Jan 17, 2019, at 2:45 PM, Bert Gunter  wrote:
> 
> Have you consulted ?plot.survfit ? There are examples for KM plots there.
> 
> Also, obvious question: Have you specfied the censoring properly in your
> data and fit?
> 
> 
> 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 Thu, Jan 17, 2019 at 11:39 AM Medic  wrote:
> 
>> According to the guidelines (if I'm not mistaken), the code below is
>> sufficient (without any specification) to give Kaplan-Meier curves with
>> censored data markings on Kaplan-Meier curves. But in my case censored data
>> don't appears on the curves?!
>> 
>> library(survival)
>> mydata<-read.csv (file="C:/mydata/mydata.csv", header=TRUE, sep=";" )
>> # Sic! The separator in my csv file is ";"
>> 
>> dput (mydata, "dputmydata.r")
>> #attached
>> 
>> Y <- Surv (mydata$time, mydata$status == 2)
>> # 2 -- encodes event
>> 
>> km <- survfit (Y~mydata$stage)
>> 
>> plot (km)

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

2019-01-08 Thread Marc Schwartz via R-help
Guys,

lattice is a "recommended" package, which means that it is installed by default 
with any standard R installation.

Thus, all that is required, as Sarah noted in an earlier reply, is either:

  library(lattice)

or 

  require(lattice)

depending upon preference.

latticeExtra, on the other hand, is a third party package that would need to be 
installed separately, if desired.

Regards,

Marc Schwartz


> On Jan 8, 2019, at 1:46 PM, Bert Gunter  wrote:
> 
> I think it's ?install.packages
> 
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> 
> On Tue, Jan 8, 2019 at 9:50 AM Rich Shepard 
> wrote:
> 
>> On Tue, 8 Jan 2019, S. Mahmoud Nasrollahi wrote:
>> 
>>> I have got a problem during working with some package in R and in spite
>> of
>>> trying with R help, internet and any other resources I could not succeed.
>>> Indeed when I what to install some function like bwplot, boxplot, xyplot
>> I
>>> receive this sort of messages: Warning in install.packages : package
>>> ‘xyplot’ is not available (for R version 3.5.2) Do you know how I can
>>> solve that?
>> 
>>   Yep. Those plots are part of the lattice package. You can install
>> lattice
>> (and latticeExtra if you want) with
>> 
>>> installpkg("lattice")
>> 
>> Happy plotting,
>> 
>> Rich

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Fit CMARS with R possible (Packages) ?

2019-01-04 Thread Marc Schwartz via R-help
Hi,

Like Bert, I was not able to find anything built in R.

It is possible that CMARS has not yet been implemented in R, or may be in 
development but not yet ready for release.

I found several references to the use of MOSEK (https://www.mosek.com) along 
with MATLAB, but both are commercial products.

The MOSEK developers appear to have an Rmosek interface package:

  https://docs.mosek.com/8.1/rmosek/index.html

which provides access to the MOSEK functionality via R. But, it requires 
MOSEK...

Perhaps others with more refined knowledge will jump in. It might also be 
reasonable to consider contacting what appears to be a small-ish group of 
common authors that I came across in the search who have described the 
methodology (e.g. Taylan or Yerlikaya-Özkurt) to see if they are aware of any R 
implementations.

Regards,

Marc Schwartz


> On Jan 4, 2019, at 5:16 PM, Bert Gunter  wrote:
> 
> rseek.org might be a better place to search if you haven't tried t
> herealready. However, my minimal effort there did not turn up any R
> software.  Maybe you can do better.
> 
> -- Bert
> 
> 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 Fri, Jan 4, 2019 at 11:31 AM varin sacha via R-help 
> wrote:
> 
>> Dear R-experts,
>> 
>> We can fit MARS regression using the packages "earth" and/or "mda" or
>> others packages.
>> However, I am wondering if it is possible to fit a CMARS (Conic
>> multivariate adaptive regression splines) using R ?
>> I have googled "conic MARS with R software", I did not get anything, so
>> Google is not my friend anymore !
>> 
>> If you have any solution, would be highly appreciated.
>> 
>> Best,

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] sample (randomly select) to get a number of successive days

2018-12-10 Thread Marc Schwartz via R-help
Hi,

Given that your original data frame example is:

myframe <- data.frame (Timestamp=c("24.09.2012 09:00:00", "24.09.2012 
10:00:00","25.09.2012 09:00:00",
   "25.09.2012 09:00:00","24.09.2012 09:00:00", 
"24.09.2012 10:00:00"),
   Event=c(50,60,30,40,42,54))

> str(myframe)
'data.frame':   6 obs. of  2 variables:
 $ Timestamp: Factor w/ 3 levels "24.09.2012 09:00:00",..: 1 2 3 3 1 2
 $ Event: num  50 60 30 40 42 54


Your Timestamp variable is a factor, not a datetime variable. So you first need 
to coerce it to one, in order to be able to define a range of dates.

Thus:

## See ?as.POSIXlt and the See Also links therein for more information on how R 
handles dates/times

myframe$Timestamp <- as.POSIXct(myframe$Timestamp, format = "%d.%m.%Y %H:%M:%S")

> str(myframe)
'data.frame':   6 obs. of  2 variables:
 $ Timestamp: POSIXct, format: "2012-09-24 09:00:00" ...
 $ Event: num  50 60 30 40 42 54


So, to keep it simple, since you appear to be only concerned during the range 
selection process with the day and not the time, let's use the day part of the 
datetime as the basis for defining your interval. So, for clarity, let's create 
a new column in the data frame that is just the date:

myframe$day <- as.Date(myframe$Timestamp)

> str(myframe)
'data.frame':   6 obs. of  3 variables:
 $ Timestamp: POSIXct, format: "2012-09-24 09:00:00" ...
 $ Event: num  50 60 30 40 42 54
 $ day  : Date, format: "2012-09-24" ...


> myframe
Timestamp Eventday
1 2012-09-24 09:00:0050 2012-09-24
2 2012-09-24 10:00:0060 2012-09-24
3 2012-09-25 09:00:0030 2012-09-25
4 2012-09-25 09:00:0040 2012-09-25
5 2012-09-24 09:00:0042 2012-09-24
6 2012-09-24 10:00:0054 2012-09-24


With that in place, let's presume that you selected 2012-09-24 as your starting 
date. You can then use ?seq.Date to define the range:

set.seed(1)
start <- sample(myframe$day, 1)

> start
[1] "2012-09-24"

> str(start)
 Date[1:1], format: "2012-09-24"


So, create the range of 25 dates:

> seq(start, length.out = 25, by = "day")
 [1] "2012-09-24" "2012-09-25" "2012-09-26" "2012-09-27" "2012-09-28"
 [6] "2012-09-29" "2012-09-30" "2012-10-01" "2012-10-02" "2012-10-03"
[11] "2012-10-04" "2012-10-05" "2012-10-06" "2012-10-07" "2012-10-08"
[16] "2012-10-09" "2012-10-10" "2012-10-11" "2012-10-12" "2012-10-13"
[21] "2012-10-14" "2012-10-15" "2012-10-16" "2012-10-17" "2012-10-18"


Now, use the result of the above to subset your data frame. See ?subset and 
?"%in%":

myframe.rand <- subset(myframe, day %in% seq(start, length.out = 25, by = 
"day"))


In your example, all rows will be returned, but from your larger dataset, you 
will only get the rows that have dates within the range defined.

Given the above, I will leave it to you to define the truncated date range from 
your full dataset, so that your initial starting date is sufficiently before 
your 'max' date, so that you can select 25 consecutive days.

Regards,

Marc Schwartz


> On Dec 10, 2018, at 2:37 AM, Dagmar Cimiotti 
>  wrote:
> 
> Hi Marc,
> 
> Yes, you got it to the point! That is exactly what I want. But I do not know 
> how to do that. I know how to randomly pick the first day but I do not know 
> how to set a range of values which cover the 25 days starting from that 
> random value.
> 
> Best,
> Dagmar
> 
> 
> Hi,
> 
> I am confused.
> 
> As far as I can tell, only the first day is selected randomly from your 
> dataset. The subsequent 24 days are deterministic, since they need to be 
> consecutive days from the first day, for a total of 25 consecutive days.
> 
> Thus, all you need to do is to randomly select 1 day from within the time 
> range of your dataset to be the first day, that is also far enough from the 
> maximum date, to allow you to then select the data from the additional 24 
> consecutive days.
> 
> So randomly pick your first day and set a range of values, covering the 25 
> days, to use to then subset your full dataset.
> 
> What am I missing?
> 
> Regards,
> 
> Marc Schwartz
> 
> 
>> On Dec 7, 2018, at 7:18 PM, Dagmar 
>> Cimiotti  wrote:
>> 
>> Hi Jim and everyone else,
>> 
>> Mhm, no this is not what I am looking for. I think in your way I would
>> randomly sample two values of day 1 and of day 2. But I want the
>> o

Re: [R] sample (randomly select) to get a number of successive days

2018-12-07 Thread Marc Schwartz via R-help
Hi,

I am confused.

As far as I can tell, only the first day is selected randomly from your 
dataset. The subsequent 24 days are deterministic, since they need to be 
consecutive days from the first day, for a total of 25 consecutive days. 

Thus, all you need to do is to randomly select 1 day from within the time range 
of your dataset to be the first day, that is also far enough from the maximum 
date, to allow you to then select the data from the additional 24 consecutive 
days.

So randomly pick your first day and set a range of values, covering the 25 
days, to use to then subset your full dataset.

What am I missing?

Regards,

Marc Schwartz


> On Dec 7, 2018, at 7:18 PM, Dagmar Cimiotti 
>  wrote:
> 
> Hi Jim and everyone else,
> 
> Mhm, no this is not what I am looking for. I think in your way I would 
> randomly sample two values of day 1 and of day 2. But I want the 
> opposite: I want to randomly draw two successive (!) days and put those 
> values in a new dataframe to continue working with them.
> 
> In my real data I do have a huge time span and I want to draw 25 
> consecutive days. So maybe my example was a little misleading. And now 
> that I read it again my text was, too. Sorry about that!
> 
> Good try though and I am very gratefull for your good will to help me
> Would anyone give another try?
> 
> Dagmar
> 
> Am 07.12.2018 um 10:30 schrieb Jim Lemon:
>> Hi Dagmar,
>> This will probably involve creating a variable to differentiate the
>> two days in each data.frame:
>> 
>> myframe$day<-as.Date(as.character(myframe$Timestamp),"%d.%m.%Y %H:%M:%S")
>> days<-unique(myframe$day)
>> 
>> Then just sample the two subsets and concatenate them:
>> 
>> myframe[c(sample(which(myframe$day==days[1]),2),
>>   sample(which(myframe$day==days[2]),2)),]
>> 
>> Jim
>> 
>> 
>> On Fri, Dec 7, 2018 at 8:08 PM Dagmar Cimiotti
>>  wrote:
>>> Dear all,
>>> 
>>> I have data from a time span like this:
>>> 
>>> myframe <- data.frame (Timestamp=c("24.09.2012 09:00:00", "24.09.2012 
>>> 10:00:00","25.09.2012 09:00:00",
>>>  "25.09.2012 
>>> 09:00:00","24.09.2012 09:00:00", "24.09.2012 10:00:00"),
>>>   Event=c(50,60,30,40,42,54) )
>>> myframe
>>> 
>>> 
>>> I want to create a new dataframe which includes in this example the 
>>> data from two successive days (in my real data I have a big time span 
>>> and want data from 25 consecutive days). I understand that I can do a 
>>> simple sample like this
>>> 
>>> mysample <- myframe[sample(1:nrow(myframe), 4,replace=FALSE),]
>>> mysample
>>> 
>>> But I need the data from consecutive days in my random sample. Can 
>>> anyone help me with this?
>>> 
>>> 
>>> Many thanks in advance,
>>> Dagmar

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Bootstrapping One- and Two-Sample Hypothesis Tests of Proportion

2018-11-29 Thread Marc Schwartz via R-help
Hi,

I don't see Duncan's reply in the archive, but consider:

> 1 / 4
[1] 0.25

> mean(c(1, 0, 0, 0))
[1] 0.25


> 3 / 9
[1] 0.333

> mean(c(1, 1, 1, 0, 0, 0, 0, 0, 0))
[1] 0.333


Regards,

Marc Schwartz

> On Nov 29, 2018, at 6:57 PM, Janh Anni  wrote:
> 
> Hi Bert,
> 
> You mean, just compute the test specifying the mean as the parameter but
> using 1's and 0's for the data?  Also I don't get how a proportion is a
> mean of 0/1 responses.  Could you please elaborate?  Thanks!
> 
> Janh
> 
> On Thu, Nov 29, 2018 at 6:45 PM Bert Gunter  wrote:
> 
>> ... but as Duncan pointed out already, I believe, a proportion **is** a
>> mean -- of 0/1 responses.
>> 
>> 
>> 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 Thu, Nov 29, 2018 at 3:30 PM Janh Anni  wrote:
>> 
>>> Hi Rui,
>>> 
>>> Thanks a lot for responding and I apologize for my late response.  I tried
>>> using the *boot.two.per* function in the wBoot package which stated that
>>> it
>>> could bootstrap 2-sample tests for both means and proportions but it
>>> turned
>>> out that it only works for the mean.
>>> 
>>> Thanks again,
>>> Janh
>>> 
>>> On Wed, Nov 28, 2018 at 12:38 PM Rui Barradas 
>>> wrote:
>>> 
>>>> Hello,
>>>> 
>>>> What have you tried?
>>>> Reproducible example please.
>>>> 
>>>> http://adv-r.had.co.nz/Reproducibility.html
>>>> 
>>>> 
>>> https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>>>> https://www.r-bloggers.com/minimal-reproducible-examples/
>>>> 
>>>> 
>>>> Rui Barradas
>>>> 
>>>> Às 22:33 de 27/11/2018, Janh Anni escreveu:
>>>>> Hello R Experts!
>>>>> 
>>>>> Does anyone know of a relatively straightforward way to bootstrap
>>>>> hypothesis tests for proportion in R?
>>>>> 
>>>>> Thanks in advance!
>>>>> 
>>>>> Janh


[[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] Importing SAS datasets into R efficiently

2018-10-19 Thread Marc Schwartz via R-help
Hi,

'foreign' will only read SAS XPT files, not the proprietary BDAT files, which I 
presume is the case here.

I don't use 'haven', but it looks like the key functions are written in C/C++, 
which should be relatively efficient.

If you are having specific issues with particular files,  because they are 
rather large, and/or have some kind of complex structure, you might want to 
communicate directly with the haven maintainers to see if there are some 
performance bottlenecks that perhaps they can resolve.

The only other option, to my knowledge, to directly read BDAT files in R, is 
the sas7bdat package on CRAN:

  https://cran.r-project.org/web/packages/sas7bdat/ 
<https://cran.r-project.org/web/packages/sas7bdat/>

However, it looks like it has not been updated in several years, so not sure of 
status.

Another alternative, if you have access to SAS, is to export the BDAT 
datasets(s) to CSV files in SAS, and them import them into R, using read.csv().

Regards,

Marc Schwartz


> On Oct 19, 2018, at 10:41 AM, Bert Gunter  wrote:
> 
> Have you looked at the "foreign" package?
> 
> -- Bert
> 
> 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 Fri, Oct 19, 2018 at 6:48 AM Jomy Jose  wrote:
> 
>> Hi
>> 
>> Is there an efficient way to import SAS datasets into R,presently while
>> using haven package it takes long time...Is there a smart work around this
>> ?
>> 
>> Thanks in advance
>> Jose


[[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] GLM Model Summary

2018-10-16 Thread Marc Schwartz via R-help



> On Oct 16, 2018, at 12:33 PM, Neslin, Scott A. 
>  wrote:
> 
> R-Help:
> 
> We are working with your GLM R package.  The Summary(Model) now gets printed 
> by the program as one object and we want to put the coefficient columns into 
> Excel.  We took an initial stab at this by counting the number of characters 
> occupied by each column.  But we have now learned that the number of 
> characters in a column depends on the length of the variable names, so is not 
> a constant number (e.g., 54 characters to a line).
> 
> We therefore ask, is it possible for us to get the Summary(Model) column by 
> column, i.e., a separate object for each column?  That way we could assemble 
> an Excel table easily rather than having to count the number of characters.
> 
> Is this possible for us to do by ourselves?  Or could you modify the package 
> in some way?
> 
> We appreciate your attention.  Thank you!
> 
> Scott Neslin
> Prasad Vana
> 
> Dartmouth College


Hi,

Presuming that you are talking about the glm() function, as there is no GLM 
package as far as I can see, R model objects have a structure that can be 
viewed using the str() function. The help for this function can be viewed using:

   ?str

You can then use:

  str(summary(YourModelObject))

That will give you some insights into the model object components and that same 
str() function is valuable for investigating other objects as well.

That being said, R's model objects typically have 'extractor' functions to make 
it easy to obtain commonly used components of the model object, which can be 
complicated.

The R manual "An Introduction to R", has a section on some of these:


https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Generic-functions-for-extracting-model-information
 
<https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Generic-functions-for-extracting-model-information>

Thus, for example, using:

  coef(summary(YourModelObject))

will return the matrix of coefficients and related parameters from the summary 
model object.

Once you have that matrix object, you can write it out to a CSV file using 
?write.csv, where the CSV file can then be opened with or imported into Excel.

So the steps might be along the lines of:

  my.coef <- coef(summary(YourModelObject))

  write.csv(my.coef, file = "MyCoefficients.csv")


The R Data Import/Export manual:

  https://cran.r-project.org/doc/manuals/r-release/R-data.html 
<https://cran.r-project.org/doc/manuals/r-release/R-data.html>

has some insights into pathways for getting data to and from R, including some 
packages that can directly write Excel files. You may wish to review that 
manual as well.

Regards,

Marc Schwartz



[[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 updates for new versions

2018-10-11 Thread Marc Schwartz via R-help
> On Oct 11, 2018, at 11:40 AM, Rich Shepard  wrote:
> 
>  This is a question to better my understanding of the relationship between
> core R versions and packages that work with them. It's not a complaint or
> criticism.
> 
>  Installed here is R-3.5.1. There are two packages that allow integration
> of R and GRASS that are not yet available for 3.5.1: rpy2 and spgrass7.
> 
>  Appreciating that package maintainers have day jobs that take priority
> over volunteer package maintenance, I ask only for thoughts on when copies
> of those two packages _might_ be available for 3.5.1.
> 
> Regards,
> 
> Rich


Rich,

Your best bet is to directly contact the package maintainers, as they would be 
the definitive source for timeline information on package updates.

They ultimately control that workflow for third party packages, whether on CRAN 
or otherwise, and can give you some idea of current status and plans.

Regards,

Marc Schwartz

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

2018-10-03 Thread Marc Schwartz via R-help


> On Oct 3, 2018, at 7:03 PM, David Doyle  wrote:
> 
> I'm sure this is a simple question but I'm not sure where to find the
> answer.
> 
> I want to remove some of the data.  For example when my Location column is
> MW-09, MW-10, or MW-11.
> 
> It works fine if I ONLY list ONE of the locations as in:
> 
> SampledWells <- MyData[ MyData$Location != "MW-09", ]
> 
> But if I try to do more than one (as shown below), I don't get an error but
> I also don't get my SampledWells
> SampledWells <- MyData[ MyData$Location != "MW-09", "MW-10", ]
> 
> Thoughts??
> 
> Thank you for your time
> David


Hi,

See ?"%in%"

Then:

  SampledWells <- MyData[ !MyData$Location %in% c("MW-09", "MW-10"), ]

Note the '!' operator that precedes the expression to negate the logical.

Regards,

Marc Schwartz


[[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] Bitbucket code

2018-08-29 Thread Marc Schwartz via R-help


> On Aug 29, 2018, at 7:18 AM, prof.amit.mit...@gmail.com wrote:
> 
> I installed a local zip file a few days ago and the package was recently
> modified on bitbucket , with a stable zip version not yet available.
> 
> How many days does it usually take to get a stable zip version. How can I
> `devtools` it from the bitbucket the fastest way? I have my own sourcetree
> and the author has created in cloud.
> 
> 
> BR
> 
> Amit
> 


Hi,

No need to post twice.

I don't use Bitbucket, but it looks like the devtools package has a 
install_bitbucket() function, so perhaps that will do what you want.

In terms of making a stable archive file available, that will be entirely up to 
the package maintainer and when/how they choose to make that available (e.g. 
via CRAN or other vehicles).

Regards,

Marc Schwartz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] differing behavior of mean(), median() and sd() with na.rm

2018-08-22 Thread Marc Schwartz via R-help
Hi,

It might even be worthwhile to review this recent thread on R-Devel:

  https://stat.ethz.ch/pipermail/r-devel/2018-July/076377.html

which touches upon a subtly related topic vis-a-vis NaN handling.

Regards,

Marc Schwartz


> On Aug 22, 2018, at 10:55 AM, Bert Gunter  wrote:
> 
> ... And FWIW (not much, I agree), note that if z = numeric(0) and sum(z) =
> 0, then mean(z) = NaN makes sense, as length(z) = 0, so dividing by 0 gives
> NaN. So you can see the sorts of issues you may need to consider.
> 
> 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, Aug 22, 2018 at 7:47 AM Bert Gunter  wrote:
> 
>> Actually, the dissonance is a bit more basic.
>> 
>> After xxx(, na.rm=TRUE) with all NA's in ... you have numeric(0). So
>> what you see is actually:
>> 
>>> z <- numeric(0)
>>> mean(z)
>> [1] NaN
>>> median(z)
>> [1] NA
>>> sd(z)
>> [1] NA
>>> sum(z)
>> [1] 0
>> etc.
>> 
>> I imagine that there may be more of these little inconsistencies due to
>> the organic way R evolved over time. What the conventions should be  can be
>> purely a matter of personal opinion in the absence of accepted standards.
>> But I would look to see what accepted standards were, if any, first.
>> 
>> -- Bert
>> 
>> 
>> On Wed, Aug 22, 2018 at 7:34 AM Ivan Calandra  wrote:
>> 
>>> Dear useRs,
>>> 
>>> I have just noticed that when input is only NA with na.rm=TRUE, mean()
>>> results in NaN, whereas median() and sd() produce NA. Shouldn't it all
>>> be the same? I think NA makes more sense than NaN in that case.
>>> 
>>> x <- c(NA, NA, NA) mean(x, na.rm=TRUE) [1] NaN median(x, na.rm=TRUE) [1]
>>> NAsd(x, na.rm=TRUE) [1] NA
>>> 
>>> Thanks for any feedback.
>>> 
>>> Best,
>>> Ivan
>>> 
>>> --
>>> Dr. Ivan Calandra
>>> TraCEr, laboratory for Traceology and Controlled Experiments
>>> MONREPOS Archaeological Research Centre and
>>> Museum for Human Behavioural Evolution
>>> Schloss Monrepos
>>> 56567 Neuwied, Germany
>>> +49 (0) 2631 9772-243
>>> https://www.researchgate.net/profile/Ivan_Calandra
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/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] Finding and changing .Rprofile

2018-08-17 Thread Marc Schwartz via R-help


> On Aug 17, 2018, at 4:06 PM, phili...@cpanel1.stormweb.net wrote:
> 
> I would like to change my .Rprofile file, but I cannot find it. I use a Mac 
> Pro and RStudio. I believe the file is a hidden file and I have checked for 
> it accordingly. I can not find it with a Spotlight search. It is not in my 
> "default working directory". Is that the same thing as my "home directory"? I 
> believe I can put a new .Rprofile file in any project directory, but that is 
> not what I want to do. I want a .Rprofile file that will apply automatically 
> whenever I start working on another project. Was one installed automatically 
> when I installed R and RStudio many months ago and if so, where can I find 
> it? If it was not installed automatically and I have to create my own, where 
> should I put it?


Hi, 

As an FYI, there is a dedicated R list for macOS users:

  https://stat.ethz.ch/mailman/listinfo/r-sig-mac

which should be used for macOS specific questions vis-a-vis R.

The default .Rprofile is stored in your user home folder, which is 
/Users/YourUserName/.Rprofile or abbreviated as ~/.Rprofile.

As you note, because it is a hidden file, with a leading '.', Finder and 
Spotlight will not show it by default.

You can change that behavior relative to hidden files, by opening a Terminal 
and using the following command:

  defaults write com.apple.finder AppleShowAllFiles TRUE

then restart Finder, by using Alt-RightClick on the Finder icon in the dock and 
selecting Relaunch. You can reverse that behavior by changing the TRUE to FALSE 
in the above command.

If you don't want to make that global change, you can use the following command 
in a Terminal session:

  open -a Textedit ~/.Rprofile

That will bring up the Textedit editor application with the file loaded. You 
can then edit the file content and save it. 

Whichever way you edit the file, be sure to restart any R sessions you have 
running, so that future R sessions will pick up the changes.

Making the change to that file will generally affect all R sessions for your 
user profile.

I don't use RStudio, so it may have other relevant features, and they have 
their own support lists linked on their site.

Regards,

Marc Schwartz

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

2018-08-15 Thread Marc Schwartz via R-help
Hi Spencer,

Please be sure to use reply-all to keep the thread on the list and in the list 
archives for the future benefit of others. It also allows others to participate 
with additional information, if needed.

You have already loaded the packages by using the two library() function calls 
as you have below.

Beyond that, if there are examples from the package vignettes that you want to 
run, just copy and paste the relevant code from the PDF file, within whatever 
application you use to view it, into the R console.

Each package also has it's own documentation as well, describing the functions, 
their arguments, any included datasets, and typically some examples. You can 
bring up the main package help index by using, for example:

  help(package = "cgdsr")
 
Regards,

Marc


> On Aug 15, 2018, at 2:41 PM, Spencer Brackett 
>  wrote:
> 
> Mr. Schwartz, 
> 
>   I see. Thank you for the correction! Is there any other line which I could 
> input to load the two packages in question?
> 
> Many thanks, 
> 
> Spencer Brackett 
> 
> On Wed, Aug 15, 2018 at 2:33 PM Marc Schwartz  wrote:
> Hi,
> 
> The ?source function is intended to read a plain text R source code file into 
> the R console, not a PDF file.
> 
> Even if source() could read in a PDF file, you have a typo in the URL, which 
> is CRAN, not BioConductor, and which should be:
> 
>   https://cran.r-project.org/web/packages/cgdsr/vignettes/cgdsr.pdf
> 
> Regards,
> 
> Marc Schwartz
> 
> > On Aug 15, 2018, at 2:07 PM, Spencer Brackett 
> >  wrote:
> > 
> > Good afternoon,
> > 
> >  I am trying to load the two R packages CGSDR and GAIA which I have
> > successfully installed onto my R program. Following installation of the two
> > packages, I proceeded upon recommendation to load both packages via the
> > library function. Therefore I inputed following...
> > 
> > library(cgdsr)
> > library(gaia)
> > 
> > This was successfull. Then did the following
> > 
> > source(https://cran.r-project.org/web/packages/cgdsr/vingnettes/cgdsr.pdf
> > 
> > This Bioconductorlink was reported to contain an error and was not loaded
> > successfully.
> > 
> > Any ideas of what exactly I am doing wrong in my lines?
> > 
> > Many thanks,
> > 
> > Spencer Brackett
> > 
> >   [[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] Problem with loaded R packages

2018-08-15 Thread Marc Schwartz via R-help
Hi,

The ?source function is intended to read a plain text R source code file into 
the R console, not a PDF file.

Even if source() could read in a PDF file, you have a typo in the URL, which is 
CRAN, not BioConductor, and which should be:

  https://cran.r-project.org/web/packages/cgdsr/vignettes/cgdsr.pdf

Regards,

Marc Schwartz

> On Aug 15, 2018, at 2:07 PM, Spencer Brackett 
>  wrote:
> 
> Good afternoon,
> 
>  I am trying to load the two R packages CGSDR and GAIA which I have
> successfully installed onto my R program. Following installation of the two
> packages, I proceeded upon recommendation to load both packages via the
> library function. Therefore I inputed following...
> 
> library(cgdsr)
> library(gaia)
> 
> This was successfull. Then did the following
> 
> source(https://cran.r-project.org/web/packages/cgdsr/vingnettes/cgdsr.pdf
> 
> This Bioconductorlink was reported to contain an error and was not loaded
> successfully.
> 
> Any ideas of what exactly I am doing wrong in my lines?
> 
> Many thanks,
> 
> Spencer Brackett
> 
>   [[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] Questions for Licensing

2018-08-03 Thread Marc Schwartz via R-help
Hi,

As was mentioned in another reply, you will not get formal legal advice here, 
as none of us are intellectual property (IP) lawyers, and there can even be 
country specific issues when it comes to such things, based upon local laws and 
legal precedents that may be relevant.

That being said, on an informal basis, you should at least review the GPL FAQ:

  https://www.gnu.org/licenses/gpl-faq.en.html

to begin to educate yourself on key issues, which really come down to whether 
or not, your proprietary application can be considered a "derivative work" and 
therefore be impacted by the so-called "viral" implications of the GPL.

Given the liability risks (legal and financial) that your company faces if you 
"get it wrong", you need to seek out local legal expertise, specifically with 
IP related issues, and get a formal legal opinion and guidance.

Regards,

Marc Schwartz


> On Aug 2, 2018, at 11:07 PM, 이태희  wrote:
> 
> To whom it may concern,
> 
> I am very new to GNU GPL License and I have no idea how using GPL licensed 
> software can affect the software that my company has developed.
> 
> My company develops and distributes S/W to clients. Our product is a 
> proprietary software under EULA license.
> When we sell our products and sign contracts we do not open the source code 
> of our products to our clients. Although we do provide documents for methods, 
> property, fields with definition and sample codes.
> 
> Since our product is mainly used for simulation, scheduling and analyzation, 
> we are considering to use R for creating data visualization.
> We would also like to deliver our product including R as bundle to customers.
> So basically, the product components would be looking like the one attached 
> to this mail.
> 
> Red box : Overall package of our product to be delivered to our customers.
> Blue box: Components of our company developed programs.
> Blue color filled box : Our company’s main program and class library Dlls.
> R link module : Functions defined to connect and communicate with R through 
> R.Net
> Interface : R.Net or something similar to play the same role. If needed, 
> develop our own interface to call R libraries.
> R scripts : R scripts to process result data from our engine, convert it 
> using the R engine and finally display the visualized data through our 
> product.
> R Engine : R controls and DLLs
> 
> We are not planning to modify any part of the libraries of R.
> Also the engine of our product will not be directly calling R controls but 
> through R.Net as an interface to communicate with R.
> 
> Now the questions I would like to ask are the following :
> 
> 1.   R is licensed under GPL2/GPL3 and R.Net is licensed under BDS. In case 
> we sell the content of the blue box (shown above), do we need to provide the 
> source code for our entire product because we are using GPL licensed S/W?
> 
> 2.   One our components from our product will be referring to DLLs provided 
> from R.Net such as R link module in this case. In this scenario, do we need 
> to provide the source code for the R-link Module?
> 
> 
> 3.   Instead of using R.Net, in case we develop our own DLLs to directly 
> communicate with R (without R modification), do we need to provide the source 
> code for our entire product?
> 
> 
> 5.   Are we allowed to deliver our products as a package as in the Red box? 
> (Sell our products including R)
> A. If not, which of components are we allowed to sell as a package to our 
> customers.
> B.  If we sell our products including R installation, do we need to open our 
> product’s source code?
> 
> 
> Last but not least, we would like to know a way how we could use R and treat 
> as an individual license so it does not violate our EULA license and for us 
> not to open any part of source code of our products.
> The end-users of our customers are developers and analysts. I’m pretty sure 
> analysts would not request for open source but developers would.
> We just want to avoid a situation in which our product accidentally falls 
> under the GPL license because of our use of R and us therefore having to 
> provide the source code for our product.
> 
> Thank you for your precious time reading this mail and any advices and 
> information you provide will be a great help to me.
> 
> Best regards,
> Tae Hee, Lee
> Junior Engineer
> Technical Supports
> VMS-Solutions Co.,Ltd, South Korea

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Marc Schwartz via R-help
Rich,

See inline below.

Marc


> On Jul 26, 2018, at 1:55 PM, Rich Shepard  wrote:
> 
> On Thu, 26 Jul 2018, Marc Schwartz wrote:
> 
>> The full list of e-mail lists is here:
>> https://stat.ethz.ch/mailman/listinfo/
>> and the ESS-Help list is here:
>> https://stat.ethz.ch/mailman/listinfo/ess-help
>> which is also referenced on the ESS web site:
>> http://ess.r-project.org/index.php?Section=getting%20help
> 
> Marc,
> 
>  I did not think of looking at the Mailman page. Thanks.
> 
>> More than likely, there is something in your .emacs file configuration
>> that is affecting the indentation behavior.
> 
>  Could be.


One other thing comes to mind, which is that given the age of your ESS 
installation and that you are running Emacs 25, there have been two major Emacs 
updates since the version of ESS you are using, both 24 and 25.

There is a reasonable chance that your ESS version, given its age, may be 
incompatible with some of the under the hood changes in Emacs since then, 
including changes to variable names, etc.

Upgrading ESS would seem prudent, even if you have to manually install it from 
the ESS site, if the Slack source maintainer cannot do so.


> 
>> Just as an FYI, Emacs is up to version 26.1 and ESS is up to version 17.11.
> 
>  Emacs is upgraded when Pat and the other Slackware devs do so; ess is
> hosted by SlackBuilds.org and I'll contact the package maintainer about
> upgrading (which I'll do here).
> 
> Best regards,
> 
> Rich
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Marc Schwartz via R-help
Hi Rich,

The full list of e-mail lists is here:

  https://stat.ethz.ch/mailman/listinfo/

and the ESS-Help list is here:

  https://stat.ethz.ch/mailman/listinfo/ess-help

which is also referenced on the ESS web site:

  http://ess.r-project.org/index.php?Section=getting%20help

More than likely, there is something in your .emacs file configuration that is 
affecting the indentation behavior.

Just as an FYI, Emacs is up to version 26.1 and ESS is up to version 17.11. 

ESS version 5.14 is 7 years old.

Subscribe to ESS-Help and re-post there, albeit, you should probably update 
both Emacs and ESS before doing so, to be sure that any behavior you continue 
to observe is based upon currently supported versions.

Regards,

Marc
  

> On Jul 26, 2018, at 1:22 PM, Rich Shepard  wrote:
> 
>  I used to be subscribed to the ess SIG, but cannot find any saved messages
> from that list and I cannot find it in the list of mail lists on the r-project
> web site. So I'll ask here.
> 
>  Running ess-5.14 on emacs-25.3 I'm seeing a different behavior when I
> write scripts than I had seen in the past. I would like to learn how to fix
> this issue. I invoke ess using M-x R when I start emacs.
> 
>  When typing comments and pressing [Enter] at the end of the line to start
> a new line, the row just left is inset to column 40 from column 0. Annoying
> behavior, to be sure. This does not happen when I write a bash shell or
> python script using emacs so it seems to be specific to R.
> 
>  All thoughts, ideas, and suggestions are welcome.
> 
> Rich
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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] xtable does not print out units of a variable

2018-07-19 Thread Marc Schwartz via R-help
Hi,

Just to throw in an alternative possibility, you may want to look at Frank's 
Hmisc package on CRAN:

  https://cran.r-project.org/web/packages/Hmisc/index.html

and note the label(), latex() and units() functions therein.

They may or may not work for what you are looking to do here.

As Jeff has noted, you may need to do some pre-processing of the output to the 
LaTeX table to get what you want, before calling any of the LaTeX output 
functions, in the absence of direct support for specific classes of object, 
such as 'units'. Keep in mind, that all of the output to LaTeX is character 
based, so you can create any formatted character string you need, then generate 
the LaTeX output.

Regards,

Marc Schwartz


> On Jul 19, 2018, at 7:52 AM, Shawn Way  wrote:
> 
> Thank you for the example you posted.  I'll try to make a go of it from there.
> 
> I understand and actually use columns with consistent information, however, 
> it's the reporting of the variables and their units that is the crux of the 
> situation.  The units package is extremely useful in automatic conversion 
> between units, something necessary for us engineering folks.
> 
> Thank you kindly!
> 
> Shawn Way, PE
> 
> -Original Message-
> From: Jeff Newmiller  
> Sent: Wednesday, July 18, 2018 9:26 PM
> To: Shawn Way 
> Cc: r-help@r-project.org
> Subject: Re: [R] xtable does not print out units of a variable
> 
>> On Wed, 18 Jul 2018, Shawn Way wrote:
>> 
>> I have a dataframe that contains units using the units package. 
>> Unfortunately, I really need the units for reporting.  I'm assuming 
>> that's because the data is in a class units and xtable doesn't know 
>> what to do with this.
> 
> If you want a bug or feature in a CONTRIBUTED PACKAGE, then you need to 
> communicate with the maintainer:
> 
> maintainer( "xtable" )
> 
> Do keep in mind that they almost always volunteer their time, so be patient, 
> and consider figuring out what code changes they need to make so it will work.
> 
> More below.
> 
>> The following is a MWE:
>> 
>>   library(xtable)
>>   library(units)
>>   data <- data.frame(x=c(as_units(12,"ft")))
>>   xtable(data)
>> 
>>   % latex table generated in R 3.5.1 by xtable 1.8-2 package
>>   % Wed Jul 18 17:31:44 2018
>>   \begin{table}[ht]
>>   \centering
>>   \begin{tabular}{rr}
>> \hline
>>& x \\
>> \hline
>>   1 & 12.00 \\
>> \hline
>>   \end{tabular}
>>   \end{table}
>> 
>> What I'm looking for is the line
>> 
>>   1 & 12.00 \\
>> 
>> to be
>> 
>>   1 & 12.00 $ft$\\
>> 
>> Can someone point me in the correct direction to make this happen? 
>> Since units are used extensively in engineering calculations, being 
>> able to handle this class would be extremely beneficial to engineers 
>> that are using R with knitr to generate engineering documents.
>> 
>> Shawn Way
> 
> I do want to emphasize that R focuses on consistency among elements within 
> columns, not rows, so putting the units into the body of the table is kind of 
> visually redundant in most cases. Consider:
> 
> 
> library(xtable)
> library(units)
> #> udunits system database from /usr/share/xml/udunits data <- 
> data.frame(x=c(as_units(c(12,13),"ft")))
> datax <- xtable(data)
> names(datax) <- paste0( names(datax)[1]
>   , " ($"
>   , deparse_unit( datax[[1]] )
>   , "$)"
>   )
> datax
> #> % latex table generated in R 3.4.4 by xtable 1.8-2 package #> % Wed Jul 18 
> 19:13:29 2018 #> \begin{table}[ht] #> \centering #> \begin{tabular}{rr}
> #>   \hline
> #>  & x (\$ft\$) \\
> #>   \hline
> #> 1 & 12.00 \\
> #>   2 & 13.00 \\
> #>\hline
> #> \end{tabular}
> #> \end{table}
> 
> #' Created on 2018-07-18 by the [reprex package](http://reprex.tidyverse.org) 
> (v0.2.0).
> 
> 
> If you have some kind of summary table with different units on each row, then 
> you will probably arrive at that information a single-row, many column data 
> frame. I usually transpose this into a three-column data frame with a 
> description column, a value column, and a units column. I don't use the units 
> package so have never tried to adapt it to that process.

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


  1   2   3   4   5   6   7   8   9   10   >