Re: [R] [off-topic] crossword

2024-12-13 Thread Bill Dunlap
e, then "She votes" would work, but the across words made "codes" a more reasonable answer.) I was impressed that they expected the typical NYT reader to know that R was a programming language. -Bill On Fri, Dec 13, 2024 at 11:40 AM wrote: > Since this is a discussion about

Re: [R] [off-topic] crossword

2024-12-13 Thread Bill Dunlap
e other. > > -Original Message- > From: R-help On Behalf Of Erin Hodgess > Sent: Thursday, December 12, 2024 11:56 AM > To: Bill Dunlap > Cc: r-help@R-project.org > Subject: Re: [R] [off-topic] crossword > > [External Email] > > RULES! > > > Erin

[R] [off-topic] crossword

2024-12-12 Thread Bill Dunlap
The New York Times crossword this morning had the clue (51 down, 5 letters) "Writes in C or R, say". -Bill [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.

Re: [R] Skip jumps in curve

2024-02-13 Thread Bill Dunlap
negative: par(mfrow=c(2,1)) plot(tan(seq(0,10,by=1/4)), type="b") p(tan(seq(0,10,by=1/4)), predicate = function(dy)dy<0, type="b") -Bill On Tue, Feb 13, 2024 at 10:54 AM Duncan Murdoch wrote: > It should be pretty easy to generalize my version of the `plot.gamma()`

Re: [R] MASS::mvrnorm() on MKL may produce different numbers even when the seed is the same?

2023-08-17 Thread Bill Dunlap
o-the-conditional-numerical-reproducibility-cnr.html -Bill On Wed, Aug 16, 2023 at 8:11 PM Shu Fai Cheung wrote: > Hi All, > > When addressing an error in one of my packages in the CRAN check at CRAN, > I found something strange which, I believe, is unrelated to my package. > I am

Re: [R] Problem with filling dataframe's column

2023-06-13 Thread Bill Dunlap
grep("Q", d$a),] [1] a b <0 rows> (or 0-length row.names) > d[!grepl("Q", d$a),] a b 1 one 10 2 two 20 3 three 30 -Bill On Tue, Jun 13, 2023 at 6:19 AM Rui Barradas wrote: > Às 17:18 de 13/06/2023, javad bayat escreveu: > > Dear Rui; > > Hi. I u

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Bill Dunlap
s again (or not doing assignments inside of function calls). -Bill On Thu, May 18, 2023 at 7:38 AM Calboli Federico (LUKE) < federico.calb...@luke.fi> wrote: > Hello, > > I run a fisher.test() in a loop, with the issue that some of the data will > not be useable. To protect the lo

Re: [R] aggregate wind direction data with wind speed required

2023-05-13 Thread Bill Dunlap
reesCW = (pi - Arg(z*1i))/(2*pi)*360) } Then use FUN=mean instead of my_fun. -Bill On Sat, May 13, 2023 at 7:51 AM Stefano Sofia < stefano.so...@regione.marche.it> wrote: > Dear list users, > > I have to aggregate wind direction data (wd) using a function that > requires also

Re: [R] Regex Split?

2023-05-05 Thread Bill Dunlap
https://bugs.r-project.org/show_bug.cgi?id=16745 (from 2016, still labelled 'UNCONFIRMED") contains some other examples of strsplit misbehaving when using 0-length perl look-behinds. E.g., > strsplit(split="[[:<:]]", "One, two; three!", perl=TRUE)[[1]] [1] "O" "n" "e" ", " "t" "w" "o" "; "

Re: [R] DOUBT

2023-03-21 Thread Bill Dunlap
The HH Size is the problem - it doesn't follow R's rules for a name. Put backticks around it: `HH Size`. -Bill On Tue, Mar 21, 2023 at 9:47 AM Nandini raj wrote: > Respected sir/madam > can you please suggest what is an unexpected symbol in the below code for > running a m

Re: [R] function doesn't exists but still runs.....

2023-01-19 Thread Bill Dunlap
onment. > with(environment(wdman::selenium), java_check) function () { javapath <- Sys.which("java") if (identical(unname(javapath), "")) { stop("PATH to JAVA not found. Please check JAVA is installed.") } javapath } -Bill On Thu, Jan 19, 2023

Re: [R] Removing variables from data frame with a wile card

2023-01-14 Thread Bill Dunlap
grep("^yr", colnames(mydata))] data frame with 0 columns and 3 rows > mydata[, !grepl("^yr", colnames(mydata))] A B 1 1 11 2 2 12 3 3 13 -Bill On Fri, Jan 13, 2023 at 11:07 PM Eric Berger wrote: > mydata[, -grep("^yr",colnames(mydata))] > > On Sat, Jan 14, 2

Re: [R] return value of {....}

