Re: [R] test2r.mengz1(X)

2024-05-13 Thread Bert Gunter
... but maybe cocor() in the cocor package will do do what you want. -- Bert On Mon, May 13, 2024 at 1:57 PM Duncan Murdoch wrote: > > Google says that function is in the bcdstats package, which isn't on > CRAN. It appears to be a private package for a course, kept on Github. > > Duncan

Re: [R] [R-sig-ME] lmer error: number of observations <= number of random effects

2024-05-07 Thread Bert Gunter
I think you should seek out a local statistician with whom to consult if at all possible, as the details of your research goals and the nature of the data you have to meet those goals matter and cannot be effectively discussed in a remote forum like this. That is, to be blunt, you seem to be risk

Re: [R] x[0]: Can '0' be made an allowed index in R?

2024-04-23 Thread Bert Gunter
"This works with any single-index value, and lets all the existing operations for such values continue to work." As Peter Dalgaard already pointed out, that is false. > x <- 1:4 > x[-1] [1] 2 3 4 > elt(x,-0) [1] 1 Cheers, Bert On Tue, Apr 23, 2024 at 4:55 PM Richard O'Keefe wrote: > > Does it

Re: [R] System GMM yields identical results for any weighting matrix

2024-04-23 Thread Bert Gunter
. Cheers, Bert On Tue, Apr 23, 2024 at 11:45 AM Bert Gunter wrote: > > Generally speaking, this sort of detailed statistical question about a > speccial package in R does not get a reply on this general R > programming help list. Instead, I suggest you either email the > maintai

Re: [R] System GMM yields identical results for any weighting matrix

2024-04-23 Thread Bert Gunter
Generally speaking, this sort of detailed statistical question about a speccial package in R does not get a reply on this general R programming help list. Instead, I suggest you either email the maintainer (found by ?maintainer) or ask a question on a relevant R task view, such as

[R] Fwd: passing a modified argument to an S3 method

2024-04-20 Thread Bert Gunter
## Neglected to cc to list -- Forwarded message - From: Bert Gunter Date: Sat, Apr 20, 2024 at 1:26 PM Subject: Re: [R] passing a modified argument to an S3 method To: CRAN.r Well, my interpretation of your explanation is as follows: You have a long list of "control&qu

Re: [R] passing a modified argument to an S3 method

2024-04-20 Thread Bert Gunter
I do not understand what your goal is here (more context may be helpful, perhaps to others rather than me). So I doubt this is what you want, but here is a guess -- no need to respond if it is unhelpful: ## test.default returns NULL if object "y" not found in **calling environment and

Re: [R] Synthetic Control Method

2024-04-16 Thread Bert Gunter
Note that your unit.variable and unit.names.variable are indentical. Is this what you intended? (I have no idea how the Synth package works). Bert On Tue, Apr 16, 2024 at 12:58 AM wrote: > Good Morning > > > > I want to perform a synthetic control method with R. For this purpose, I > created

Re: [R] Exceptional slowness with read.csv

2024-04-08 Thread Bert Gunter
No idea, but have you tried using ?scan to read those next 5 rows? It might give you a better idea of the pathologies that are causing problems. For example, an unmatched quote might result in some huge number of characters trying to be read into a single element of a character variable. As your

Re: [R] split a factor into single elements

2024-04-02 Thread Bert Gunter
Note: > levels(factor(c(0,0,1))) ## just gives you the levels attribute [1] "0" "1" > as.character(factor(c(0,0,1))) ## gives you the level of each value in the vector [1] "0" "0" "1" Does that answer your question or have I misunderstood. Cheers, Bert On Tue, Apr 2, 2024 at 12:00 AM Kimmo

Re: [R] Double buffering plots on Windows

