Re: [R] Possible bug in direct.evidence.plot?

2025-01-06 Thread Eric Berger
might work but netmetabin may cause problems. > I'll notify Mathias Harrer! > > BW > Miland > > -- > *From:* Eric Berger > *Sent:* 06 January 2025 08:24 > *To:* Miland Joshi > *Cc:* r-help@R-project.org > *Subject:* Re: [R] Possible

Re: [R] Possible bug in direct.evidence.plot?

2025-01-06 Thread Eric Berger
The explanation is likely that class(x) returns a character vector of length > 1. If you go into the code you can achieve what is probably intended without triggering this error by replacing that statement with the following: if (inherits(x,"netmeta")) ... HTH, Eric On Mon, Jan 6, 2025 at 9:57 

Re: [R] Problem installing some r-packages via spack

2024-11-26 Thread Eric Berger
I have never used Spack but I took a quick look at their website. They have the option to install binaries. Perhaps this could work for you and avoid the compilation error. Here is where they describe how to do it: https://spack.io/spack-binary-packages/ On Wed, Nov 27, 2024 at 9:29 AM Oren Shani

Re: [R] dplyr summarize by groups

2024-11-23 Thread Eric Berger
This is because options(digits=3) specifies the number of significant digits, not the number of decimal places. See ?options and search for digits. > a <- 12.345 > options(digits=4) > print(a) [1] 12.35 > options(digits=5) > print(a) [1] 12.345 > options(digits=2) > print(a) [1] 12 > On Sat, Nov

Re: [R] Is there a sexy way ...?

2024-09-27 Thread Eric Berger
v <- as.numeric(matrix(unlist(x),ncol=5,byrow=TRUE)) v [1] 7 2 6 13 5 9 1 14 15 4 8 12 10 11 3 On Fri, Sep 27, 2024 at 8:33 AM Deepayan Sarkar wrote: > > > unsplit(x, f) > [1] 7 2 6 13 5 9 1 14 15 4 8 12 10 11 3 > > Is more general (works if the subgroups are imbalanced), and

Re: [R] "And" condition spanning over multiple columns in data frame

2024-09-12 Thread Eric Berger
Hi, To rephrase what you are trying to do, you want a copy of all the cp columns, in which all the NAs become 1s and any other value becomes a zero. There is an exception for the first row, where the NAs should become 0s. a <- c10Dt b <- matrix(as.numeric(is.na(a[,-1])), nrow=nrow(a)) b[1,] <- 0

Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Eric Berger
as.POSIXct(as.character(now),tz="UTC") or as.POSIXct(as.character(Sys.time()),tz="UTC") On Thu, Aug 22, 2024 at 12:00 PM Iago Giné Vázquez wrote: > Hi, > > How should POSIXct time zone be changed without modifying the specified > time (so fix the time zone). I tried > > > now <- Sys.time() >

Re: [R] An error message with the command fm<-1m (Version 4.4.1. p. 80, An introduction to R)