2023-01-13 Thread Bill Dunlap
return 0; } $ gcc -Wall a.c $ ./a.out Starting... Done: x=2200, y=110 I don't like that syntax (e.g., commas between expressions instead of the usual semicolons after expressions). Perhaps John Chambers et all didn't either. -Bill On Fri, Jan 13, 2023 at 2:28 AM Valentin Petzel wrote:

Re: [R] extract from a list of lists

2022-12-27 Thread Bill Dunlap
y(L, function(el) el$B, FUN.VALUE = logical(2)) : values must be length 2, but FUN(X[[3]]) result is length 0 > vapply(L, function(el){ z <- el$B; if (is.null(z)) rep(NA,2) else z}, FUN.VALUE=logical(2)) [,1] [,2] [,3] [1,] TRUE FALSE NA [2,] FALSE FALSE NA -Bill On Tue, Dec 27, 202

Re: [R] Error 3221226505

2022-12-18 Thread Bill Dunlap
Note that 3221226505 in base 10 is C409 in hexadecimal. You may have better luck looking for causes of this by googling the hex representation. -Bill On Sun, Dec 18, 2022 at 3:56 PM Mathurin, Gottfried via R-help < r-help@r-project.org> wrote: > Hello, > I currently face

Re: [R] is.na()<- on a character vector

2022-12-16 Thread Bill Dunlap
ld be considered a bug. -Bill On Fri, Dec 16, 2022 at 10:29 AM Göran Broström wrote: > I'm confused: > > > x <- 1:2 > > is.na(x) <- 1 > > x > [1] NA 2 > > OK, but > > > x <- c("A", &qu

Re: [R] Logistic regression for large data

2022-11-14 Thread Bill Dunlap
summary(Base) would show if one of columns of Base was read as character data instead of the expected numeric. That could cause an explosion in the number of dummy variables, hence a huge design matrix. -Bill On Fri, Nov 11, 2022 at 11:30 PM George Brida wrote: > Dear R users, > >

Re: [R] Replace multiple subexpressions at once?

2022-10-25 Thread Bill Dunlap
; new_regexp <- "(.*<[^>]+ data-pos=\")([^\"]*)(@)([[:digit:]]+)(:.*)" > all.equal( sub(new_regexp, "\\1newname\\3newnumber\\5", s), want) [1] TRUE -Bill On Tue, Oct 25, 2022 at 10:12 AM Duncan Murdoch wrote: > An R regular expression pattern can

Re: [R] cat in a subroutine

2022-10-13 Thread Bill Dunlap
Do you have another function called "cat" in scope? (with an argument called "j")? Before calling cat("...") call print(cat) and print(find("cat")). -Bill On Thu, Oct 13, 2022 at 12:35 AM Steven T. Yen wrote: > I have had an issue with printing (wit

Re: [R] Getting "Error in ect, plot.new has not been called yet" despite grouping plot call

2022-10-06 Thread Bill Dunlap
: plot.new has not been called yet > f(TRUE) [1] "C:\\Users\\willi\\AppData\\Local\\Temp\\Rtmp0wX7rO\\file34843df652c.pdf" If you remove the pdf() and dev.off() I think you will see that the added lines do not show up. I think plot.xts fiddles with the coordinate system before and af

Re: [R] How to find the variance-covariance matrix of a random-vector using R

2022-09-20 Thread Bill Dunlap
2 0.9261868 1.059799 [3,] 0.9627672 1.0228972 13.9296063 1.0444007 1.051089 [4,] 1.0371084 0.9261868 1.0444007 15.1556199 1.052573 [5,] 0.9832170 1.0597985 1.0510888 1.0525734 15.965351 -Bill On Tue, Sep 20, 2022 at 4:24 AM Sun, John wrote: > Dear All, > Reposting as plain tex

Re: [R] inconsistency in switch statements.....

2022-09-08 Thread Bill Dunlap
ther form. > f <- function(x, `2`) x - `2` > f("2"=7, 18) [1] 11 > f(`2`=7, 18) [1] 11 -Bill On Wed, Sep 7, 2022 at 11:41 PM Richard O'Keefe wrote: > You DON'T need to use backticks. switch() is much older than backticks. > Ordinary quotation marks a

Re: [R] Getting minimum value of a column according a factor column of a dataframe

2022-08-25 Thread Bill Dunlap
unused level as well > d |> group_by(factorGroup, .drop=FALSE) |> summarize(minX=min(x)) # A tibble: 4 × 2 factorGroup minX 1 Small 101 2 Medium104 3 Large 106 4 X Large Inf Warning message: In min(x) : no non-missing arguments to min; returning Inf -Bill

Re: [R] Error generated by nlme::gnls

2022-07-24 Thread Bill Dunlap
(pp[[3]], 1) && !identical(pp[[3]], 1L) or something equivalent would be better. -Bill On Sun, Jul 24, 2022 at 5:58 AM Ivan Krylov wrote: > Sorry for being too terse in my previous e-mail! > > On Sun, 24 Jul 2022 23:03:02 +1200 > Rolf Turner wrote: > > > The maintaine

Re: [R] aborting the execution of a function...

2022-07-13 Thread Bill Dunlap
"Alabama" "Alaska" "Arizona" "Arkansas" > eapply(e, identity) $Alabama NULL $Alaska NULL $Arizona NULL $Arkansas NULL -Bill On Wed, Jul 13, 2022 at 12:20 PM akshay kulkarni wrote: > Dear members, > I am running a l

Re: [R] Is it possible to set a default working directory for all R consoles?

2022-06-17 Thread Bill Dunlap
Is there an environment variable containing that IP address? as.list(grep(value=TRUE, "172", Sys.getenv())) # as.list to make printing nicer If you know which variable is causing the problem you may be able to override it by setting an R-specific one. -Bill On Fri, Jun 17, 2022

Re: [R] categorizing data

2022-05-29 Thread Bill Dunlap
])) > data tree shrub grass 1 301050 2 105030 3 503010 -Bill On Sun, May 29, 2022 at 12:29 PM Janet Choate wrote: > Hi R community, > I have a data frame with three variables, where each row adds up to 90. > I want to assign a category of low,