2024-03-23 Thread Bert Gunter
A search on "make animated plots in R" brought up many hits and the gganimate package (and maybe others, as I didn't scroll through). Bert On Fri, Mar 22, 2024, 18:45 Bickis, Mikelis wrote: > Hello: > > I want to present a sequence of plots as an animation. As a toy example > consider the

Re: [R] Problem when trying to install packages

2024-03-16 Thread Bert Gunter
Though Navigator may mess up any Rtools stuff because it handles the directory trees where packages and dependencies are located, does it not? If so, maybe just reinstall RStudio directly from its website to proceed. Just a guess obviously. Bert On Sat, Mar 16, 2024, 05:09 javad bayat wrote: >

Re: [R] Problem when trying to install packages

2024-03-16 Thread Bert Gunter
? Google it! "How to install packages using Rtools" Bert On Sat, Mar 16, 2024, 05:09 javad bayat wrote: > Dear Rui; > Many thanks for your reply. I have installed Rtools (rtools43-5958-5975) on > my PC and I have R version 4.3.3 and 4.3.2 to install. Also I have > installed Rstudio through

Re: [R] Initializing vector and matrices

2024-03-02 Thread Bert Gunter
"It would be really really helpful to have a clearer idea of what you are trying to do." Amen! But in R, "constructing" objects by extending them piece by piece is generally very inefficient (e.g. https://r-craft.org/growing-objects-and-loop-memory-pre-allocation/), although sometimes?/often?

Re: [R] gsub issue with consecutive pattern finds

2024-03-01 Thread Bert Gunter
Oh, wait a second. I misread your original post. Please ignore my truly incorrect suggestion. -- Bert On Fri, Mar 1, 2024 at 7:57 AM Bert Gunter wrote: > > Here's another *incorrect* way to do it -- incorrect because it will > not always work, unlike Iris's correct solution. Bu

Re: [R] gsub issue with consecutive pattern finds

2024-03-01 Thread Bert Gunter
Here's another *incorrect* way to do it -- incorrect because it will not always work, unlike Iris's correct solution. But it does not require PERL type matching. The idea: separate the two vowels in the regex by a character that you know cannot appear (if there is such) and match it optionally,

Re: [R] converting MATLAB -> R | element-wise operation

2024-02-27 Thread Bert Gunter
... and here is a more or less direct translation of the Matlab code that should now be obvious given your previous responses: > m <- matrix(1:6, nr=2, byrow = TRUE) ## Matlab order > m [,1] [,2] [,3] [1,]123 [2,]456 > sweep(m, 2, 2:4, "/") [,1] [,2] [,3]

Re: [R] Interactions in regression

2024-02-25 Thread Bert Gunter
It is trivial in R to add whatever decorations to a plot that you would like, but that requires that you go beyond point and click production of graphics and write actual code. If you are unwilling or unable to do this, you are stuck with whatever various packaged graphics functionality

Re: [R] Including an external set of coded

2024-02-20 Thread Bert Gunter
I believe you will have to expain what you want more fully, as what you requested appears to be exactly what source() does, to me anyway. Please reread its help file more carefully perhaps? -- Bert On Tue, Feb 20, 2024 at 7:36 AM Steven Yen wrote: > How can I call and include an external set

Re: [R] Is simplify2array working for dimension > 2?

2024-02-08 Thread Bert Gunter
Jean-Claude: Well, here's my "explanation". Caveat emptor! Note that: "simplify2array() is the utility called from sapply() when simplify is not false" and > sapply(a, I, simplify = "array") [,1] [,2] [1,] list,2 list,2 [2,] list,2 list,2 So it seems that simplify2array() is not

Re: [R] gathering denominator under frac

2024-02-02 Thread Bert Gunter
s and so can also be used." Cheers, Bert On Fri, Feb 2, 2024 at 8:33 AM Bert Gunter wrote: > > ... or if I understand correctly, simply > > expression(frac(additive ~ HCO[3]^"-", >true ~ HCO[3]^"-" ))) > > Cheers, > Bert >

Re: [R] gathering denominator under frac

2024-02-02 Thread Bert Gunter
... or if I understand correctly, simply expression(frac(additive ~ HCO[3]^"-", true ~ HCO[3]^"-" ))) Cheers, Bert On Fri, Feb 2, 2024 at 3:06 AM Rui Barradas wrote: > Às 10:01 de 02/02/2024, Troels Ring escreveu: > > Hi friends - I'm plotting a ratio of

Re: [R] List of Words in BioWordVec

2024-02-01 Thread Bert Gunter
I *think* this might be better posted here: https://bioconductor.org/help/support/ Cheers, Bert On Thu, Feb 1, 2024 at 4:37 PM TJUN KIAT TEO wrote: > Is there a way to extract list of words in BioWordVec in R > > Thank you > > Tjun Kiat > > [[alternative HTML version deleted]] > >

Re: [R] R interpreting numeric field as a boolean field

2024-01-30 Thread Bert Gunter
Cheers, Bert On Tue, Jan 30, 2024 at 11:01 AM Bert Gunter wrote: > "I cannot change the data type from > boolean to numeric. I tried doing dataset$my_field = > as.numeric(dataset$my_field), I also tried to do dataset <- > dataset[complete.cases(dataset), ], didn't work either

Re: [R] Use of geometric mean .. in good data analysis

2024-01-22 Thread Bert Gunter
lt;https://www.azquotes.com/quote/603406>" "Sunset Salvo" by John Tukey in The American Statistician, Volume 40, No. 1 (pp. 72-76), www.jstor.org. February 1986. Cheers, Bert <https://www.azquotes.com/author/14847-John_Tukey> On Mon, Jan 22, 2024 at 12:23 PM Bert Gunter wrote: &g

Re: [R] Use of geometric mean .. in good data analysis

2024-01-22 Thread Bert Gunter
Ah LOD's, typically LLOD's ("lower limits of detection"). Disclaimer: I am *NOT* in any sense an expert on such matters. What follows are just some comments based on my personal experience. Please filter accordingly. Also, while I kept it on list as Martin suggested it might be useful to do

Re: [R] Use of geometric mean for geochemical concentrations

2024-01-22 Thread Bert Gunter
better posted on r-sig-ecology? -- or maybe even stack exchange? Cheers, Bert On Mon, Jan 22, 2024 at 7:45 AM Rich Shepard wrote: > A statistical question, not specific to R. > > I'm asking for a pointer for a source of definitive descriptions of what > types of data are best summarized by the

Re: [R] Strange results : bootrstrp CIs

2024-01-13 Thread Bert Gunter
Well, this would seem to work: e <- data.frame(Score = Score , Country = factor(Country) , Time = Time) ncountry <- nlevels(e$Country) func= function(dat,idx) { if(length(unique(dat[idx,'Country'])) < ncountry) NA else coef(lm(Score~ Time + Country,data =

Re: [R] Exponential Autoregressive time series model EAR(1)

2023-12-17 Thread Bert Gunter
If you have not already done so, I suggest you look here: https://cran.r-project.org/web/views/TimeSeries.html (R task views are an excellent place to look for such queries) Or a web search here: https://rseek.org/ -- Bert On Sat, Dec 16, 2023 at 11:31 PM Mohamed Ezzat <

Re: [R] Advice on starting to analyze smokestack emissions?

2023-12-12 Thread Bert Gunter
different. Just my thought for what it is worth. > Tim > > -Original Message- > From: R-help On Behalf Of Bert Gunter > Sent: Tuesday, December 12, 2023 10:53 AM > To: Kevin Zembower > Cc: R-help email list > Subject: Re: [R] Advice on starting to analyze smokestack emi

Re: [R] Advice on starting to analyze smokestack emissions?

2023-12-12 Thread Bert Gunter
You might also try the R-Sig-ecology list, though I would agree that it's not clearly related. Still, air pollution effects...? -- Bert On Tue, Dec 12, 2023 at 3:15 AM Kevin Zembower via R-help < r-help@r-project.org> wrote: > Hello, all, > > [Originally sent to r-sig-geo list, with no

Re: [R] ggplot2: Get the regression line with 95% confidence bands

2023-12-10 Thread Bert Gunter
This can easily be done using predict.lm to get the intervals (confidence or prediction). ?predict.lm contains a plotting example using ?matplot from the graphics package. Here's a somewhat verbose version for your example (first converting Year to numeric, of course): df=data.frame(year=

Re: [R] reshape() not dropping varaibles

2023-12-10 Thread Bert Gunter
Posting a few rows, say 5, of your data using dput() along with the result that you would like to get for those rows would help get you a quicker and more accurate response, I believe. This is as suggested by the posting guide, linked below, which you should read if you have not already. -- Bert

Re: [R] Linear model and approx function

2023-12-09 Thread Bert Gunter
1. You should regress Elevation on Volume, no? 2. You are calling lm incorrectly for prediction. Please read ?lm and related links carefully and/or consult a tutorial. R-Help is really not the first place you should look for this sort of detailed info. 3. I think this is what you want: lm1 <-

Re: [R] Convert two-dimensional array into a three-dimensional array.

2023-12-08 Thread Bert Gunter
OK. I'm not getting what you want, so feel free to ignore this if you think I've missed the point completely and don't want to waste your time. Won't be my first time clueless. A 3-D array can be thought of as as a "pile" of 2-D flats, so a 10 x 2 x 10 array consists of 10 2-d flats, each 10 x

Re: [R] Volume of polygon

2023-12-05 Thread Bert Gunter
The volume of a polygon = 0. Polyhedra have volumes. This may be irrelevant, but if the lake is cylindrical == constant cross sectional area at all depths, then height doubles when the volume does and vice versa. Otherwise you have to know how area varies with height or use more sensible

Re: [R] back tick names with predict function

2023-11-30 Thread Bert Gunter
"Thank you Rui. I didn't know about the check.names = FALSE argument. > Another good reminder to always read help, but I'm not sure I understood > what help to read in this case" ?data.frame , of course, which says: "check.names logical. If TRUE then the names of the variables in the data

Re: [R] Code editor for writing R code

2023-11-29 Thread Bert Gunter
This might be of use to you: https://everyday.codes/tutorials/how-to-use-latex-in-rmarkdown/ -- Bert On Wed, Nov 29, 2023 at 8:21 AM Bert Gunter wrote: > > I believe RMarkdown can use and render latex comments. RStudio/Posix > provides ide extensions (e.g. R Notebooks) that seem to do

Re: [R] Code editor for writing R code

2023-11-29 Thread Bert Gunter
I believe RMarkdown can use and render latex comments. RStudio/Posix provides ide extensions (e.g. R Notebooks) that seem to do what you want, but I have no experience with them. As Ben suggested, there are likely others, depending on exactly what you want to do. -- Bert On Wed, Nov 29, 2023 at

[R] **OFF TOPIC**: Fabrication of Scientific Data by Generative AI

2023-11-22 Thread Bert Gunter
All: **OFF TOPIC** -- feel free to respond to me personally, but I will not respond to on-list comments. https://www.nature.com/articles/d41586-023-03635-w Many of you will no doubt know of this already. I hope it will be of interest to all concerned with research replicability, integrity, and

Re: [R] Cannot calculate confidence intervals NULL

2023-11-15 Thread Bert Gunter
I believe the problem is here: cor1 <- cor(x1, y1, method="spearman") cor2 <- cor(x2, y2, method="spearman") The x's and y's are not looked for in data (i.e. NSE) but in the environment where the function was defined, which is standard evaluation. Change the above to: cor1 <- with(d, cor(x1,

Re: [R] kindly unsubscribe

2023-11-15 Thread Bert Gunter
Please see the bottom of this and every message for the link to unsubscribe. -- Bert On Wed, Nov 15, 2023 at 10:25 AM Saikat Dutta Chowdhury < saikatduttachowdh...@gmail.com> wrote: > -- > Saikat Dutta Chowdhury > Mobile: 8017650842 > > [[alternative HTML version deleted]] > >

Re: [R] Can someone please have a look at this query on stackoverflow?

2023-11-15 Thread Bert Gunter
... and note also that there may be clipping options you can change/set to approximate your desiderata. -- Bert On Wed, Nov 15, 2023 at 9:02 AM Bert Gunter wrote: > Well, as no one else has offered an answer ... > > I haven't looked at this closely, but could it not simply be

Re: [R] Can someone please have a look at this query on stackoverflow?

2023-11-15 Thread Bert Gunter
Well, as no one else has offered an answer ... I haven't looked at this closely, but could it not simply be the case that the aspect ratio set by "Landscape Mode" just differs from that of your display device? -- i.e., it is impossible to have the figure displayed in landscape ratio *and*

Re: [R] make a lattice dotplot with symbol size proportional to a variable in the plotted dataframe

2023-11-08 Thread Bert Gunter
... and see also Section 3.5, Scope of Variables in the "R Language Definition" manual that ships with R. Cheers, Bert On Wed, Nov 8, 2023 at 8:06 AM Deepayan Sarkar wrote: > On Wed, 8 Nov 2023 at 10:56, Christopher W. Ryan via R-help > wrote: > > > > Very helpful, Deepayan, and educational.

Re: [R] Adding columns to a tibble based on a value in a different tibble

2023-11-04 Thread Bert Gunter
I think a simple reproducible example ("reprex") may be necessary for you to get a useful reply. Questions with vague specifications such as yours often result in going round and round with attempts to clarify what you mean without a satisfactory answer. Clarification at the outset with a reprex

Re: [R] I need to create new variables based on two numeric variables and one dichotomize conditional category variables.

2023-11-03 Thread Bert Gunter
Well, something like: LAP <- ifelse(gender =='male', (WC-65)*TG, (WC-58)*TG) The exact code depends on whether your variables are in a data frame or list or whatever, which you failed to specify. If so, ?with may be useful. Cheers, Bert On Fri, Nov 3, 2023 at 3:43 AM Md. Kamruzzaman wrote:

Re: [R] Virus alert because of an R-help e-mail

2023-10-31 Thread Bert Gunter
No attachments. Most are deleted by ETH mailman ... because they might contain viruses. -- Bert On Tue, Oct 31, 2023 at 8:59 AM David Croll wrote: > I just received a virus warning from my e-mail provider, GMX. See the > attached image below. > > The virus detection can be spurious - but the

Re: [R] [Tagged] Re: col.names in as.data.frame() ?

2023-10-28 Thread Bert Gunter
Jeff, et. al. : but ... Note that as.data.frame() *already* changes the matrix object by adding column names of *its own choosing* when the matrix has none. So the issue here is not *whether* col names should be added, but *what*/*how* they should be. Unless you wish to extend your criticism to

Re: [R] Plot for 10 years extrapolation

2023-10-26 Thread Bert Gunter
Incidentally, if all you wanted to do was plot fitted values, the predict method is kinda overkill, as it's just the fitted line from the model. But I assume you wanted to plot CI's/PI's also, as the example illustrated. -- Bert On Thu, Oct 26, 2023 at 1:56 PM Bert Gunter wrote: > >

Re: [R] Plot for 10 years extrapolation

2023-10-26 Thread Bert Gunter
from ?predict.lm: "predict.lm produces a vector of predictions or a matrix of predictions and bounds with column names fit, lwr, and upr if interval is set. " ergo: predict(model, dfuture, interval = "prediction")[,"fit"] ## or [,1] as it's the first column in the returned matrix is your

Re: [R] Inquiry about bandwidth rescaling in Ksmooth

2023-10-26 Thread Bert Gunter
Apologies in advance if my comments don't help, in which case, no need to respond, but I noted in ?ksmooth: "bandwidth the bandwidth. The kernels are scaled so that their quartiles (viewed as probability densities) are at ± 0.25*bandwidth." So, could this be a source of the discrepancies you

Re: [R] Create a call but evaluate only some elements

2023-10-25 Thread Bert Gunter
As you seem to have a need for this sort of capability (e.g. bquote), see Section 6: "Computing on the Language" in the R Language Definition manual. Actually, if you are interested in a concise (albeit dense) overview of the R Language, you might consider going through the whole manual. Cheers,

Re: [R] running crossvalidation many times MSE for Lasso regression

2023-10-22 Thread Bert Gunter
No error message shown Please include the error message so that it is not necessary to rerun your code. This might enable someone to see the problem without running the code (e.g. downloading packages, etc.) -- Bert On Sun, Oct 22, 2023 at 1:36 PM varin sacha via R-help wrote: > > Dear

Re: [R] Create new data frame with conditional sums

2023-10-16 Thread Bert Gunter
Sorry, misstatements. It should (of course) read: If one makes the reasonable assumption that Pct is much larger than Cutoff, sorting Pct is the expensive part e.g O(nlog2(n) for Quicksort (n = length Pct). I believe looping is O(n^2). etc. On Mon, Oct 16, 2023 at 7:48 AM Bert Gunter wrote

Re: [R] Create new data frame with conditional sums

2023-10-16 Thread Bert Gunter
If one makes the reasonable assumption that Pct is much larger than Cutoff, sorting Cutoff is the expensive part e.g O(nlog2(n) for Quicksort (n = length Cutoff). I believe looping is O(n^2). Jeff's approach using findInterval may be faster. Of course implementation details matter. -- Bert On

Re: [R] Create new data frame with conditional sums

2023-10-14 Thread Bert Gunter
Well, here's one way to do it: (dat is your example data frame) Cutoff <- seq(0, .15, .01) Pop <- with(dat, sapply(Cutoff, \(p)sum(Totpop[Pct >= p]))) I think there must be a more efficient way to do it with cumsum(), though. Cheers, Bert On Sat, Oct 14, 2023 at 12:53 AM Jason Stout, M.D.

Re: [R] R Gigs

2023-10-06 Thread Bert Gunter
May be an age gap here, but I assume "gigs" = freelance jobs. If so, https://stat.ethz.ch/mailman/listinfo/r-sig-jobs might be useful. As well as an online search in all the usual places. Otherwise, please excuse my out-of-date ignorance. Cheers, Bert On Fri, Oct 6, 2023 at 1:23 PM Fred Kwebiha

[R] **Off Topic**, but perhaps of interest to many on this list

2023-10-06 Thread Bert Gunter
** Please Do Not Respond** This is only FYI for those who care to follow the link below. Explanation: Many questions that appear on this list are about how to organize and format data -- unsurprising, as data structures are an essential component of software and algorithm development in general,

Re: [R] Problems Structuring My Data

2023-10-03 Thread Bert Gunter
Cheers, Bert On Tue, Oct 3, 2023 at 4:25 PM Bert Gunter wrote: > > I won't attempt to answer your post here, but: > > #I don´t know why R is showing the dates as numbers > > Please read the Help files! > You say FAILDATE has "type" = S3 class, "Date"

Re: [R] Problems Structuring My Data

2023-10-03 Thread Bert Gunter
I won't attempt to answer your post here, but: #I don´t know why R is showing the dates as numbers Please read the Help files! You say FAILDATE has "type" = S3 class, "Date". The first thing ?Dates tells you in the "Details" is: "Dates are represented as the number of days since 1970-01-01,

Re: [R] Question about R software and output

2023-10-03 Thread Bert Gunter
I am pretty sure you'll get more replies than mine, so just consider this as part of the story. Your understanding is confused/flawed. 1. R can be downloaded from hundreds/thousands of software repositories, not just CRAN. 2. R can read/upload data in hundreds of different formats, not just

Re: [R] lattice densityplot with weights

2023-09-29 Thread Bert Gunter
Unless I misunderstand... See ?panel.densityplot Lattice functions do their work through a host of panel functions, typically passing their ... arguments to the panel functions. panel.densityplot has a weights argument. Cheers, Bert On Fri, Sep 29, 2023 at 3:32 AM Naresh Gurbuxani <

Re: [R] Print hypothesis warning- Car package

2023-09-16 Thread Bert Gunter
The factor names are legal but the Warnings tell you pretty clearly that Car doesn't like such things. So why don't you just use something else that is more conventional. -- Bert On Sat, Sep 16, 2023 at 1:40 PM Robert Baer wrote: > When doing Anova using the car package, I get a print warning

Re: [R] graph in R with grouping letters from the turkey test with agricolae package

2023-09-14 Thread Bert Gunter
No graphs. The link is paywalled. Bert Gunter On Thu, Sep 14, 2023 at 10:55 AM Loop Vinyl wrote: > Yes, the data and the R code used are attached. > > I would like to produce the attached graph (graph1) with the R package > agricolae, could someone give me an example with the a

Re: [R] How to draw plot marks without label?

2023-09-05 Thread Bert Gunter
Luigi: For base R graphics, you should always consult ?par for optional graphical parameters when the high level graphics function doesn't appear to provide the control you would like. I don't use base graphics -- i.e. i"m not particularly facile with it -- but as you provided an example, I

Re: [R] Finding combination of states

2023-09-05 Thread Bert Gunter
t)] > > by > > out[-grep("(.)\\1",out)] > > Best, > Eric > > On Tue, Sep 5, 2023 at 3:08 AM Bert Gunter wrote: > > > > ... and just for fun, here is a non-string version (more appropriate for > complex state labels??): > > > > gvec <-

Re: [R] Finding combination of states

2023-09-04 Thread Bert Gunter
ot;e" [15,] "b" "e" "c" "e" [16,] "b" "a" "d" "e" [17,] "b" "b" "d" "e" [18,] "b" "c" "d" "e" [19,] "b" &quo

Re: [R] Finding combination of states

2023-09-04 Thread Bert Gunter
t, last, rm_repeat=TRUE) { > if (nsteps < 3) stop("nsteps must be at least 3") > out <- paste(first, > myExpand(states, nsteps-2) |> > apply(MAR=1, \(x) paste(x, collapse="")), > last, sep="") > if (rm

Re: [R] Finding combination of states

2023-09-04 Thread Bert Gunter
Sorry, my last line should have read: If neither this nor any of the other suggestions is what is desired, I think the OP will have to clarify his query. Bert On Mon, Sep 4, 2023 at 12:31 PM Bert Gunter wrote: > I think there may be some uncertainty here about what the OP requested.

Re: [R] Finding combination of states

2023-09-04 Thread Bert Gunter
I think there may be some uncertainty here about what the OP requested. My interpretation is: n different times k different states Any state can appear at any time in the vector of times and can be repeated Initial and final states are given So modifying Tim's expand.grid() solution a bit

Re: [R] aggregate formula - differing results

2023-09-04 Thread Bert Gunter
Ivan: Just one perhaps extraneous comment. You said that you were surprised that aggregate() and group_by() did not have the same behavior. That is a misconception on your part. As you know, the tidyverse recapitulates the functionality of many base R functions; but it makes no claims to do so in

Re: [R] [Pkg-Collaboratos] BioShapes Almost-Package

2023-09-03 Thread Bert Gunter
1. R-package-devel is where queries about package protocols should go. 2. But... "Is there a succinct, but sufficiently informative description of documentation tools?" "Writing R Extensions" (shipped with R) is *the* reference for R documentation. Whether it's sufficiently "succinct" for you, I

Re: [R] Book Recommendation

2023-08-28 Thread Bert Gunter
I presume you are familiar with the RSQL and RSQLite packages and their vignettes. Can't offer any help, but a point of clarification: When you say, "teach accomplishing SQL in R," do you explicitly mean using SQL syntax in R to manipulate data or do you mean just doing SQL-like types of data

Re: [R] Interpreting Results from LOF.test() from qpcR package

2023-08-20 Thread Bert Gunter
I would suggest that a simple plot of residuals vs. fitted values and perhaps plots of residuals vs. the independent variables are almost always more useful than omnibus LOF tests. (many would disagree!) However,as Ben noted, this is wandering outside R-Help's strict remit, and you would be better

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
t; Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > Residual standard error: 0.323 on 13 degrees of freedom > Multiple R-squared: 0.717, Adjusted R-squared: 0.696 > F-statistic: 33 on 1 and 13 DF, p-value: 6.76e-05 > > Kind regards, > Paul > > El dom,

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
-07NA NA NA 1.389e-05 > 8.028e-12 > > Kind regards, > Paul > > > El dom, 20 ago 2023 a las 13:21, Bert Gunter () > escribió: > >> I got starting values as follows: >> Noting that the minimum data value is .38, I fit the linear model

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
I got starting values as follows: Noting that the minimum data value is .38, I fit the linear model log(y - .37) ~ x to get intercept = -1.8 and slope = -.055. So I used .37, exp(-1.8) and -.055 as the starting values for theta0, theta1, and theta2 in the nonlinear model. This converged without

Re: [R] Determining Starting Values for Model Parameters in Nonlinear Regression

2023-08-19 Thread Bert Gunter
" need to determine starting (initial) values for the model parameters for this nonlinear regression model," ... what nonlinear regression model? Did html get stripped? -- Bert On Sat, Aug 19, 2023 at 12:38 PM Paul Bernal wrote: > Dear friends, > > Hope you are all doing well and having a

Re: [R] Numerical stability of: 1/(1 - cos(x)) - 2/x^2

2023-08-18 Thread Bert Gunter
definite precision complex numbers, but generally > that would be a tuple of such numbers. > > > -Original Message- > From: R-help On Behalf Of Bert Gunter > Sent: Friday, August 18, 2023 7:06 PM > To: Leonard Mada > Cc: R-help Mailing List ; Martin Maechler <

Re: [R] Numerical stability of: 1/(1 - cos(x)) - 2/x^2

2023-08-18 Thread Bert Gunter
^2/2; > 1/(1 - y) - 2/x^2 > > # the result behaves far better around values > # which can be represented exactly, > # but fails drastically for other values! > x = 2^(-20) * 1.1 > y <- 1 - x^2/2; > 1/(1 - y) - 2/x^2 > # 58672303 instead of 0! > > > Sincerely, &

Re: [R] Numerical stability of: 1/(1 - cos(x)) - 2/x^2

2023-08-18 Thread Bert Gunter
"The ugly thing is that the error only gets worse as x decreases. The value neither drops to 0, nor does it blow up to infinity; but it gets worse in a continuous manner." If I understand you correctly, this is wrong: > x <- 2^(-20) ## considerably less then 1e-4 !! > y <- 1 - x^2/2; > 1/(1 - y)

Re: [R] Timezone question

2023-08-17 Thread Bert Gunter
You may also find the package "lutz" to be of interest, although that may be overkill for your needs. (found by an internet search). Cheers, Bert On Thu, Aug 17, 2023 at 1:31 PM Dennis Fisher wrote: > R 4.3.1 > OS X > > Colleagues > > Is there a simple way to determine the timezone offset for

Re: [R] Questions about R

2023-08-17 Thread Bert Gunter
"official" answer you can get. Bert On Thu, Aug 17, 2023 at 9:17 AM Bert Gunter wrote: > This is a volunteer Help list for users of R, which is open source, so you > can see all its code. I can answer no to your questions, unless you are > using one of R's innume

Re: [R] Questions about R

2023-08-17 Thread Bert Gunter
This is a volunteer Help list for users of R, which is open source, so you can see all its code. I can answer no to your questions, unless you are using one of R's innumerable packages that interacts with the internet and to which the user may give personal information to enable the desired

[R] OFF TOPIC: chatGPT glibly produces a lot of wrong answers?

2023-08-13 Thread Bert Gunter
**OFF TOPIC** but perhaps of interest to some on this list. I apologize in advance to those who may be offended. The byline: "ChatGPT's odds of getting code questions correct are worse than a coin flip But its suggestions are so annoyingly plausible"

Re: [R] Different TFIDF settings in test set prevent testing model

2023-08-11 Thread Bert Gunter
I know nothing about tf, etc., but can you not simply read in the whole file into R and then randomly split using R? The training and test sets would simply be defined by a single random sample of subscripts which is either chosen or not. e.g. (simplified example -- you would be subsetting the

Re: [R] R library highcharter function highchart() execute with exception the apparmor read denied for /etc/passwd and /etc/group

2023-08-08 Thread Bert Gunter
If you don't get a satisfactory answer here in due course, you can try contacting the package maintainer, who you can find via ?maintainer. Cheers, Bert On Tue, Aug 8, 2023 at 7:50 AM Gu, Jay via R-help wrote: > > Dears, > > > I use the R library highcharter with ubuntu 18.04 and R 3.6.3.

Re: [R] group consecutive dates in a row

2023-08-07 Thread Bert Gunter
Here is another way to obtain the day differences that is the argument of rle() . It is perhaps more reliable in that it uses methods for class POSIXct rather than depending on the underlying class structure and conversion via as.numeric. In theory, the methods won't change or any changes will be

Re: [R] Stacking matrix columns

2023-08-05 Thread Bert Gunter
Or just dim(x) <- NULL. (as matrices in base R are just vectors with a dim attribute stored in column major order) ergo: > x [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 > x<- 1:20 ## a vector > is.matrix(x) [1] FALSE > dim(x) <- c(5,4) > is.matrix(x) [1] TRUE >

Re: [R] Technical Help Request for "Version Differences" (i.e., CYTOFKIT package)

2023-08-04 Thread Bert Gunter
Dear Murat: See the "posting guide" (link below) for how and what to post on this list. I believe that in that guide it is recommended that you first update your R version and packages to the latest versions (R 3.5 is rather old now). You should probably reinstall R and all packages from the

Re: [R] Style guide when using "R" in a title

2023-07-26 Thread Bert Gunter
https://www.r-project.org/logo/ Cheers, Bert On Wed, Jul 26, 2023 at 4:01 PM Wadsworth, Spencer G [STAT] wrote: > > Hello, > > I am working on a small booklet to be used with an existing statistics > textbook. The purpose of the booklet is to give worked through examples from > the textbook

Re: [R] plotly question

2023-07-21 Thread Bert Gunter
As you apparently haven't received any responses yet, I'll try to suggest something useful. However, I have absolutely zero experience with plotly, so this is just from general principles and reading the plot_ly Help file, which says for the "..." arguments: "Arguments (i.e., attributes) passed

[R] Off-topic: ChatGPT Code Interpreter

2023-07-17 Thread Bert Gunter
This is an **off-topic** post about the subject line, that I thought might be of interest to the R Community. I hope this does not offend anyone. The widely known ChatGPT software now offers what is called a "Code Interpreter," that, among other things, purports to do "data analysis." (Search

Re: [R] how to change the y-axis to logarithmic in a barplot ggplot

2023-07-16 Thread Bert Gunter
Maria, ggplot is part of the Posit -- formerly RStudio -- assortment of contributed packages. They have their own support site here , which you *may* find useful for such questions, also. Though ggplot queries *are* frequently posted and answered on R-Help. Cheers,

Re: [R] Base R Stats Package - quantile function

2023-07-11 Thread Bert Gunter
1. I highly doubt that anyone from the "R Core team" would respond to such a request. That is emphatically **not** their job. 2. More to the point, this is *exactly* the sort of task that *you*, as a student/practitioner of statistics and data analysis are expected to do for yourself. Indeed,

Re: [R] Getting an error calling MASS::boxcox in a function

2023-07-08 Thread Bert Gunter
Aha. Many thanks, John. Never would have gotten there on my own. -- Bert On Sat, Jul 8, 2023 at 2:01 PM John Fox wrote: > > Hi Bert, > > On 2023-07-08 3:42 p.m., Bert Gunter wrote: > > Caution: This email may have originated from outside the organization. > > Please exe

Re: [R] Getting an error calling MASS::boxcox in a function

2023-07-08 Thread Bert Gunter
1) > Estimated transformation parameters > Y1Y2 > 0.1740200 0.2089925 > > I hope this helps, > John > > -- > John Fox, Professor Emeritus > McMaster University > Hamilton, Ontario, Canada > web: https://www.john-fox.ca/ > > On 2023-07-08 12:47 p.m.

Re: [R] Getting an error calling MASS::boxcox in a function

2023-07-08 Thread Bert Gunter
No, I'm afraid I'm wrong. Something went wrong with my R session and gave me incorrect answers. After restarting, I continued to get the same error as you did with my supposed "fix." So just ignore what I said and sorry for the noise. -- Bert On Sat, Jul 8, 2023 at 8:28 AM Bert Gun

Re: [R] Getting an error calling MASS::boxcox in a function

2023-07-08 Thread Bert Gunter
Try this for your function: BoxCoxLambda <- function(z){ y <- z b <- boxcox(y + 1 ~ 1,lambda = seq(-5, 5, length.out = 61), plotit = FALSE) b$x[which.max(b$y)]# best lambda } ***I think*** (corrections and clarification strongly welcomed!) that `~` (the formula function) is looking

  1   2   3   4   5   6   7   8   9   10   >