Re: [R] geom_smooth

2023-08-11 Thread Rui Barradas
Às 05:17 de 12/08/2023, Thomas Subia via R-help escreveu: Colleagues, Here is my reproducible code for a graph using geom_smooth set.seed(55) scatter_data <- tibble(x_var = runif(100, min = 0, max = 25)    ,y_var = log2(x_var) + rnorm(100)) library(ggplot2)

[R] geom_smooth

2023-08-11 Thread Thomas Subia via R-help
Colleagues, Here is my reproducible code for a graph using geom_smooth set.seed(55) scatter_data <- tibble(x_var = runif(100, min = 0, max = 25)    ,y_var = log2(x_var) + rnorm(100)) library(ggplot2) library(cowplot) ggplot(scatter_data,aes(x=x_var,y=y_var))+   geom_point()+

Re: [R-es] Expresión en un objeto

2023-08-11 Thread Manuel Mendoza
No tuve tiempo de mirarlo, pero, ¿es coherente lo que dice? El vie, 11 ago 2023 a las 21:02, Griera-yandex () escribió: > Muchas gracias, Manuel: > > Que bueno! No se me había ocurrido lo de GPT! > > Lo pruebo. > > Saludos. > > On Fri, 11 Aug 2023 18:15:18 +0200 > Manuel Mendoza wrote: > > >

Re: [R] Different TFIDF settings in test set prevent testing model

2023-08-11 Thread James C Schopf
Thank you Bert and Ivan, I was building the SVM model in hopes of applying it to future cases and hoped that the model would be able to deal with new words it hadn't encountered during training. But I tried Bert's suggestion by converting all of the data to tokens, creating a DTM,

Re: [R-es] Expresión en un objeto

2023-08-11 Thread Griera-yandex
Muchas gracias, Manuel: Que bueno! No se me había ocurrido lo de GPT! Lo pruebo. Saludos. On Fri, 11 Aug 2023 18:15:18 +0200 Manuel Mendoza wrote: > Esta es la respuesta que te da ChatGPT-4: > > Entiendo tu pregunta y, aunque no hay una función nativa en R que te > permita hacer exactamente

Re: [R-es] Expresión en un objeto

2023-08-11 Thread Manuel Mendoza
Esta es la respuesta que te da ChatGPT-4: Entiendo tu pregunta y, aunque no hay una función nativa en R que te permita hacer exactamente lo que estás pidiendo, puedes lograr el mismo resultado utilizando una función. Una función te permitiría encapsular la lógica de la expresión que quieres

Re: [R] Different TFIDF settings in test set prevent testing model

2023-08-11 Thread Ivan Krylov
В Fri, 11 Aug 2023 10:20:27 + James C Schopf пишет: > > train_text_dtm <- > > DocumentTermMatrix(Corpus(VectorSource(all_train_tokens))) > > test_text_dtm <- > > DocumentTermMatrix(Corpus(VectorSource(all_test_tokens))) I understand the need to prepare the test dataset separately (e.g.

Re: [R] Different TFIDF settings in test set prevent testing model

2023-08-11 Thread Bert Gunter
I know nothing about tf, etc., but can you not simply read in the whole file into R and then randomly split using R? The training and test sets would simply be defined by a single random sample of subscripts which is either chosen or not. e.g. (simplified example -- you would be subsetting the

[R] Different TFIDF settings in test set prevent testing model

2023-08-11 Thread James C Schopf
Hello, I'd be very grateful for your help. I randomly separated a .csv file with 1287 documents 75%/25% into 2 csv files, one for training an algorithm and the other for testing the algorithm. I applied similar preprocessing, including TFIDF transformation, to both sets, but R won't let me

Re: [R] group consecutive dates in a row

2023-08-11 Thread Stefano Sofia
Thank you for your hints. All of them have been useful, and you solved my problem. I understood the role of rle, but I think that for my task its use is not fundamental. I will put more attention on looking for the existing documentation. Thank you again Stefano (oo) --oOO--(

Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Ebert,Timothy Aaron
I have entered values into Excel, and sorted them. I am assuming you are asking why the value 3 in x2 is ranked 4.5 versus in x5 it has a rank of 5. X2 looks like this Value RankOrder 1 1.5 1 1 1.5 2 2 3 3 3 4.5 4 3 4.5 5 4 6 6

Re: [R-es] Expresión en un objeto

2023-08-11 Thread Griera-yandex
Gracias, Isidro, por la ayuda: On Fri, 11 Aug 2023 09:16:34 + Isidro Hidalgo Arellano wrote: > A ver... con que xfunc() esté preparada para tomar un parámetro de tipo > "carácter" y evaluarlo, claro que se puede hacer... > Si el problema lo tienes en evaluar la expresión, la función

Re: [R-es] Expresión en un objeto

2023-08-11 Thread Isidro Hidalgo Arellano via R-help-es
A ver... con que xfunc() esté preparada para tomar un parámetro de tipo "carácter" y evaluarlo, claro que se puede hacer... Si el problema lo tienes en evaluar la expresión, la función "eval()" te lo hace. Si no te he entendido bien, explícate más  Saludos Isidro -Mensaje original-

Re: [R] Puzzled by results from base::rank()

2023-08-11 Thread Gerrit Eichner
Dear Chris, the members of the triplet would be ranked 4, 5 and 6 (in your example), so the *mean of their ranks* is correctly 5. For any set of k tied values the ranks of its elements are averaged (and assigned to each of its k members). Hth -- Gerrit

Re: [R] Use generic functions, e.g. print, without UseMethod?

2023-08-11 Thread Rui Barradas
Às 08:20 de 11/08/2023, Sigbert Klinke escreveu: Hello, I have defined a function 'equations(...)' which returns an object with class 'equations'. I also defined a function 'print.equations' which prints the object. But I did not use 'equations <- function(x, ...) UseMethod("equations"). Two

[R] Puzzled by results from base::rank()

2023-08-11 Thread Chris Evans via R-help
I understand that the default ties.method is "average".  Here is what I get, expanding a bit on the help page example. Running R 4.3.1 on Ubuntu 22.04.2. > x2 <- c(3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5) > rank(x2)  [1]  4.5  1.5  6.0  1.5  8.0 11.0  3.0 10.0  8.0  4.5  8.0 OK so the ties, each of

Re: [R] Use generic functions, e.g. print, without UseMethod?

2023-08-11 Thread Ivan Krylov
On Fri, 11 Aug 2023 09:20:03 +0200 Sigbert Klinke wrote: > I have defined a function 'equations(...)' which returns an object > with class 'equations'. > But I did not use 'equations <- function(x, ...) > UseMethod("equations"). Two questions: > > 1.) Is this a sensible approach? Quite. If

[R] Use generic functions, e.g. print, without UseMethod?

2023-08-11 Thread Sigbert Klinke
Hello, I have defined a function 'equations(...)' which returns an object with class 'equations'. I also defined a function 'print.equations' which prints the object. But I did not use 'equations <- function(x, ...) UseMethod("equations"). Two questions: 1.) Is this a sensible approach? 2.)