Re: [R] about opening R script Chinese annotation garble problem

2022-04-25 Thread Bill Dunlap
)) > s [1] " via R-help" > source(file("Chinese-utf-16.txt", encoding="UTF-16"), encoding="UTF-8") > s [1] "永创 via R-help" > Encoding(s) [1] "UTF-8" > charToRaw(s) [1] e6 b0 b8 e5 88 9b 20 76 69 61 20 52

Re: [R] Error with text analysis data

2022-04-13 Thread Bill Dunlap
our working model faster if you got NA's for the constant columns and then could drop them all at once (or otherwise deal with them). -Bill On Wed, Apr 13, 2022 at 9:40 AM Ebert,Timothy Aaron wrote: > I suspect that it is because you are looking at two types of error, both > tellin

Re: [R] Error with text analysis data

2022-04-13 Thread Bill Dunlap
Constant columns can be the model when you do some subsetting or are exploring a new dataset. My objection is that constant columns of numbers and logicals are fine but those of characters and factors are not. -Bill On Wed, Apr 13, 2022 at 9:15 AM Ebert,Timothy Aaron wrote: > What is the g

Re: [R] Error with text analysis data

2022-04-13 Thread Bill Dunlap
, data=d) Call: lm(formula = y ~ sexCode, data = d) Coefficients: (Intercept) sexCode 3 NA Calling traceback() after the error would clarify this. -Bill On Tue, Apr 12, 2022 at 3:12 PM Neha gupta wrote: > Hello everyone, I have text data with output variable have three sub

Re: [R] Inserting missing seq number

2022-03-30 Thread Bill Dunlap
stats::approx can do the job: > approx(x=df$seq, df$count, xout=1:7, method="constant", f=0) $x [1] 1 2 3 4 5 6 7 $y [1] 4 7 7 3 5 5 2 -Bill On Tue, Mar 29, 2022 at 7:47 PM Jeff Reichman wrote: > R-help > > Is there a R function that will insert missing sequence numbe

Re: [R] [External] Funky calculations

2022-02-02 Thread Bill Dunlap
Floats have 23 bits of precision so the rounding is done there instead of at 52 bits, hence a different example is needed to show the problem with floats. bill@Bill-T490:~$ cat b.c #include int main(int argc, char* argv[]) { float d = 0.4 + 0.4 + 0.4 + 0.4; printf("0.4+0.4+0.

Re: [R] [External] Funky calculations

2022-02-01 Thread Bill Dunlap
The base 2 representation of 0.4 repeats the digit sequence 1001 infinitely, hence must be rounded. The problem occurs in C the same as it does in R. bill@Bill-T490:~$ cat a.c #include int main(int argc, char* argv[]) { double d = 0.4 + 0.3 + 0.2 + 0.1; printf("0.4+0.3+0.

Re: [R] NAs are removed

2022-01-14 Thread Bill Dunlap
> fraction <- 0/0 > if (fraction < .5) TRUE else FALSE Error in if (fraction < 0.5) TRUE else FALSE : missing value where TRUE/FALSE needed -Bill On Fri, Jan 14, 2022 at 12:55 PM Bert Gunter wrote: > Unlikely. > > > 1/0 > [1] Inf ## not NA > > Bert >

Re: [R] Method Guidance

