[R] save(), load(), saveRDS(), and readRDS()

2023-09-28 Thread Shu Fai Cheung
Hi All, There is a thread about the use of save(), load(), saveRDS(), and loadRDS(). It led me to think about a question regarding them. In my personal work, I prefer using saveRDS() and loadRDS() as I don't like the risk of overwriting anything in the global environment. I also like the freedom

Re: [R] prop.trend.test question

2023-09-28 Thread peter dalgaard
In a word: Yes. We discussed this about 2w ago. Basically, the lm() fits a local Linear Probability Model and the coef to "score" gives you the direction of the effect. In the same thread it was discussed (well, readable between the lines, maybe) that if you change the lm() to a Gaussian glm()

Re: [R] replace character by numeric value

2023-09-28 Thread arnaud gaboury
On Thu, Sep 28, 2023 at 8:18 AM Ivan Calandra wrote: > > Dear Arnaud, > > I don't quite unterstand why you have imbricated ifelse() statements. Do > you have more that BUY (1) and SELL (-1)? If not, why not simply: > mynewdf2 <- mydf2 |> dplyr::mutate(side = ifelse(side == 'BUY', 1, -1)) Yes it

Re: [R] replace character by numeric value

2023-09-28 Thread Enrico Schumann
On Wed, 27 Sep 2023, arnaud gaboury writes: > I have two data.frames: > > mydf1 <- structure(list(symbol = "ETHUSDT", cummulative_quote_qty = > 1999.9122, side = "BUY", time = structure(1695656875.805, tzone = "", class > = c("POSIXct", "POSIXt"))), row.names = c(NA, -1L), class = c("data.table",

Re: [R] replace character by numeric value

2023-09-28 Thread Ivan Calandra
Dear Arnaud, I don't quite unterstand why you have imbricated ifelse() statements. Do you have more that BUY (1) and SELL (-1)? If not, why not simply: mynewdf2 <- mydf2 |> dplyr::mutate(side = ifelse(side == 'BUY', 1, -1)) That would solve the problem. I'm not quite sure exactly what

[R] replace character by numeric value

2023-09-28 Thread arnaud gaboury
I have two data.frames: mydf1 <- structure(list(symbol = "ETHUSDT", cummulative_quote_qty = 1999.9122, side = "BUY", time = structure(1695656875.805, tzone = "", class = c("POSIXct", "POSIXt"))), row.names = c(NA, -1L), class = c("data.table", "data.frame")) mydf2 <- structure(list(symbol =