Re: [R] refresh.console() function?

2024-03-13 Thread Deepayan Sarkar
in my loop. > > I previously heard of a R function namely refresh.console() which > would print the status within the loop as it progresses. > > However I see this > > > help.search("refresh.console") > > No vignettes or demos or help files found with alia

Re: [R] refresh.console() function?

2024-03-13 Thread Enrico Schumann
On Wed, 13 Mar 2024, Christofer Bogaso writes: > Hi, > > I run a lengthy for loop and I want to display loop status for each > step in my loop. > > I previously heard of a R function namely refresh.console() which > would print the status within the loop as it progress

[R] refresh.console() function?

2024-03-13 Thread Christofer Bogaso
Hi, I run a lengthy for loop and I want to display loop status for each step in my loop. I previously heard of a R function namely refresh.console() which would print the status within the loop as it progresses. However I see this > help.search("refresh.console") No vignettes or

Re: [R] [External] Function environments serialize to a lot of data until they don't

2024-03-11 Thread Ivan Krylov via R-help
Dear Luke, Thank you for the detailed explanation of the power of force()! It does solve my problem in a much more reliable manner than setting function environments manually. On Fri, 8 Mar 2024 15:46:52 -0600 (CST) luke-tier...@uiowa.edu wrote: > Having a reference to a large environment is

Re: [R] [External] Function environments serialize to a lot of data until they don't

2024-03-08 Thread luke-tierney--- via R-help
On Fri, 8 Mar 2024, Ivan Krylov via R-help wrote: Hello R-help, I've noticed that my 'parallel' jobs take too much memory to store and transfer to the cluster workers. I've managed to trace it to the following: # `payload` is being written to the cluster worker. # The function FUN had been

Re: [R] Capturing Function Arguments

2024-02-19 Thread Reed A. Cartwright
t;function_call")) }) environment(f) <- env return(f) } # example usage hist <- capture(graphics::hist.default) formals(hist) <- c(formals(hist), list(xname = NA_character_)) ``` On Sun, Feb 18, 2024 at 4:17 AM Ivan Krylov wrote: > > В Sat, 17 Feb 2024 11:15:43 -0700 > &

Re: [R] Capturing Function Arguments

2024-02-18 Thread Ivan Krylov via R-help
В Sat, 17 Feb 2024 11:15:43 -0700 "Reed A. Cartwright" пишет: > I'm wrapping a function in R and I want to record all the arguments > passed to it, including default values and missing values. This is hard if not impossible to implement for the general case because the d

Re: [R] Capturing Function Arguments