2022-01-13 Thread Bill Dunlap
pe, fromType="B", toType="A") fromTime toTime 1 102105 2 111115 > with(.Last.value, toTime - fromTime) [1] 3 4 With the dplyr package you can avoid the index 'i' by using lag() inside of mutate(). E.g., > d |> mutate(AtoB = (lag(type)==&qu

Re: [R] Error: if statement: missing value where TRUE/FALSE needed

2022-01-05 Thread Bill Dunlap
And how does one [easily] download those files from sourceforge? -Bill On Wed, Jan 5, 2022 at 10:15 AM Chuck Coleman via R-help < r-help@r-project.org> wrote: > This is a rather complex error, for which I created > https://sourceforge.net/projects/rhelp/files/Metro/ to ho

Re: [R] Using R to convert RDF/XML to

2021-12-31 Thread Bill Dunlap
ize should be 'x', not 'rdf'. Another error in the package is that this function isn't tested. -Bill On Fri, Dec 31, 2021 at 6:19 AM Evans, Richard K. (GRC-H000) via R-help < r-help@r-project.org> wrote: > Hello R community, > > I am a novice R ent

Re: [R] .Rdata not loading

2021-12-23 Thread Bill Dunlap
And a fourth thing to do: * dput(tail(n=20, readBin(".RData", what=raw(), n=file.size(".RData" This can show if the file got truncated. -Bill On Thu, Dec 23, 2021 at 5:25 PM Bill Dunlap wrote: > Three things you might try using R (and show the results in this emai

Re: [R] .Rdata not loading

2021-12-23 Thread Bill Dunlap
The last will print some hex numbers that others may be able to interpret. E.g., it may show that this .RData is not from a call to save() or save.image(). -Bill On Thu, Dec 23, 2021 at 11:19 AM Rich Shepard wrote: > Each time I finish with a session I save the image. Today the saved

Re: [R] Bug in list.files(full.names=T)

2021-12-20 Thread Bill Dunlap
" [15] "C:\\Users\\willi\\AppData\\Local\\GitHubDesktop\\bin" > table(grepl("$", strsplit(Sys.getenv("PATH"), ";")[[1]])) # c. 2:1 against terminal backslash FALSE TRUE 15 8 On Mon, Dec 20, 2021 at 9:30 AM Martin Maechler wrote: > >

Re: [R] Bug in list.files(full.names=T)

2021-12-20 Thread Bill Dunlap
6] "C:\\Program Files\\Pandoc\\" [7] "C:\\Program Files\\MiKTeX\\miktex\\bin\\x64\\" [8] "C:\\Program Files\\PuTTY\\" I did not add those entries by hand; all were added by installer programs. -Bill [[alternative HTML version deleted]] __

Re: [R] Problem with lm Giving Wrong Results

2021-12-02 Thread Bill Dunlap
On the 'bad' machines, what did you get for summary(fit) summary(k) summary(Z) summary(gm*gsd^Z) ? -Bill On Thu, Dec 2, 2021 at 6:18 AM Labone, Thomas wrote: > In the code below the first and second plots should look pretty much the > same, the only difference bein

Re: [R] Degree symbol as axis label superscript [RESOLVED]

2021-11-30 Thread Bill Dunlap
The following makes degree signs appropriately, as shown in ?plotmath: plot(68, 20, xlab=expression(degree*F), ylab=expression(degree*C)) If you want the word "degree" spelled out, put it in quotes. -Bill On Tue, Nov 30, 2021 at 12:31 PM Rich Shepard wrote: > On Tue, 30 N

Re: [R] Question about Rfast colMins and colMaxs

2021-11-30 Thread Bill Dunlap
could use vapply(yourDataFrame, which.min, FUN.VALUE=NA_real_) or vapply(yourDataFrame, min, FUN.VALUE=NA_real_) instead of colMins. -Bill On Tue, Nov 30, 2021 at 10:55 AM Stephen H. Dawson, DSL via R-help < r-help@r-project.org> wrote: > Hi, > > > I am working to un

Re: [R] read_csv() error I cannot find

2021-11-24 Thread Bill Dunlap
, "\n"); read_csv(file, ...)}) Then look at the first lines of those files and see if they have the expected column names. -Bill On Wed, Nov 24, 2021 at 9:46 AM Rich Shepard wrote: > On Wed, 24 Nov 2021, Ivan Krylov wrote: > > > This typically happens when you leave a trailing

Re: [R] R lattice contourplot: select only specific values

2021-11-17 Thread Bill Dunlap
Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit the cuts= argument). -Bill On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu wrote: > I have a dataframe of three variables: x, y, z. The value of z are: > ``` > > unique(df$z) > [1] 1.0 1.2 1.4 1.6 1.8 2.0

Re: [R] ggplot2: multiple box plots, different tibbles/dataframes

2021-11-11 Thread Bill Dunlap
your data. -Bill On Thu, Nov 11, 2021 at 5:50 AM Rich Shepard wrote: > On Wed, 10 Nov 2021, Avi Gross via R-help wrote: > > > I think many here may not quite have enough info to help you. > > Avi, > > Actually, you've reflected my thinking. > > > But the su

Re: [R] Fwd: Merging multiple csv files to new file

2021-11-03 Thread Bill Dunlap
idn't try to compute anything. The others' comments are still valid - you need to read the files named by these strings to produce R datasets and combine the datasets. -Bill On Wed, Nov 3, 2021 at 8:36 AM gabrielle aban steinberg < gabrielleabansteinb...@gmail.com> wrote: > Hello,

Re: [R] Is there a hash data structure for R

2021-11-02 Thread Bill Dunlap
nvironments and lists, neither of which is great. You may want your hash table functions to deal with oddball names explicitly. -Bill On Tue, Nov 2, 2021 at 8:52 AM Andrew Simmons wrote: > If you're thinking about using environments, I would suggest you initialize > them like > > &

Re: [R] tidyverse: read_csv() misses column

2021-11-01 Thread Bill Dunlap
_max rows on the input interspersed throughout the file. This is convenient (and fast), but not robust. If the imputation fails, you'll need to increase the guess_max or supply the correct types yourself. ... -Bill On Mon, Nov 1, 2021 at 10:16 AM Rich Shepard wrote: > > On Mon, 1 Nov 2

Re: [R] I'd like to request that my R CRAN package is not tested on Solaris OS

2021-10-22 Thread Bill Dunlap
gctorture(TRUE) helps too, but it will take a long time. -Bill On Fri, Oct 22, 2021 at 11:07 AM lampros mouselimis < mouselimislamp...@gmail.com> wrote: > Thank you all for your answers, > > I'll give it a try using both valgrind (on linux) and the rhub's linux gcc &

Re: [R] I'd like to request that my R CRAN package is not tested on Solaris OS

2021-10-22 Thread Bill Dunlap
I agree with Stefan. Try using valgrind (on Linux) to check for memory misuse: R --debugger=valgrind --debugger-args="--leak-check=full --track-origins=yes" ... > yourTests() > q("no") -Bill On Fri, Oct 22, 2021 at 7:30 AM Stefan Evert wrote: > Just to add my

Re: [R] Package installation help: Stuck at "** byte-compile and prepare package for lazy loading"

2021-09-30 Thread Bill Dunlap
istributions" "RVideoPoker""SyNet" [19] "tsgui" "uHMM" "GGEBiplots" [22] "decisionSupport""geneticae" E.g., > install.packages("forensim", type="so

Re: [R] Package installation help: Stuck at "** byte-compile and prepare package for lazy loading"

2021-09-30 Thread Bill Dunlap
Tcl_PkgRequireEx () from /usr/lib/x86_64-linux-gnu/libtcl8.6.so #10 0x7f95b96bdbe8 in Rplot_Init (interp=0x5625117460d0) at tcltkimg.c:465 and when I killed the R subprocess doing the lazyload prep I got a quasi-infinite stream of error messages: ... error reading package index file /home/bill/R-devel/R

Re: [R] Package installation help: Stuck at "** byte-compile and prepare package for lazy loading"

2021-09-30 Thread Bill Dunlap
I just tried installing forensim on R-devel/Ubuntu 20.04/WSL-2.0 without an X server (hence DISPLAY was not set). Loading tktcl gives a warning that Tk is not available because DISPLAY is not set. The installation hung after the byte-compile message: installing to /home/bill/R-devel/R-build/site

Re: [R] Rdversion ???

2021-09-28 Thread Bill Dunlap
uot;) so I am guessing you can ignore any \Rdversion declarations. -Bill On Tue, Sep 28, 2021 at 2:57 PM Rolf Turner wrote: > > I just noticed that a help file in one of my packages contains, > as the second line (just after the \name{ } macro), the line > > > \Rdversion{1.1}

Re: [R] Reading File Sizes: very slow!

2021-09-25 Thread Bill Dunlap
On my Windows 10 laptop I see evidence of the operating system caching information about recently accessed files. This makes it hard to say how the speed might be improved. Is there a way to clear this cache? > system.time(L1 <- size.f.pkg(R.home("library"))) user system elapsed 0.482

Re: [R] Trying to Learn Details of Grid Graphics, Help Page Errors

2021-09-23 Thread bill
Hi Paul, Thanks very much for the pointer! With that and a bit more investigation, I was able to make the following functions that seem to work in initial testing. Thanks, Bill library(grid) # The no_clipping function indicates if a shape is clipped in any dimension # relative to the entire

[R] Trying to Learn Details of Grid Graphics, Help Page Errors

2021-09-22 Thread bill
ere are many choices, and since I'm learning, I'm not sure which would be the best to use as an example. Thanks, Bill [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see http

Re: [R] 'Double to logical' error

2021-09-07 Thread Bill Dunlap
Thanks. If you can still reproduce the problem, what did rlang::last_trace() report? -Bill On Tue, Sep 7, 2021 at 3:37 AM John Tully wrote: > Thank you > > I ran: > > ```{r} > rlang::last_error() > ``` > > Here is the output: > > > Assigned data `sing

Re: [R] 'Double to logical' error

2021-09-06 Thread Bill Dunlap
> Run `rlang::last_error()` to see where the error occurred What did rlang::last_error() show? -Bill On Mon, Sep 6, 2021 at 9:19 AM John Tully wrote: > Dear colleagues > > > > in conducting a meta-analysis (of MRI data) I am running into the > repeated issue: > &g

Re: [R] Calculate daily means from 5-minute interval data

2021-09-05 Thread Bill Dunlap
-01 01:15:00 9 2020-11-01 01:30 PDT 20300 16.37 9.2 2020-11-01 01:30:00 10 2020-11-01 01:30 PST 20100 16.31 9.2 2020-11-01 01:30:00 11 2020-11-01 01:45 PDT 20300 16.35 9.2 2020-11-01 01:45:00 12 2020-11-01 01:45 PST 20100 16.29 9.2 2020-11-01 01:45:00 13 2020-11-01 02:00 PST

Re: [R] What if there's nothing to dispatch on?

2021-09-01 Thread Bill Dunlap
Is this the kind of thing you are looking for? It separates the scoping issue from the method dispatch by defining another S3-generic function, ".foo". > foo <- function(x, ..., data=NULL) with(data, .foo(x, ...)) > .foo <- function(x, ...) UseMethod(".foo") > .foo.default <- function(x, ...) cat

Re: [R] ISO Code for Namibia ('NA')

2021-09-01 Thread Bill Dunlap
> z <- tibble(Code=c("NA","NZ",NA), Name=c("Namibia","New Zealand","?")) > z # A tibble: 3 x 2 Code Name 1 NANamibia 2 NZNew Zealand 3 ? > subset(z, Code=="NA") # A tibble: 1 x 2 Code Name 1 NANamibia > subset(z, is.na(Code)) # A tibble: 1 x 2 Code Name 1 ? > su

Re: [R] ggplot error of "`data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class rxlsx"

2021-08-26 Thread Bill Dunlap
The packages "officer" and "readxl" both contain functions named "read_xlsx". It looks like you want the one from readxl so refer to it as readxl::read_xlsx instead of just read_xlsx. -Bill On Thu, Aug 26, 2021 at 12:03 PM Kai Yang via R-help wrote: > Hi all,

Re: [R] split element vector

2021-08-06 Thread Bill Dunlap
unlist(strsplit(vect, "\n")) On Fri, Aug 6, 2021 at 7:13 AM Luigi Marongiu wrote: > Hello, > I have a vector that contains some elements with concatenated values, such > as: > ``` > > vect > [1] "name_1" > [2] "name_2" > [3] "name_3\nsurname_3" > [4] "some other text\netc" > ``` > How can I crea

Re: [R] What are the pros and cons of the log.p parameter in (p|q)norm and similar?

2021-08-03 Thread Bill Dunlap
> system.time(for(i in 1:100)dnorm(q, log=TRUE)) user system elapsed 4.600.194.78 -Bill On Tue, Aug 3, 2021 at 11:53 AM Duncan Murdoch wrote: > On 03/08/2021 12:20 p.m., Michael Dewey wrote: > > Short version > > > > Apart from the ability to

Re: [R] Plotting confidence intervals with ggplot, in multiple facets.

2021-07-19 Thread Bill Dunlap
ggplot2::labs() interprets expressions as plotmath. E.g., data.frame(X=1:10,Y=(1:10)^2) %>% ggplot(aes(X,Y)) + geom_point() + labs(x = expression(beta), y = expression(beta^2)) -Bill On Mon, Jul 19, 2021 at 4:24 PM Rolf Turner wrote: > > > Thanks to Jeff Newmiller,

Re: [R] How to create a matrix from a list without a for loop

2021-07-09 Thread Bill Dunlap
Try matrix(init_l, nrow=4, ncol=4, dimnames=list(c("X1","X2","X3","X4"),c("X1","X2","X3","X4"))) It doesn't give exactly what your code does, but your code introduces an extra level of "list", which

Re: [R] List / Matrix to Data Frame

2021-07-01 Thread Bill Dunlap
Does this do what you want? > df <- data.frame(check.names=FALSE, lapply(c(Date="date",netIncome="netIncome",`Gross Profit`="grossProfit"), function(nm)vapply(ISY, "[[", nm, FUN.VALUE=NA_character_))) > str(df) 'data.frame': 36 obs. of 3 variables: $ Date: chr "2020-09-30" "2019-09-30

Re: [R] Special characters in cell names

2021-06-23 Thread Bill Dunlap
Use backquotes, `X/Y`, to specify a name, not double quotes. -Bill On Wed, Jun 23, 2021 at 11:58 AM Mahmood Naderan wrote: > Hi > I have a column in my data file which is "X/Y". With '/' I want to > emphasize that values are the ratio of X over Y. > Problem is t

Re: [R] How to spot/stop making the same mistake

2021-06-23 Thread Bill Dunlap
Note that !! and !!! are special operators involving "quasiquotation" in the dplyr package. I would use as.logical(x) instead of !!x since its meaning is clear to any user. -Bill On Wed, Jun 23, 2021 at 11:13 AM Jeff Newmiller wrote: > For the record, `!!` is not an operator s

Re: [R] How to spot/stop making the same mistake

2021-06-23 Thread Bill Dunlap
g like 'isYes' instead of 't' might help as well. -Bill On Wed, Jun 23, 2021 at 8:11 AM Phillips Rogfield wrote: > I make the same mistake all over again. > > In particular, suppose we have: > > a = c(1,2,3,4,5) > > and a variable that equals 1 for the elemen

Re: [R] Read fst files

2021-06-09 Thread Bill Dunlap
Try using unzip(zipfile, files="desiredFile", exdir=tf<-tempfile()), not unz(zipfile, "desiredFile"), to copy the desired file from the zip file to a temporary location and use read_fst(tf) to read the desired file. -Bill On Wed, Jun 9, 2021 at 11:27 AM Jeff Reichman

Re: [R] Beginner problem - using mod function to print odd numbers

2021-06-09 Thread Bill Dunlap
um+i instead of num<-num+1, which was simply an error, not a matter of style. R's vectorization makes it easy to avoid such errors.] -Bill On Wed, Jun 9, 2021 at 2:56 AM Martin Maechler wrote: > >>>>> David Carlsonon Sun, 6 Jun 2021 15:21:34 -0400 writes: > &g

Re: [R] About Pearson correlation functions

2021-05-30 Thread Bill Dunlap
You didn't say how the values differed. If one in the plot is a rounded version of the other then adding the ggpur::ggscatter() argument cor.coeff.args=list(digits=7) will fix things up. -Bill On Sun, May 30, 2021 at 9:18 AM Mahmood Naderan-Tahan < mahmood.nade...@ugent.be> w

Re: [R] No error message but don't get the 8 graphs

2021-05-10 Thread Bill Dunlap
Also, normalizePath("power.pdf"). On Sun, May 9, 2021 at 5:13 PM Bert Gunter wrote: > ?getwd > > 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 Su

Re: [R] R versions > 4.0.2 fail to start in Windows 64-bit

2021-04-21 Thread Bill Dunlap
Does this happen when you start R with the --vanilla flag? When you remove or rename ./.RData? -Bill On Tue, Apr 20, 2021 at 8:37 PM N. Jordan Jameson wrote: > I have a 64-bit Windows machine and I've installed R versions 4.0.0 through > 4.0.5 and only versions 4.0.2 and

Re: [R] Bug? Index output of C functions R_qsort_I and R_qsort_int_I is not modified

2021-04-15 Thread Bill Dunlap
R_ext/Utils.h:void R_qsort_int_I(int *iv, int *II, int i, int j); The last 2 arguments are int, not int*. .C() passes pointers to vectors so you cannot call this function directly from .C(). -Bill On Thu, Apr 15, 2021 at 3:15 PM Evangelos Evangelou via R-help < r-help@r-project.org>

Re: [R] evil attributes

2021-04-11 Thread Bill Dunlap
l arrays, the container size of a vector can be easily increased and decreased to complement different data storage types. Vectors have a dynamic structure and provide the ability to assign container size up front and enable allocation of memory space quickly. Vectors can be thought of as dynamic array

Re: [R] Violin plot with mean_sdl

2021-04-01 Thread Bill Dunlap
. -Bill On Wed, Mar 31, 2021 at 11:03 PM Mahmood Naderan-Tahan wrote: > > Hi, > > I followed the example described at [1] but I don't know why I get the > following warning > > > > library(ggplot2) > > library(Hmisc) > > mydata <- read.csv('test.

Re: [R] "for" loop does not work with my plot_ly command

2021-03-30 Thread Bill Dunlap
Printing the return value of plot_ly and friends works for me in the following examples: # make base plot p0 <- plotly::plot_ly(na.omit(palmerpenguins::penguins), x = ~bill_length_mm, y = ~body_mass_g) # now add things to base plot for(vrbl in list(~species, ~island, ~year)) { tmp <- plotly::add

Re: [R] Colorizing different individuals with fviz

2021-03-29 Thread Bill Dunlap
That error means that fviz_famd_ind has more than one argument that starts with 'col' and you must type a more complete name to disambiguate it. Perhaps col.ind=ifelse(...)? > args(factoextra::fviz_famd_ind) function (X, axes = c(1, 2), geom = c("point", "text"), repel = FALSE, habillage = "n

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Bill Dunlap
Your original query included > x <- c(1,0,0,0,2,2,3,4,0,1,1,0,5,5,5,0,1) ... I need 8 10 13. Did you also want the 1's at the ends to count as local maxima, so the result would be c(1,8,10,13,17)? Or do you want the maxima at endpoints only if there are no others? -BIll On

Re: [R] seed problem?

2021-03-29 Thread Bill Dunlap
Does this happen if you start R with the --vanilla flag? If so it may be that you have a startup file, .\.Rprofile or %HOME%\.Rprofile that is calling set.seed(n) for a fixed n. -Bill On Mon, Mar 29, 2021 at 12:16 AM Mika Hamari wrote: > > Hi! > > I have Windows 10 on PC and differ

Re: [R] local maxima positions in a vector with duplicated values

2021-03-29 Thread Bill Dunlap
If you want to accept maxima at the ends of the series, append -Inf to each end and subtract one from the result. Note that this will make even a constant sequence have a local maximum at 1. On Mon, Mar 29, 2021 at 6:52 AM Stefano Sofia wrote: > > Dear Bill, Bert, Greg and Abby, > I te

Re: [R] local maxima positions in a vector with duplicated values

2021-03-26 Thread Bill Dunlap
== -1,FALSE,FALSE)]+1 } -Bill On Fri, Mar 26, 2021 at 8:36 AM Stefano Sofia wrote: > > Dear list users, > I need to find local maxima and local minima positions in a vector where > there might be duplicates; in the particular in case of > - duplicated local maxima, I should tak

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] 1.00

