Re: [R] as.factor and floating point numbers

2023-01-25 Thread Valentin Petzel
Hello Tobias, A factor is basically a way to get a character to behave like an integer. It consists of an integer with values from 1 to nlev, and a character vector levels, specifying for each value a level name. But this means that factors only really make sense with characters, and anything

Re: [R] R emulation of FindRoot in Mathematica

2023-01-19 Thread Valentin Petzel
Hello Troels, As fair as I understand you attempt to numerically solve a system of non linear equations in multiple variables in R. R does not provide this functionality natively, but have you tried multiroot from the rootSolve package: https://cran.r-project.org/web/packages/rootSolve/rootSo

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

2023-01-15 Thread Valentin Petzel
Hello Avi, while something like d$something <- ... may seem like you're directly modifying the data it does not actually do so. Most R objects try to be immutable, that is, the object may not change after creation. This guarantees that if you have a binding for same object the object won't chan

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

2023-01-13 Thread Valentin Petzel
last, or any value, is redundant? We are living in the 21st century world, > and the R-core team might,I suppose, have a definite reason for"returning" > the last value. Any comments? > > Thanking you, > Yours sincerely, > AKSHAY M KULKARNI > > --

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

2023-01-10 Thread Valentin Petzel
> 10) sum(y) else mean(y)}) Regards, Valentin Petzel 09.01.2023 15:47:53 akshay kulkarni : > Dear members, > I have the following code: > >> TB <- {x <- 3;y <- 5} >> TB > [1] 5 > > It is consistent with the documentation: For {

Re: [R] datatable using dt not able to print background colors

2022-12-18 Thread Valentin Petzel
Hello Matt, I do not think that this is the best place for troubleshooting Chrome issues. If your html file shows the colors but print doesn't then the page probably uses different stylesheets for display and print. You might want to inspect the html for something like this. If you need help, t

[R] Enabling s3 methods by attaching environment

2022-12-13 Thread Valentin Petzel
Hello everyone! if we define some S3 method in some environment like this E <- new.env() evalq({ test <- function(x) UseMethod("test") test.character <- function(x) 1 }, envir = E) this works evalq(test("a"), envir = E) but this doesn’t: attach(E) test("a") According to some remarks