2024-08-06 Thread Eric Berger
The function is lm(), not 1m(). lm stands for "linear model" (the first letter of each word) On Tue, Aug 6, 2024 at 11:22 AM Rosana Curzel wrote: > Dear all, > > I am introducing in R and I had a problem in the beginning. Please, you can > see an error message below: (Maybe I am in error. If so

Re: [R] ts_regular....in tsbox

2024-07-27 Thread Eric Berger
Did you try converting the date column to class Date? Does that work? On Sun, Jul 28, 2024 at 7:40 AM akshay kulkarni wrote: > dear members, > I have a data frame which contains, among > others, a date object of monthly frequency which is not regular, i.e some > mont

Re: [R] help on date objects...

2024-07-27 Thread Eric Berger
as.Date("2022-01-02", origin="1900-01-01", format="%Y-%d-%m") On Sun, Jul 28, 2024 at 7:24 AM akshay kulkarni wrote: > Dear members, > WHy is the following code returning NA > instead of the date? > > > > as.Date("2022-01-02", origin = "1900-01-01", format = "%y%d%m

Re: [R] Naming output file

2024-06-24 Thread Eric Berger
assign(paste0("bop",im),boprobit(eqs,mydata,wt=weight,method="BHHH",tol=0,reltol=0,gradtol=1e-5,Fisher=TRUE)) On Mon, Jun 24, 2024 at 2:56 PM Steven Yen wrote: > Thanks Eric. I am not following your suggested line. Would you just edit > my line 4? Thanks. > On 6

Re: [R] Naming output file

2024-06-24 Thread Eric Berger
How about assign(paste0("bop",im), boprobit( etc )) On Mon, Jun 24, 2024 at 2:41 PM Steven Yen wrote: > I would like a loop to > > (1) read data files 2010midata1,2010midata2,2010midata3; and > > (2) name OUTPUT bop1,bop2,bop3. > > I succeeded in line 3 of the code below, > > BUT not line 4.

Re: [R] I have Problem using the Pipe Command

2024-06-19 Thread Eric Berger
; [1] 55 > > On Wed, Jun 19, 2024 at 7:52 AM Eric Berger wrote: > >> In your R session do >> >> library(magrittr) >> 1:10 %>% sum() >> >> This should output 55. >> If that does not work send the results, include the output of >> sessionIn

Re: [R] I have Problem using the Pipe Command

2024-06-18 Thread Eric Berger
C_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > loaded via a namespace (and not attached): > [1] compiler_3.4.4

Re: [R] I have Problem using the Pipe Command

2024-06-18 Thread Eric Berger
Please show the output of > sessionInfo() On Tue, Jun 18, 2024 at 7:49 PM Ogbos Okike wrote: > Thanks, Duncan for contributing. I quickly tried entering the command on a > new line. But the error pointed specifically to the point. It didn't run. > Best regards > Ogbos > > On Tue, Jun 18, 2024 a

Re: [R] Format

2024-06-10 Thread Eric Berger
Since you are loading lubridate it is enough to do Atest$ddate1 <- dmy(Atest$ddate) On Sun, Jun 9, 2024 at 11:59 PM Duncan Murdoch wrote: > > On 2024-06-09 4:39 p.m., Val wrote: > > HI all, > > > > My > > I am trying to convert character date (mm/dd/yy) to -mm-dd date > > format in one of

Re: [R] How to tweak genomic plot with genoPlotR?

2024-04-02 Thread Eric Berger
According to https://cran.r-project.org/web/packages/genoPlotR/index.html the maintainer of genoPlotR is Lionel Guy Send your question also to him. On Tue, Apr 2, 2024 at 11:27 AM Luigi Marongiu wrote: > > I would like to use your genoPlotR package > (doi:10.1093/bioinformatics/btq413) to comp

Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
! # The rest here is Calum's > > suggestion > > if (!file.exists(full_filename)) { > > message("File missing") > > } else { > > content <- read_docx(full_filename) > > docx_summary() > > # this reads docx for the full fil

Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
ull filename and > # passes it ( |> command) to the next line > # which summarises it. > # the result is saved in a data frame object > # called content which we shall show some > # heading into from > > head(content) > } > > > Running this, results i

Re: [R] Help request: Parsing docx files for key words and appending to a spreadsheet

2023-12-30 Thread Eric Berger
full_filename <- paste(filepath, filename,sep="/") On Sat, Dec 30, 2023 at 1:45 PM Andy wrote: > Thanks Ivan and Calum > > I continue to appreciate your support. > > Calum, I entered the code snippet you provided, and it returns 'file > missing'. Looking at this, while the object 'full_filename'

Re: [R] Code editor for writing R code

2023-11-29 Thread Eric Berger
Bert, Posit (formerly RStudio) has moved from RMarkdown to Quarto. They still support RMarkdown but major new features will be in Quarto. For new users a better choice would be Quarto. See https://quarto.org/docs/faq/rmarkdown.html Secondly, the OP stated he was using the VS-Code IDE, so there is

Re: [R] Code editor for writing R code

2023-11-29 Thread Eric Berger
Another direction would be to replace your R script (.R file) with a Quarto document (.qmd file). VS-code has good support for Quarto and you could intersperse your Latex with R chunks. On Wed, Nov 29, 2023 at 6:15 PM Ben Bolker wrote: > > > >Presumably there's nothing stopping you *writing*

Re: [R] annotate

2023-10-05 Thread Eric Berger
Another approach (still seems to require experimentation to get the value '2') would be to replace the annotate() with geom_text(data=above_92, aes(x=eruptions,y=waiting, label=waiting), nudge_y=2) At least this makes clear the reason for the magic number '2' in the code. For details see ?geom_t

Re: [R] [EXT] Theta from negative binomial regression and power_NegativeBinomiial from PASSED

2023-09-14 Thread Eric Berger
I asked your question to ChatGPT4 In statistics, what is the theta parameter of the negative binomial distribution? The response contained some math symbols but I am sending in plain text mode so there may be some loss, hopefully not serious. The negative binomial distribution is used to model t

Re: [R] prop.trend.test

2023-09-07 Thread Eric Berger
You might want to consider exponential smoothing models such as Holt's (Double Exponential Smoothing). This method continually updates the trend parameter, and you can monitor the most recent value (for sign, or magnitude, or both). In R, some choices to fit the Holt model: 1. stats::HoltWinters(

Re: [R] Merge and replace data

2023-09-05 Thread Eric Berger
As Duncan points out, ifelse() provides a more general approach than the specific pmax(). Even more generally, you might want to consider the apply() function (and its relatives sapply(), lapply(), ...) For example apply(cbind(x1,x2), MAR=1, max) In the above statement, x1 and x2 are combined i

Re: [R] Merge and replace data

2023-09-05 Thread Eric Berger
xx <- pmax(x1,x2) On Tue, Sep 5, 2023 at 11:56 AM roslinazairimah zakaria wrote: > > Hi all, > > I have these data > > x1 <- c(116,0,115,137,127,0,0) > x2 <- c(0,159,0,0,0,159,127) > > I want : xx <- c(116,115,137,127,159, 127) > > I would like to merge these data into one column. Whenever the da

Re: [R] Finding combination of states

2023-09-05 Thread Eric Berger
;b" "c" "a" "e" > [2,] "b" "d" "a" "e" > [3,] "b" "e" "a" "e" > [4,] "b" "a" "b" "e" > [5,] "b" "c

Re: [R] Finding combination of states

2023-09-04 Thread Eric Berger
quot; "BEBD" "BACD" "BBCD" "BCCD" "BDCD" "BECD" "BADD" >> [17] "BBDD" "BCDD" "BDDD" "BEDD" "BAED" "BBED" "BCED" "BDED" >> [25]

Re: [R] Finding combination of states

2023-09-04 Thread Eric Berger
The function purrr::cross() can help you with this. For example: f <- function(states, nsteps, first, last) { paste(first, unlist(lapply(purrr::cross(rep(list(v),nsteps-2)), \(x) paste(unlist(x), collapse=""))), last, sep="") } f(LETTERS[1:5], 3, "B", "E") [1] "BAE" "BBE" "BCE" "BDE" "BEE" HTH

Re: [R] lag.plot showing only lines....

2023-08-28 Thread Eric Berger
Hi Akshay, I have never used this function before but according to ?lag.plot you simply need to pass the argument do.lines=FALSE. HTH, Eric On Mon, Aug 28, 2023 at 5:45 PM akshay kulkarni wrote: > > Dear members, > I am using the following code: > > lag.plot(ygrpch(OHLC

Re: [R] Help needed with olsrr package

2023-08-22 Thread Eric Berger
I copied your data and ran your code. It worked fine for me. > sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.2 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux

Re: [R] time series transformation....

2023-08-14 Thread Eric Berger
ote: > > Dear Eric, > THanks for the reply...will this also work with arfima() ? > What if I want to fit a model like GARCH and friends? > > THanking you, > Yours sincerely, > AKSHAY M KULKARNI > ____ > From: Eric Berger > Sent: Sunday, Augu

Re: [R] time series transformation....

2023-08-12 Thread Eric Berger
Hi Akshay, The forecast package will do the BoxCox transform and automatically backtransform the forecasts. The package also handles xts objects. For example, modifying the example from the help page of forecast::forecast for Arima > dt <- as.Date("2023-01-01") + 1:length(WWWusage) > a <- xts(WWWu

Re: [R] Merge with closest (not equal) time stamps

2023-08-08 Thread Eric Berger
Hi Naresh, Perhaps the below is faster than your approach library(dplyr) library(tidyr) merge(option.trades, stock.trades, by="timestamp", all=TRUE) |> dplyr::arrange(timestamp) |> dplyr::mutate(stock.timestamp = as.POSIXct(ifelse(is.na(option.price), timestamp, NA))) |> tidyr::fill(stock.pr

Re: [R] Stacking matrix columns

2023-08-06 Thread Eric Berger
er answer. > > -Original Message- > From: R-help On Behalf Of Eric Berger > Sent: Sunday, August 6, 2023 3:34 AM > To: Bert Gunter > Cc: R-help Mailing List ; Steven Yen > Subject: Re: [R] Stacking matrix columns > > Stacking columns of a matrix is a standard operatio

Re: [R] Stacking matrix columns

2023-08-06 Thread Eric Berger
Stacking columns of a matrix is a standard operation in multilinear algebra, usually written as the operator vec(). I checked to see if there is an R package that deals with multilinear algebra. I found rTensor, which has a function vec(). So, yet another way to accomplish what you want would be:

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

2023-08-04 Thread Eric Berger
Hi Murat, I am not sure why you are using R 3.5. CRAN has R 4.3.1 https://cran.r-project.org/bin/windows/base/ I suggest you start over and install R 4.3.1 and then your cytofkit install might work. Good luck, Eric On Fri, Aug 4, 2023 at 5:47 PM Murat DELMAN wrote: > > Dear Ms./Mr., > > > I s

Re: [R] OK, next Q - a sort of factorial on a vector

2023-06-20 Thread Eric Berger
Hi Philip, In the decades since you learned R there have been some additions to the language. In particular, R now supports lambda functions. Applying this feature to Ivan's beautiful solution cuts down 7 characters (continuing his golfing analogy) unlist(lapply(seq_along(x), \(i) x[i] * x[-(1:i)]

Re: [R] Feature selection for multiclass classification

2023-06-16 Thread Eric Berger
you might want to search bioconductor https://www.bioconductor.org/ https://bioconductor.org/books/3.13/OSCA.basic/feature-selection.html On Fri, Jun 16, 2023 at 9:04 AM Andrew Zhang wrote: > Hello everyone, can someone share a list of packages that can do feature > selection for multiclass (m

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

2023-06-13 Thread Eric Berger
Hi Javed, grep returns the positions of the matches. See an example below. > v <- c("abc", "bcd", "def") > v [1] "abc" "bcd" "def" > grep("cd",v) [1] 2 > w <- v[-grep("cd",v)] > w [1] "abc" "def" > On Tue, Jun 13, 2023 at 8:50 AM javad bayat wrote: > > Dear Rui; > Hi. I used your codes, but it

Re: [R] inconsistency in mclapply.....

2023-06-09 Thread Eric Berger
Hi Akshay, You do not have to quit R to run 'top'. You can have, for example, 2 windows, with R running in one and top running in the oher. Eric On Sat, Jun 10, 2023 at 12:19 AM akshay kulkarni wrote: > Dear Ivan, > Thanks for the reply. I am pressurised by a fast > approachin

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Eric Berger
27;) On Wed, May 31, 2023 at 4:27 PM Spencer Graves wrote: > > > > On 5/30/23 10:23 AM, Eric Berger wrote: > > What if you just precede these commands as follows: > > > > par(mfrow=c(3,1)) > > plot(DAX.[, 1], log='y', ylab='DAX') > >

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-31 Thread Eric Berger
Slight modification to have the xaxt ticks and labels only appear on the bottom chart par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX', xaxt="n") plot(DAX.[, 2], ylab='vel (%)', xaxt="n") plot(DAX.[, 3], ylab='accel (%)') On Tue,

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
What if you just precede these commands as follows: par(mfrow=c(3,1)) plot(DAX.[, 1], log='y', ylab='DAX') plot(DAX.[, 2], ylab='vel (%)') plot(DAX.[, 3], ylab='accel (%)') On Tue, May 30, 2023 at 5:45 PM Spencer Graves wrote: > > > > O

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
to plot, and what would be the Y labels that you want to appear at those levels (assuming that there was a Y label for each of them - just to understand the units you are talking about) On Tue, May 30, 2023 at 4:06 PM Spencer Graves wrote: > > > > On 5/30/23 6:16 AM, Eric Berger wrote:

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
My code assumes that DAX is a ts object, as in your original post. On Tue, May 30, 2023 at 2:06 PM Eric Berger wrote: > > Untested but why not > > a <- cbind(log(DAX), exp(diff(log(DAX))), exp(diff(diff(log(DAX) > colnames(a) <- c("logDAX", "vel"

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-30 Thread Eric Berger
Untested but why not a <- cbind(log(DAX), exp(diff(log(DAX))), exp(diff(diff(log(DAX) colnames(a) <- c("logDAX", "vel", "accel") plot(a) On Tue, May 30, 2023 at 1:46 PM Spencer Graves wrote: > > > > On 5/29/23 2:37 AM, Eric Berger wrote: >

Re: [R] plot level, velocity, acceleration with one x axis

2023-05-29 Thread Eric Berger
How about this: a <- cbind(AirPassengers, diff(log(AirPassengers)), diff(diff(log(AirPassengers colnames(a)[2:3] <- c("percent increase", "acceleration") plot(a, xlab="year", main="AirPassengers") HTH, Eric On Mon, May 29, 2023 at 7:57 AM Spencer Graves wrote: > > Hello, All: > > >

Re: [R] Recombining Mon and Year values

2023-05-17 Thread Eric Berger
An alternative that does not use the zoo package but uses the built-in constant month.abb df1 <- data.frame(Year = c(2021, 2021, 2021), Mon = c("Mar", "Jan", "Apr")) df1$mon_year <- df1$Year*100 + sapply(df1$Mon, \(x) match(x,month.abb)) sort(df1$mon_year) On Wed, May 17, 202

Re: [R] RandomForest tuning the parameters

2023-05-09 Thread Eric Berger
X_test) HTH, Eric On Tue, May 9, 2023 at 6:40 AM Eric Berger wrote: > Hi, > One problem you have is with the command: > regr<-randomForest(y~x1+x2, data=X_train, proximity=TRUE) > > What you need is something like this: > > X2 <- cbind(X,y) > regr<-randomFo

Re: [R] RandomForest tuning the parameters

2023-05-08 Thread Eric Berger
Hi, One problem you have is with the command: regr<-randomForest(y~x1+x2, data=X_train, proximity=TRUE) What you need is something like this: X2 <- cbind(X,y) regr<-randomForest(y~x1+x2, data=X2, proximity=TRUE) HTH, Eric On Mon, May 8, 2023 at 11:11 PM varin sacha via R-help wrote: > > Dear

Re: [R] Huge differences in Ram Consumption with different versions of R on the same scripts

2023-05-08 Thread Eric Berger
Assuming the vignettes are the same in both cases, try going back to the system where it worked and introduce a single change? i.e. a) previous linux system and R 4.2 b) Previous R version and Oracle Linux 8 Repeat the test for a) and b) and if one works fine and the other fails at least that will

Re: [R] problem installing RGBL library

2023-04-22 Thread Eric Berger
, table, > tapply, union, unique, unsplit, which.max, > which.min > > > Attaching package: ‘graph’ > > The following objects are masked from ‘package:igraph’: > > degree, edges, intersection > > > Attaching package: ‘RBGL’ > > The following objects are ma

Re: [R] problem installing RGBL library

2023-04-22 Thread Eric Berger
What happens with the command > library(RBGL) On Sat, Apr 22, 2023 at 7:08 PM varin sacha via R-help wrote: > Dear R-experts, > > How to solve that problem? > > My R version is 4.2.1 > > Here below trying to install RGBL library found here : > https://bioconductor.org/packages/release/bioc/htm

Re: [R] Package Caret

2023-04-14 Thread Eric Berger
Malomsoki wrote: > Or is there any similar function to split the dataframe to trainDF and > testDF? > > Gábor Malomsoki schrieb am Fr., 14. Apr. 2023, > 09:45: > >> >> This is the error then: >> error in prettyseq(1:ncol(out)) : could not find function "prett

Re: [R] Package Caret

2023-04-14 Thread Eric Berger
king. > I saw a similar question in Stackoverflow, advising install package Rcpp, > but this one i am unable to install. > > Eric Berger schrieb am Fr., 14. Apr. 2023, 08:47: > >> You first have to load the package using the library command. >> > library(caret) >

Re: [R] Package Caret

2023-04-13 Thread Eric Berger
You first have to load the package using the library command. > library(caret) Then you can call createDataPartition. e.g. > data(oil) > createDataPartition(oilType,2) HTH, Eric On Fri, Apr 14, 2023 at 7:52 AM Gábor Malomsoki wrote: > Dear all, > When i try to use createDataPartition after ca

Re: [R] Split String in regex while Keeping Delimiter

2023-04-12 Thread Eric Berger
This seems to do the job but there are probably more elegant solutions: f <- function(s) { sub("^ ","",unlist(strsplit(gsub("\\+ ","+@ ",s),"@"))) } g <- function(s) { sub("^ ","",unlist(strsplit(gsub("- ","-@ ",s),"@"))) } h <- function(s) { g(f(s)) } To try it out: s <- “leucocyten + gramnegati

Re: [R] converting to date object...

2023-04-12 Thread Eric Berger
lubridate::dmy("12 APR 2023") On Wed, Apr 12, 2023 at 5:34 PM akshay kulkarni wrote: > dear members, > I want to convert "12 APR 2023" into a Date > object. I tried as_Date() from lubridate, but it is not working: > > > as_date("12 APR 2023") > [1] NA > Warning messa

Re: [R] Matrix scalar operation that saves memory?

2023-04-11 Thread Eric Berger
One possibility might be to use Rcpp. An R matrix is stored in contiguous memory, which can be considered as a vector. Define a C++ function which operates on a vector in place, as in the following: library(Rcpp) cppFunction( 'void subtractConst(NumericVector x, double c) { for ( int i = 0; i

Re: [R] Simple Stacking of Two Columns

2023-04-03 Thread Eric Berger
pivot_longer() Sent from my iPhone > On 3 Apr 2023, at 18:09, Sparks, John wrote: > > Hi R-Helpers, > > Sorry to bother you, but I have a simple task that I can't figure out how to > do. > > For example, I have some names in two columns > > NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2

Re: [R] Detpack package

2023-02-01 Thread Eric Berger
Detpack or detpack? What happens when you try detpack::chi2testuniform(...) ? On Wed, Feb 1, 2023 at 6:08 PM Nick Wray wrote: > Hello I've successfully installed the package "Detpack" and remembered to > call it via library() But when I try to use the functions i get this: > > > chi2testuni

Re: [R] Problem to run python code in r markdown

2023-01-20 Thread Eric Berger
You don't specify what platform you are on (linux / Windows / other), and what tools you are using. I am running a linux system and I have virtual environments set up. I set the environment variable RETICULATE_PYTHON to point to python (in my virtual environment). I am using RStudio, and I use the

Re: [R] Fwd: Reg: Frequency in declaring time series data

2023-01-17 Thread Eric Berger
Hi Upananda, A few comments: 1. As you know, CRAN has thousands of packages. One of the ways to learn about the packages you might care about is to use the CRAN views. A 'view' is an attempt to provide some information on a certain subset of the packages related to a particular area. See a list of

Re: [R] Printing special characters

2023-01-16 Thread Eric Berger
How about just 'EVENT > 30 sec' or 'EVENT > 29 sec' ? On Mon, Jan 16, 2023 at 10:19 AM Dennis Fisher wrote: > R 4.2.2 > OS X > > Colleagues > > A file that I have read includes strings like this: > "EVENT ≥ 30 sec" > When I include the string in a graphic using: > mtext(STRING,

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

2023-01-13 Thread Eric Berger
mydata[, -grep("^yr",colnames(mydata))] On Sat, Jan 14, 2023 at 8:57 AM Steven T. Yen wrote: > I have a data frame containing variables "yr3",...,"yr28". > > How do I remove them with a wild cardsomething similar to "del yr*" > in Windows/doc? Thank you. > > > colnames(mydata) >[1] "yea

Re: [R] Topological network Map

2023-01-11 Thread Eric Berger
Google using "R package subway map" produced https://www.r-bloggers.com/2021/01/non-hierarchical-edge-bundling-flow-maps-and-metro-maps-in-r/ which looks promising On Wed, Jan 11, 2023 at 2:48 PM Nick Wray wrote: > > Hello I'd like to create a simple topological map of a river system, ie all > t

Re: [R] Reg: ggplot error

2023-01-11 Thread Eric Berger
No code or data came through. Please read the posting guidelines. On Wed, Jan 11, 2023 at 1:38 PM Upananda Pani wrote: > > Dear All, > > I am using roptest function of package "ROptEst" (Kohl and Ruckdeschel > (2019)) to find out the ML, CvM-MD, and the RMX estimator and their > asymptotic conf

Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Eric Berger
Your problem is that the color "#4DAF4A8" is not a valid color. It should have only 6 hex digits. e.g. "#4DAF4A" will work. Also you seem to be confused about ggplot. You are not using ggplot in your code at all. You are using base graphics. You can remove the 3 library calls. HTH, Eric On Mon,

Re: [R] Amazing AI

2022-12-19 Thread Eric Berger
Hi Boris, I think these are good questions. Some initial reactions: 1. with better tools available to the students, you can cover more material at a faster pace 🙂 2. For years, it has been possible for students to find "answers" online (e.g. Google search). Most programmers would regard this as an

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

2022-12-16 Thread Eric Berger
maybe this will make it clear x <- c(a=1, b=5) is.na(x) <- "b" i.e. your second case is dealing with a named vector HTH, Eric On Fri, Dec 16, 2022 at 8:29 PM Göran Broström wrote: > I'm confused: > > > x <- 1:2 > > is.na(x) <- 1 > > x > [1] NA 2 > > OK, but > > > x <- c("A", "B") > > is.na(

Re: [R] What is new in R especially about Tidyverse.

2022-11-27 Thread Eric Berger
Hi Abdullah, The Tidyverse is a set of R packages that are designed to work well together for handling a variety of common tasks in data science. Many of these packages are written by Hadley Wickham, chief scientist at RStudio.com. https://en.wikipedia.org/wiki/Hadley_Wickham RStudio.com is a com

Re: [R] IGCI implemented in R package ?

2022-11-21 Thread Eric Berger
Hi Sacha, My search turned up the Causal Discovery Toolbox which includes IGCI among 10 (or more) methods. This site includes both Python and R resources and seems to be quite rich - hopefully you will find something useful. Here's the link: https://fentechsolutions.github.io/CausalDiscoveryToolbox

Re: [R] [External] Re: Selecting a minimum value of an attribute associated with point values neighboring a given point and assigning it as a new attribute

2022-11-08 Thread Eric Berger
onc_min <- lapply(pts$X, function(i){ >MinConc(i, dist_matrix[i], pts) > #}) > Conc_min <- data.frame("Conc_min" = as.integer(Conc_min)) > > # Add back as new attrib to original points sf object > pts_with_min <- do.call(cbind, c(pts, Conc_min)) > > > >

Re: [R] [External] Re: Selecting a minimum value of an attribute associated with point values neighboring a given point and assigning it as a new attribute

2022-11-07 Thread Eric Berger
on all points to get a list of minimum Conv > values for all points, and merge back to pts. > > > # Now apply this function to all points in pts > Conc_min <- lapply(pts$X, function(i){ >MinConc(i, dist_matrix[i], pts) > }) > Conc_min <- data.frame("Conc_min&

Re: [R] Selecting a minimum value of an attribute associated with point values neighboring a given point and assigning it as a new attribute

2022-11-06 Thread Eric Berger
e(j=Var1,k=Var2) |> filter(j < k) u <- sapply(1:nrow(idx), \(i){ j <- idx$j[i]; k <- idx$k[i]; A[j,k] <<- f(j,k,myData) }) B <- A + t(A) + diag(N) C <- diag(myData$Conc) D <- B %*% C D[D==0] <- NA myData$Conc_min <- apply(D,MAR=1,\(v){min(v,na.rm=TRUE)}) print

Re: [R] Selecting a minimum value of an attribute associated with point values neighboring a given point and assigning it as a new attribute

2022-11-06 Thread Eric Berger
Hi Tiffany, Here is some code that might help with your problem. I solve a "toy" problem that is conceptually the same. Part 1 sets up my toy problem. You would have to replace Part 1 with your real case. The main point is to define a function f(i, j, data) which returns 0 or 1 depending on whether

Re: [R] Single pdf of all R vignettes request

2022-10-31 Thread Eric Berger
You can see all the installed vignettes on your system with `browseVignettes()`. (This opens a browser page.) Alternatively `browseVignettes("pkgname")` for those related to a single package. HTH, Eric On Mon, Oct 31, 2022 at 11:37 AM Richard O'Keefe wrote: > Let's put some numbers on that. >

Re: [R] Color Nodes

2022-10-27 Thread Eric Berger
You may want to change the color of the vertex labels. e.g. plot(g, vertex.size = 20, vertex.label.dist = 0.5, vertex.color = V(g)$color, vertex.label.color="cyan") On Thu, Oct 27, 2022 at 1:52 AM Jeff Reichman wrote: > > Yes Rui that will work for my needs thank you > > -Original Mes

Re: [R] Best place to ask questions about non-R Base topics, ex. dplyr, dbplyr, etc. ?

2022-10-26 Thread Eric Berger
Also, since your examples were dplyr and dbplyr which are associated with RStudio.com (aka Posit) you might also try https://community.rstudio.com You can apply filters on that site to narrow the results On Wed, Oct 26, 2022 at 10:12 PM Jeff Newmiller wrote: > > The general recommendation is

Re: [R] Unintended behaviour of stats::time not returning integers for the first cycle

2022-10-15 Thread Eric Berger
Alternatively correct.year <- floor(time(x)+1e-6) On Sat, Oct 15, 2022 at 10:26 AM Andreï V. Kostyrka < andrei.kosty...@gmail.com> wrote: > Dear all, > > > > I was using stats::time to obtain the year as a floor of it, and > encountered a problem: due to a rounding error (most likely due to its

Re: [R] Fatal Error: Contains Space

2022-09-28 Thread Eric Berger
so > much for the help!! > > Best, > Kaitlyn Light > > On Thu, Sep 22, 2022 at 3:42 AM Eric Berger wrote: >> >> Does this help? >> https://stackoverflow.com/questions/72138987/r-studio-fatal-error-r-tempdircontains-space >> >> On Thu, Sep 22, 2022

Re: [R] apply to row and column of matrix

2022-09-26 Thread Eric Berger
Bert provided an excellent answer to your question. FYI here is a different approach to do the calculation. It uses data.frame rather than matrix. A data frame is a list of its columns. Here the function supplied to sapply operates on each column of the data.frame. > m <- as.data.frame(t(matrix(1:

Re: [R] Solve equality function with GA

2022-09-25 Thread Eric Berger
?ga states that ga() searches for the maximum of the fitness function. The maximum of your fitness function is at x=0. On Sun, Sep 25, 2022 at 4:52 AM Bert Gunter wrote: > We aren't supposed to do homework on this list. > > Bert Gunter > > On Sat, Sep 24, 2022 at 5:29 PM Barry King via R-help

Re: [R] Fatal Error: Contains Space

2022-09-22 Thread Eric Berger
Does this help? https://stackoverflow.com/questions/72138987/r-studio-fatal-error-r-tempdircontains-space On Thu, Sep 22, 2022 at 10:37 AM Kaitlyn Light wrote: > Hello! > I recently downloaded R and RStudio to my windows laptop. I downloaded the > correct version and made sure it was for windows

Re: [R] Error in if (class(networks) == "matrix") from a function

2022-09-21 Thread Eric Berger
In R 4.2.0 there is a significant change. When you use an if() statement with a condition of length > 1 this now reports an error. e.g. this link mentions it as a change https://www.jumpingrivers.com/blog/new-features-r420/ In your case this is because class(obj) can return a character vector of l

Re: [R] How to set default encoding for sourced files

2022-09-21 Thread Eric Berger
Hi Andrew, If you look at ?source you see its default value for encoding is picked up from getOption("encoding"). Couldn't you just set this option in your Rprofile? HTH, Eric On Wed, Sep 21, 2022 at 5:34 PM Andrew Hart via R-help wrote: > > Hi there. I'm working with some utf-8 incoded csv fil

Re: [R] aplpack / bagplot

2022-09-21 Thread Eric Berger
[re-sending as plain text] Hi Sigbert, I have never used the aplpack package but out of curiosity I tried it out. Doing a scatter plot of your (x,y) data shows that there are many repeated x values, and this seems to be the source of the error. There are no repeated y values. It seems that the bag

Re: [R] aplpack / bagplot

2022-09-21 Thread Eric Berger
Hi Sigbert, I have never used the aplpack package but out of curiosity I tried it out. Doing a scatter plot of your (x,y) data shows that there are many repeated x values, and this seems to be the source of the error. There are no repeated y values. It seems that the bagplot() function does not han

Re: [R] Question concerning side effects of treating invalid factor levels

2022-09-19 Thread Eric Berger
You are misinterpreting what is going on. The rbind command includes c(char, char, int) which produces a character vector of length 3. This is what you are rbind-ing which changes the type of the RT column. If you do rbind(df, data.frame(P="in", ANSWER="V>N", RT=round(runif(1,7000,16000),0))) you

Re: [R] Converting time format

2022-09-19 Thread Eric Berger
What is the output of > class(b$time) ? Also, start sending your emails in plaint text format, if possible. On Mon, Sep 19, 2022 at 2:12 PM Parkhurst, David wrote: > > I have a dataframe obtained using read.csv from an excel file. Its first > column is times, running from 18:00 to 19:30. If

Re: [R] removing non-table lines

2022-09-19 Thread Eric Berger
Hi Nick, Here's one way to do it. It is based on the heuristic that you keep each line with the correct number of fields. The correct number of fields is automatically determined by the number of fields in the last line of the file. Here's the contents of a sample csv file - "tmp3.csv" where the

Re: [R] opening nimroad tar gz files in R

2022-09-15 Thread Eric Berger
Is there a way to download a file from that site without registering for the site? If you have a unix/linux shell, what does the 'file' command output? $ file foo.gz On Thu, Sep 15, 2022 at 2:11 PM Nick Wray wrote: > Hello > > I am trying to download data sets from the 1 km Resolution UK Comp

Re: [R] Problem with installing packages in R

2022-09-15 Thread Eric Berger
Can you bring up R in a shell? Do you get the same message? (Also, set your email to send plain text. HTML versions are deleted.) On Thu, Sep 15, 2022 at 11:27 AM Farah Al Saifi wrote: > > Dear Sir/Madam > > After the update of the new version of R 4.2.1, an error message ( Error in > nchar(ho

Re: [R] von Neumann/Bartels/Serial Correlation

2022-08-14 Thread Eric Berger
Hi Nick, I have no experience with this package but I just installed it with no problem and found the help and ran the functions. > library(DescTools) > ?VonNeumannTest <-- works fine > VonNeumannTest(d.pizza$temperature) <-- suggested in the help page; works > fine > ?BartelsRankTest <-- wor

Re: [R] Fitted values from AR model

2022-08-12 Thread Eric Berger
The model that you are fitting to the data is an AR(2) model, which means y(t) = a0 + a1 * y(t-1) + a2 * y(t-2) + eps(t) (1) The fitting procedure estimates the coefficients a0, a1, a2 (and the variance of eps). After the coefficients have been estimated, the fitted values can be

Re: [R] extracting numeric values returned when using the by function to run the acf function

2022-05-10 Thread Eric Berger
as.numeric(by(RecallSmall[1:4,"value"],RecallSmall[1:4,"ID"],acf,na.action=na.pass,plot=FALSE)[[1]]$acf) On Tue, May 10, 2022 at 8:29 PM Sorkin, John wrote: > I am using the by function to run the acf function. Each run of the by > function returns more information than I want. All I want is th

Re: [R] struccchange on zoo time series

2022-05-01 Thread Eric Berger
Hi Achim, My point was that tsbox (apparently) provides tools to convert zoo --> ts which should help the OP. On Sun, May 1, 2022 at 5:56 PM Achim Zeileis wrote: > > On Sun, 1 May 2022, Eric Berger wrote: > > > Hi Naresh, > > The tsbox package on CRAN - > >

Re: [R] Confusing fori or ifelse result in matrix manipulation

2022-04-25 Thread Eric Berger
M[,x==1] is not the same as M[,x] :-) However, M[,!!x] is the same as M[,x==1] and saves one character! The point of this is "I can name that tune in ... " (as if that was not obvious) On Mon, Apr 25, 2022 at 5:30 PM Bert Gunter wrote: > x == 1 is the same as M[, x] so your expression is the s

  1   2   3   4   5   6   >