Re: [R] library(hms)

2021-03-17 Thread Bill Dunlap
install.packages("hms") A 'library' is a directory (aka folder) that contains installed 'packages'. I.e., one installs packages into a library, but one does not install a library. -Bill On Wed, Mar 17, 2021 at 10:08 AM Gregory Coats via R-help wrote: > >

Re: [R] help

2021-03-16 Thread Bill Dunlap
The length of the mean vector must match the number of rows and columns of the sigma matrix. Once you give 3 entries in the mean vector you will run into the problem that the sigma you are using is not positive (semi-)definite - a variance must be the product of a matrix and its transpose. -Bill

Re: [R] Failure in predicting parameters

2021-03-14 Thread Bill Dunlap
> rutledge_param <- function(p, x, y) ((p$M / (1 + exp(-1*(p$x-p$m)/p$s))) + > p$B) - y Did you mean that p$x to be just x? As is, this returns numeric(0) for the p that nls.lm gives it because p$x is NULL and NULL-aNumber is numeric(). -Bill On Sun, Mar 14, 2021 at 9:46 AM Luigi

Re: [R] Warning messages while parallel computing

2021-03-04 Thread Bill Dunlap
1 at 11:28 AM Henrik Bengtsson wrote: > > Test with: > > clusterCall(cl, function() { suppressWarnings(source("xx.R")) }) > > If the warnings disappear, then the warnings are produced on the > workers from source():ing the file. > > /Henrik > > On Thu, Mar 4,