2024-02-18 Thread Iris Simmons
in the body of the function That being said, this function does well to handle other scenarios: ```R f <- function (...) { ## replace f0 as needed wrapped_function <- f0 call <- match.call(wrapped_function, expand.dots = FALSE) args <- as.list(call)[-1L] e <-

[R] Capturing Function Arguments

2024-02-18 Thread Reed A. Cartwright
I'm wrapping a function in R and I want to record all the arguments passed to it, including default values and missing values. I want to be able to snoop on function calls in sourced scripts as part of a unit testing framework. I can capture the values fine, but I'm having trouble evaluating them

Re: [R] by function does not separate output from function with mulliple parts

2023-10-25 Thread Rui Barradas
Às 00:22 de 25/10/2023, Sorkin, John escreveu: Colleagues, I have written an R function (see fully annotated code below), with which I want to process a dataframe within levels of the variable StepType. My program works, it processes the data within levels of StepType, but the usual headers

Re: [R] by function does not separate output from function with, mulliple parts

2023-10-25 Thread Leonard Mada via R-help
Dear John, Printing inside the function is problematic. Your function itself does NOT print the labels. Just as a clarification: F = factor(rep(1:2, 2)) by(data.frame(V = 1:4, F = F), F, function(x) { print(x); return(NULL); } ) #   V F # 1 1 1 # 3 3 1 #   V F # 2 2 2 # 4 4 2 # F: 1 <- this

[R] by function does not separate output from function with mulliple parts

2023-10-24 Thread Sorkin, John
Colleagues, I have written an R function (see fully annotated code below), with which I want to process a dataframe within levels of the variable StepType. My program works, it processes the data within levels of StepType, but the usual headers that separate the output by levels of StepType

Re: [R] predict function type class vs. prob

2023-09-23 Thread Rolf Turner
On Fri, 22 Sep 2023 10:12:51 + "Milbert, Sabine (LGL)" wrote: > Dear R Help Team, In addition to other misapprehensions that others have pointed out, you seem to have a fundamental misunderstanding of R-help (and perhaps of R). There is no such thing as the "R Help Team". This is a

Re: [R] predict function type class vs. prob

2023-09-23 Thread David Winsemius
. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. On 9/23/23 05:30, Rui Barradas wrote: > Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: >> Dear R Help Team, >> >> My research group and I use R scripts

Re: [R] predict function type class vs. prob

2023-09-23 Thread Ivan Krylov
В Fri, 22 Sep 2023 10:12:51 + "Milbert, Sabine (LGL)" пишет: > PS: If this is an issue based on the model training function of the > caret package and therefore not your responsibility, please let us > know. Indeed, as Rui Barradas said, predict() is a generic function. Calling it with your

Re: [R] predict function type class vs. prob

2023-09-23 Thread David Winsemius
nconsistencies within the predict() function of the R Stats Package. In addition to Rui's correction to this misstatement, the caret package is really a meta package that attempts to implement an umbrella framework for a vast array of tools from a wide variety of sources. It is an immense effort bu

Re: [R] predict function type class vs. prob

2023-09-23 Thread Rui Barradas
Às 11:12 de 22/09/2023, Milbert, Sabine (LGL) escreveu: Dear R Help Team, My research group and I use R scripts for our multivariate data screening routines. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. Through internal research

[R] predict function type class vs. prob

2023-09-22 Thread Milbert, Sabine (LGL)
Dear R Help Team, My research group and I use R scripts for our multivariate data screening routines. During routine use, we encountered some inconsistencies within the predict() function of the R Stats Package. Through internal research, we were unable to find the reason for this and have

Re: [R] col2rgb() function

2023-07-23 Thread Ben Bolker
You could also adjustcolor for this approach (levels of red, green, blue, alpha can all be adjusted proportionally) On 2023-07-23 5:35 p.m., David Stevens via R-help wrote: Nick, I've also made colors transparent by pasting the hex equivalent of, say, 0.3*256 = 76.9 to the hex color code.

Re: [R] col2rgb() function

2023-07-23 Thread David Stevens via R-help
Nick, I've also made colors transparent by pasting the hex equivalent of, say, 0.3*256 = 76.9 to the hex color code. e.q. for black it might be "#004d" and the 4d is 77 in hex. That way you don't need to convert back and forth so much. If col is "#00" the transparent version is tcol

Re: [R] col2rgb() function

2023-07-23 Thread Nick Wray
Thanks v useful to know Nick On Sun, 23 Jul 2023 at 21:13, Achim Zeileis wrote: > Just one addition which may or may not be useful: The color palette you > use is also known as "Okabe-Ito" and it is the default set of colors in > the palette.colors() function. This function also has an optional

Re: [R] col2rgb() function

2023-07-23 Thread Achim Zeileis
Just one addition which may or may not be useful: The color palette you use is also known as "Okabe-Ito" and it is the default set of colors in the palette.colors() function. This function also has an optional alpha argument. So if you want to generate these colors with an alpha of 0.3 you can

Re: [R] col2rgb() function

2023-07-23 Thread Nick Wray
Thanks That works nicely Nick On Sun, 23 Jul 2023 at 19:26, Ben Bolker wrote: >Does adjustcolor() help? > > cb8<- c("#00", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2", > "#D55E00", "#CC79A7") > plot(0,0,xlim=c(1,8),ylim=c(0,1)) > points(1:8,rep(0.5,8),col=cb8,pch=19,cex=2)

Re: [R] col2rgb() function

2023-07-23 Thread Duncan Murdoch
On 23/07/2023 2:15 p.m., Nick Wray wrote: Hello I have a palette vector of colour blind colours (in hexadecimal) which I’m using for plots, but they are not see-through, and as I wanted to overlay some histograms I wanted to convert these colours to rgb, when you can set the opacity. I have

Re: [R] col2rgb() function

2023-07-23 Thread Ben Bolker
Does adjustcolor() help? cb8<- c("#00", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2", "#D55E00", "#CC79A7") plot(0,0,xlim=c(1,8),ylim=c(0,1)) points(1:8,rep(0.5,8),col=cb8,pch=19,cex=2) points(1:8,rep(0.75,8),col=adjustcolor(cb8, alpha.f = 0.3), pch=19,cex=2) On 2023-07-23 2:15

[R] col2rgb() function

2023-07-23 Thread Nick Wray
Hello I have a palette vector of colour blind colours (in hexadecimal) which I’m using for plots, but they are not see-through, and as I wanted to overlay some histograms I wanted to convert these colours to rgb, when you can set the opacity. I have found the function col2rgb(), which works in

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

[R] PROP_TEST function from INFER package

2023-05-15 Thread alfredo.roccato
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

Re: [R] seqMK function

2023-04-03 Thread Rasmus Liland
Dear Nick, Looking at dput(pheno::seqMK), dput(pheno::tau), and [1], I think you need to change the function pheno::tau to change the confidence level ... R [1] https://mannkendall.github.io/about.html#application-of-the-seasonal-mann-kendall-test

[R] seqMK function

2023-03-30 Thread Nick Wray
Hello does anyone know how to set the confidence level within the seqMK() function in the pheno package. It seems to be set automatically at 0.05 and there seems to be neither an input function to set a different level, as there are with some changepoint functions, nor an output to give one the

Re: [R] Generic Function read?

2023-02-28 Thread John Kane
Have a look at the {rio} package. On Tue, 28 Feb 2023 at 15:00, Leonard Mada via R-help wrote: > Dear R-Users, > > I noticed that *read* is not a generic function. Although it could > benefit from the functionality available for generic functions: > > read = function(file, ...)

[R] Generic Function read?

2023-02-28 Thread Leonard Mada via R-help
Dear R-Users, I noticed that *read* is not a generic function. Although it could benefit from the functionality available for generic functions: read = function(file, ...) UseMethod("read") methods(read)  # [1] read.csv read.csv2    read.dcf read.delim read.delim2  read.DIF

Re: [R] Information function in CRM model

2022-01-06 Thread Bert Gunter
If you haven't already done so, you should probably look here: https://cran.r-project.org/web/views/Psychometrics.html Further detailed discussion of the statistics is generally off topic here. Per the posting guide (linked below): "Questions about statistics: The R mailing lists are primarily

Re: [R] Information function in CRM model

2022-01-06 Thread Cecilia Reyna
Please, forget and delete the previous post! Thanks! On Thu, Jan 6, 2022 at 7:02 AM Cecilia Reyna wrote: > Dear, > > I am trying to model the information function of items (and full) based on > the continuous response model. > > I am using the EstCRM (1.4) package, but it doesn't compute the

[R] Information function in CRM model

2022-01-06 Thread Cecilia Reyna
Dear, I am trying to model the information function of items (and full) based on the continuous response model. I am using the EstCRM (1.4) package, but it doesn't compute the information function. Another person noticed me of Wang & Zeng's paper (Item parameter estimation for a continuous

Re: [R] Improvement: function cut

2021-09-18 Thread David Winsemius
On 9/18/21 5:28 AM, Leonard Mada via R-help wrote: Hello Andrew, I add this info as a completion (so other users can get a better understanding): If we want to perform a survival analysis, than the interval should be closed to the right, but we should include also the first time point (as

Re: [R] Improvement: function cut

2021-09-18 Thread Leonard Mada via R-help
Hello Andrew, I add this info as a completion (so other users can get a better understanding): If we want to perform a survival analysis, than the interval should be closed to the right, but we should include also the first time point (as per Intention-to-Treat): [0, 4](4, 8](8, 12](12, 16]

Re: [R] Improvement: function cut

2021-09-17 Thread Bert Gunter
Perhaps you and Andrew should take this discussion off list... 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, Sep 17, 2021 at 3:45 PM Leonard Mada via

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
The warn should be in cut() => .bincode(). It should be generated whenever a real value (excludes NA or NAN or +/- Inf) is not included in any of the bins. If the user writes a script and doesn't want any warnings: he can select warn = FALSE. But otherwise it would be very helpful to catch

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Why would you want to merge different factors? It makes no sense on real data. Even if some names are the same, the factors are not the same! The only real-data application that springs to mind is censoring (right or left, depending on the choice): but here we have both open and closed

Re: [R] Improvement: function cut

2021-09-17 Thread Jeff Newmiller
Re your objection that "the user has to suspect that some values were not included" applies equally to your proposed warn option. There are a lot of ways to introduce NAs... in real projects all analysts should be suspecting this problem. On September 17, 2021 3:01:35 PM PDT, Leonard Mada via

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Hello Andrew, But "cut" generates factors. In most cases with real data one expects to have also the ends of the interval: the argument "include.lowest" is both ugly and too long. [The test-code on the ftable thread contains this error! I have run through this error a couple of times.] The

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
I disagree, I don't really think it's too long or ugly, but if you think it is, you could abbreviate it as 'i'. x <- 0:20 breaks1 <- seq.int(0, 16, 4) breaks2 <- seq.int(0, 20, 4) data.frame( cut(x, breaks1, right = FALSE, i = TRUE), cut(x, breaks2, right = FALSE, i = TRUE),

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
While it is not explicitly mentioned anywhere in the documentation for .bincode, I suspect 'include.lowest = FALSE' is the default to keep the definitions of the bins consistent. For example: x <- 0:20 breaks1 <- seq.int(0, 16, 4) breaks2 <- seq.int(0, 20, 4) cbind( .bincode(x, breaks1,

Re: [R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Thank you Andrew. Is there any reason not to make: include.lowest = TRUE the default? Regarding the NA: The user still has to suspect that some values were not included and run that test. Leonard On 9/18/2021 12:53 AM, Andrew Simmons wrote: > Regarding your first point, argument

Re: [R] Improvement: function cut

2021-09-17 Thread Andrew Simmons
Regarding your first point, argument 'include.lowest' already handles this specific case, see ?.bincode Your second point, maybe it could be helpful, but since both 'cut.default' and '.bincode' return NA if a value isn't within a bin, you could make something like this on your own. Might be worth

[R] Improvement: function cut

2021-09-17 Thread Leonard Mada via R-help
Hello List members, the following improvements would be useful for function cut (and .bincode): 1.) Argument: Include extremes extremes = TRUE if(right == FALSE) {    # include also right for last interval; } else {    # include also left for first interval; } 2.) Argument: warn = TRUE

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Definitely doable and you are on the right path and maybe even close. The error message you got showed your query as having the wrong info after the 'FROM' keyword ' SELECT * FROM c("BIODBX.MECCUNIQUE2", "BIODBX.QDATA_HTML_DUMMY", "BIODBX.SET_ITEMS", "BIODBX.SET_NAMES", "dbo.sysdiagrams",

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hi Eric, Thank you spent time to help me for this. Here is the thing: I was requested to manage a sql server for my group. the server has many schemas and the tables (>200). I use ODBC to connect the server and get the schema name + table name into a data frame. For each of schema + table on

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Jeff Newmiller
Not all advice received on the Internet is safe. https://xkcd.com/327 https://db.rstudio.com/best-practices/run-queries-safely It is not that much more difficult to do it right. On July 2, 2021 12:05:43 PM PDT, Eric Berger wrote: >Modify the summ() function to start like this > >summ <-

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Hard for me to tell without more details but it looks like the following has several bugs for (i in dbtable$Tot_table) { Tabname <- as.character(sqldf(sprintf("SELECT Tot_table FROM dbtable", i))) summ(Tabname) } Your sprintf() statement seems to use 'i' but actually does not. You probably

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello Eric, Following your suggestion, I modified the code as: summ <- function(Tabname){   query <- sprintf(" SELECT * FROM %s",Tabname)   res <- dbGetQuery(con, query)   view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.Tabname.html")   rm(res) } for (i in

Re: [R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Eric Berger
Modify the summ() function to start like this summ <- function(Tabname){ query <- sprintf(" SELECT * FROM %s",Tabname) res <- dbGetQuery(con, query) etc HTH, Eric On Fri, Jul 2, 2021 at 9:39 PM Kai Yang via R-help wrote: > Hello List, > > The previous post look massy. I repost my

[R] R Function question, (repost to fix the messy work format)

2021-07-02 Thread Kai Yang via R-help
Hello List, The previous post look massy. I repost my question. Sorry, I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate report: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2") view(dfSummary(res), file =

[R] R function question

2021-07-02 Thread Kai Yang via R-help
Hello List,I need to generate summary report for many tables (>200 tables). For each table, I can use the script to generate repost: res <- dbGetQuery(con, "SELECT * FROM BIODBX.MECCUNIQUE2")view(dfSummary(res), file = "W:/project/_Joe.B/MSSQL/try/summarytools.BIODBX.MECCUNIQUE2.html")rm(res)

Re: [R] .Last function in R 4.1.0

2021-06-07 Thread Duncan Murdoch
And to expand a bit: only the site file tries to put objects into the base package. The local .Rprofile file would put them into the global environment. So there's still support for .First and .Last, but it has changed. This abuses things a bit, but appears to work in an Rprofile.site

Re: [R] .Last function in R 4.1.0

2021-06-07 Thread Bert Gunter
According to the News file for 4.1.0 -- you should always check there first for such things -- "The base environment and its namespace are now locked (so one can no longer add bindings to these or remove from these)." So the docs do seem to need updating. Bert Gunter "The trouble with having

[R] .Last function in R 4.1.0

2021-06-07 Thread Paul Louisell
Here's my relevant OS / version info for background: R version 4.1.0 (2021-05-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043) Here's the problem: I've inserted the following lines *only *into my Rprofile.site file in the etc folder: if(interactive()){

Re: [R] Optimization function producing negative parameter values

2021-03-21 Thread J C Nash
This is likely because Hessian is being approximated. Numerical approximation to Hessian will overstep the bounds because the routines that are called don't respect the bounds (they likely don't have the bounds available). Writing numerical approximations that respect bounds and other

Re: [R] Optimization function producing negative parameter values

2021-03-21 Thread Bill Dunlap
Does optim go out of bounds when you specify hessian=FALSE? hessian=TRUE causes some out-of-bounds evaluations of f. > optim(c(X=1,Y=1), > function(XY){print(unname(XY));(XY[["X"]]+1)^4+(XY[["Y"]]-2)^4}, method= > "L-BFGS-B", lower=c(0.001,0.001), upper=c(1.5,1.5), hessian=TRUE) [1] 1 1 [1]

Re: [R] Optimization function producing negative parameter values

2021-03-21 Thread J C Nash
Can you put together your example as a single runnable scipt? If so, I'll try some other tools to see what is going on. There have been rumours of some glitches in the L-BFGS-B R implementation, but so far I've not been able to acquire any that I can reproduce. John Nash (maintainer of optimx

[R] Optimization function producing negative parameter values

2021-03-21 Thread Shah Alam
Dear all, I am using optim() to estimate unknown parameters by minimizing the residual sums of squares. I created a function with the model. The model is working fine. The optim function is producing negative parameter values, even I have introduced upper and lower bounds (given in code).

Re: [R] mpfr function in Rmpfr crashes R

2021-03-07 Thread Duncan Murdoch
It works for me, on a slightly different system than yours: > Rmpfr::mpfr(pi, 120) 1 'mpfr' number of precision 120 bits [1] 3.1415926535897931159979634685441851616 > sessionInfo() R version 4.0.3 Patched (2021-01-30 r79912) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS

Re: [R] mpfr function in Rmpfr crashes R

2021-03-07 Thread John Fox
Dear Roger, This works perfectly fine for me on an apparently similar system, with the exceptions that I'm running R 4.0.4, have many fewer packages loaded, and am in a slightly different locale: --- snip > Rmpfr::mpfr(pi, 120) 1 'mpfr' number of precision 120

[R] mpfr function in Rmpfr crashes R

2021-03-07 Thread Roger Bos
All, The following code crashes by R on my mac with a message "R session aborted. A fatal error occured". ``` library(Rmpfr) Rmpfr::mpfr(pi, 120) ``` Does anyone have any suggestions? My session info is below: R version 4.0.3 (2020-10-10) Platform: x86_64-apple-darwin17.0 (64-bit) Running

Re: [R] Help Required for R Markdown function.

2021-03-01 Thread Jeff Newmiller
trivial such as >kit not knowing where to place a library so it puts it into a temp >area? > >Avi > >-Original Message- >From: R-help On Behalf Of John Kane >Sent: Saturday, February 27, 2021 3:07 PM >To: Kishor raut >Cc: R. Help Mailing List >Subject: Re:

Re: [R] Help Required for R Markdown function.

2021-03-01 Thread Avi Gross via R-help
made a new empty markdown but as it asks for nothing, it has no problems  From: CALUM POLWART Sent: Monday, March 1, 2021 2:31 AM To: Avi Gross Cc: 'R. Help Mailing List' Subject: Re: [R] Help Required for R Markdown function. Sounds like you have an install.packages("tidyverse&q

Re: [R] Help Required for R Markdown function.

2021-02-28 Thread Avi Gross via R-help
t into a temp area? Avi -Original Message- From: R-help On Behalf Of John Kane Sent: Saturday, February 27, 2021 3:07 PM To: Kishor raut Cc: R. Help Mailing List Subject: Re: [R] Help Required for R Markdown function. The "confusionMatrix" function appears to be from the 'caret'

Re: [R] Help Required for R Markdown function.

2021-02-28 Thread Kishor raut
Thanks, I'll check it out. On Sun, 28 Feb, 2021, 1:37 AM John Kane, wrote: > The "confusionMatrix" function appears to be from the 'caret' package. > Have you loaded 'caret' with the library(caret) command? > > On Sat, 27 Feb 2021 at 14:20, Kishor raut wrote: > >> Respected Sir, >> >> I Mr

Re: [R] Help Required for R Markdown function.

2021-02-27 Thread John Kane
The "confusionMatrix" function appears to be from the 'caret' package. Have you loaded 'caret' with the library(caret) command? On Sat, 27 Feb 2021 at 14:20, Kishor raut wrote: > Respected Sir, > > I Mr Kishor Tried to get help online but wont found the solution so > writting an email. > >

[R] Help Required for R Markdown function.

2021-02-27 Thread Kishor raut
Respected Sir, I Mr Kishor Tried to get help online but wont found the solution so writting an email. Step1: While writting in rmarkdown all codes get executted very well till the fuction Confusionmatrix were written on it. Step2: As confusionmatrix command inserted following error is on screen

Re: [R] Dalex function in mlr3

2021-02-02 Thread Bert Gunter
Please note per the posting guide linked below: "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R ), ask questions on R-help. If the question relates to a *contributed

[R] Dalex function in mlr3

2021-02-02 Thread Neha gupta
Hi to everyone I just wanted to know if the dalex package of the mlr3 provides the same functions (i.e. variable importance) as provided by the scott-knott-esd test? Warm regards [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] pgmm function errors in R

2021-01-22 Thread Bert Gunter
1. Please read the posting guide. Statistical questions and questions on non-standard (not shipped with standard R distro) packages are largely off topic here. 2. This CRAN task view might be of interest to you: https://cran.r-project.org/web/views/Econometrics.html 3. But as a general comment,

[R] pgmm function errors in R

2021-01-22 Thread Wadim iLchuk
Hello everyone, My name is Vadym, I am a last-year student at Stockholm School of Economics in Riga, currently working on my Bachelor's Thesis (so still learning R). For my research, I need a GMM estimator (preferable Arellano and Bond, 1991). I have been searching for a solution to my issue for

Re: [R] colMeans function

2020-11-04 Thread Rui Barradas
Hello, No, flights[2] is *not* equal to flights$months. The former is a data.frame with only one column, therefore it has a dimension attribute. The latter is a column, a vector of the data.frame flights, it does not have the attribute dim set. The difference is very important, see what

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.

Re: [R] colMeans function

2020-11-04 Thread Duncan Murdoch
On 04/11/2020 8:26 a.m., 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

[R] colMeans function

2020-11-04 Thread Engin Yılmaz
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

Re: [R] R optim() function

2020-10-29 Thread J C Nash
The issue is almost certainly in the objective function i.e., diagH, since Nelder Mead doesn't use any matrix operations such as Choleski. I think you probably need to adjust the objective function to catch singularities (non-positive definite cases). I do notice that you have two identical

[R] R optim() function

2020-10-29 Thread Baker, Kieran via R-help
Hi R-Help, I am using R to do functional outlier detection (using PCA to reduce to 2 dimensions - the functional boxplot methodology used in the Rainbow package), and using Hscv.diag function to calculate the bandwidth matrix where this line of code is run: result <- optim(diag(Hstart),

Re: [R] [External] Function of "matrix"

2020-10-22 Thread Richard M. Heiberger
FAQ 7.31 > 10.1/.1 [1] 101 > print(10.1/.1, digits=17) [1] 100.99 > floor(10.1/.1) [1] 100 > floor(10.1*10) [1] 101 > matrix(0, 2.9, 3.9) [,1] [,2] [,3] [1,]000 [2,]000 > note that the dimension arguments are passed through floor() before they are used.

Re: [R] summarize_all Function

2020-10-02 Thread Jeff Reichman
Thanks Bill – got it From: Bill Dunlap Sent: Thursday, October 1, 2020 1:56 PM To: reichm...@sbcglobal.net Cc: r-help@r-project.org Subject: Re: [R] summarize_all Function The warning gives some suggestions. E.g., replace funs(sum,prod) with list(sum=sum,prod=prod). % R CMD Rscript

Re: [R] summarize_all Function

2020-10-02 Thread Jeff Reichman
Thanks Rui -Original Message- From: Rui Barradas Sent: Thursday, October 1, 2020 1:49 PM To: reichm...@sbcglobal.net; r-help@r-project.org Subject: Re: [R] summarize_all Function Hello, Any of the two will do, the first is now preferred. library(dplyr) mtcars %>% summar

Re: [R] summarize_all Function

2020-10-01 Thread Bill Dunlap
The warning gives some suggestions. E.g., replace funs(sum,prod) with list(sum=sum,prod=prod). % R CMD Rscript -e 'library(dplyr,warn.conflicts=FALSE); data.frame(X=1:3,Y=c(11,13,17)) %>% summarize_all(funs(sum,prod))' X_sum Y_sum X_prod Y_prod 1 641 6 2431 Warning message:

Re: [R] summarize_all Function

2020-10-01 Thread Rui Barradas
Hello, Any of the two will do, the first is now preferred. library(dplyr) mtcars %>% summarise(across(everything(), sum)) mtcars %>% summarise_all(sum) # no need for `funs()` Hope this helps, Rui Barradas Às 18:29 de 01/10/20, Jeff Reichman escreveu: r-help Forum I'm using

[R] summarize_all Function

2020-10-01 Thread Jeff Reichman
r-help Forum I'm using the dplyr:: summarize_all(funs(sum)) function and am receiving a warning message that the `funs()` is deprecated as of dplyr 0.8.0. Ok what should I be using to summarize all columns by sum? Jeff [[alternative HTML version deleted]]

Re: [R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Rui Barradas
escreveu: Colleagues, The by function in the R program below is not giving me the sums I expect to see, viz., 382+170=552 4730+170=4900 5+6=11 199+25=224 ### #full R program: mydata <- data.frame(covid=c(0,0,0,0,1,1,1,1), sex=(rep(c(1,1,0,0

Re: [R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Rasmus Liland
On 2020-07-24 01:48 +0200, Rasmus Liland wrote: > aggregate(x=list("values"=mydata$values), > by=list("sex"=mydata$sex, > "status"=mydata$status), > FUN=sum) > > yields > > sex status values > 1 0 0224 >

Re: [R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Rasmus Liland
On 2020-07-23 18:54 -0400, Duncan Murdoch wrote: > On 23/07/2020 6:15 p.m., Sorkin, John wrote: > > Colleagues, > > The by function in the R program below is not giving me the sums > > I expect to see, viz., > > 382+170=552 > > 4730+1

Re: [R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Duncan Murdoch
On 23/07/2020 6:15 p.m., Sorkin, John wrote: Colleagues, The by function in the R program below is not giving me the sums I expect to see, viz., 382+170=552 4730+170=4900 5+6=11 199+25=224 ### #full R program: mydata <- data.frame(covi

Re: [R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Bert Gunter
in his "Bloom County" comic strip ) On Thu, Jul 23, 2020 at 3:25 PM Sorkin, John wrote: > Colleagues, > > The by function in the R program below is not giving me the sums > I expect to see, viz., > 382+170=552 > 4730+170=4900 > 5+6=11 > 199+25=224 > ###

[R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Sorkin, John
Colleagues,   The by function in the R program below is not giving me the sums I expect to see, viz., 382+170=552 4730+170=4900 5+6=11 199+25=224 ### #full R program: mydata <- data.frame(covid=c(0,0,0,0,1,1,1,1), sex=(rep(c(1,1,0,0),2)), status=

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Rasmus Liland
On 2020-05-13 13:13 -0700, Jeff Newmiller wrote: > In general, any time you deal with floating > point numbers having different magnitudes, > you risk pushing some low precision bits > out of the result. Simply changing the > sequence of calculations such as a literal > polynomial evaluation

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Jeff Newmiller
In general, any time you deal with floating point numbers having different magnitudes, you risk pushing some low precision bits out of the result. Simply changing the sequence of calculations such as a literal polynomial evaluation versus Horner's method can obtain different results. Take a

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Rasmus Liland
On 2020-05-13 11:44 -0700, Jeff Newmiller wrote: > Depending on reproducibility in the least > significant bits of floating point > calculations is a bad practice. Just > because you decide based on this one > example that one implementation of BLAS is > better than another does not mean that

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Jeff Newmiller
Depending on reproducibility in the least significant bits of floating point calculations is a bad practice. Just because you decide based on this one example that one implementation of BLAS is better than another does not mean that will be true for all specific examples. IMO you are drawing

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Rasmus Liland
On 2020-05-13 13:04 -0400, J C Nash wrote: > On 2020-05-13 11:28 a.m., Rasmus Liland wrote: > > > > I get another solution on my Linux i7-7500U > > > > > D %*% solve(D) > > [,1] [,2] > > [1,] 1.00e+000 > > [2,] 8.881784e-161 > > > sessionInfo() > > BLAS:

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread J C Nash
Note that my sessionInfo() gave R version 4.0.0 (2020-04-24) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Linux Mint 19.3 Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1 So you have an older R

Re: [R] solve() function freezes CLI in GNU R 3.6.3

2020-05-13 Thread Rasmus Liland
On 2020-05-09 11:40 -0400, J C Nash wrote: > > > solve(D) > [,1] [,2] > [1,] -2.0 1.0 > [2,] 1.5 -0.5 > > D %*% solve(D) > [,1] [,2] > [1,]1 1.110223e-16 > [2,]0 1.00e+00 > > Dear list, I get another solution on my Linux i7-7500U laptop, but the same solution on

  1   2   3   4   5   6   7   8   9   10   >