Re: [R] Warning messages while parallel computing

2021-03-04 Thread Bill Dunlap
keCluster(3, type="PSOCK") > invisible(gc()) > rm(cl) > invisible(gc()) Warning messages: 1: In .Internal(gc(verbose, reset, full)) : closing unused connection 6 (<-Bill-T490:11216) 2: In .Internal(gc(verbose, reset, full)) : closing unused connection 5 (<-Bill-T490:1121

Re: [R] Warning messages while parallel computing

2021-03-04 Thread Bill Dunlap
To avoid the warnings from gc(), call parallel::stopCluster(cl) before removing or overwriting cl. -Bill On Thu, Mar 4, 2021 at 1:52 AM Shah Alam wrote: > > Hello everyone, > > I am using the "parallel" R package for parallel computation. > > Code: > >

Re: [R] print and coef Methods for survreg Differ

2021-02-23 Thread bill
ithout data. > > > >Why does coef(model) provide zero as the coefficient for treatment >instead of NA? Is this a bug? > > > >Thanks, > > > >Bill > > > >``` r > >library(survival) > >library(emmeans) > > > >my_data <- > >

[R] print and coef Methods for survreg Differ

2021-02-23 Thread bill
s, but it seems inaccurate to have the `coef()` method provide zero as the coefficient for the level without data. Why does coef(model) provide zero as the coefficient for treatment instead of NA? Is this a bug? Thanks, Bill ``` r library(survival) library(emmeans) my_data &

Re: [R] Read

2021-02-22 Thread Bill Dunlap
some other way to tell where the omitted values are? -Bill On Mon, Feb 22, 2021 at 2:54 PM Val wrote: > > I Tried that one and it did not work. Please see the error message > Error in read.table(text = "x1 x2 x3 x4\n1 B12 \n2 C23 > \n322 B32 D34 \n4D44 \n5

Re: [R] Read

2021-02-22 Thread Bill Dunlap
Since the columns in the file are separated by a space character, " ", add the read.table argument sep=" ". -Bill On Mon, Feb 22, 2021 at 2:21 PM Val wrote: > > Hi all, I am trying to read a messy data but facing difficulty. The > data has several columns separ

Re: [R] How to load fasta file with openPrimeR?

2021-02-15 Thread Bill Dunlap
age = "openPrimeR") > ``` > where stx.fa il the file I wanted to open and that is present in the > working directly. I get only an empty object. If "stx.fa" is in fact in the current working directory then use fasta.file <- "stx.fa" system.file() is for acce

  1   2   3   4   >