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

2024-04-02 Thread Luigi Marongiu
Already did... On Tue, Apr 2, 2024 at 10:45 AM Eric Berger wrote: > > 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 

[R] How to tweak genomic plot with genoPlotR?

2024-04-02 Thread Luigi Marongiu
I would like to use your genoPlotR package (doi:10.1093/bioinformatics/btq413) to compare the genomes of two isolates of E. coli K-12 that I have. One is a K-12 that was in my lab's fridge; the other is a derivative of K-12 bought some time ago, HB101. I tried to use genoPlotR, but I could not

Re: [R] How to invert axis within defined range with ggplot2 scale_y_reverse?

2024-03-05 Thread Luigi Marongiu
Thank you. I though the values would have been reversed automatically. Case closed then On Tue, Mar 5, 2024 at 2:43 PM Duncan Murdoch wrote: > > On 05/03/2024 7:16 a.m., Luigi Marongiu wrote: > > A <- rep(c(0, 3, 6, 12, 24), 3) > > B <- c(rep(0,5), rep(1,5), rep(2,5)) &

[R] How to invert axis within defined range with ggplot2 scale_y_reverse?

2024-03-05 Thread Luigi Marongiu
Hello, I am drawing some data with ggplot2 and would like to reverse the order of the y axis and set a custom range for it. I can do the former but when I add the key `limits` to `scale_y_reverse` I get an error as shows below and, worse, no data shown in the plot. How can I properly set a reverse

Re: [R] Fast way to draw mean values and 95% confidence intervals of groups with ggplot2

2023-11-16 Thread Luigi Marongiu
Thank you for your answer. I will implement it, but still I reckon ggplot2 cannot do the whole thing on its own terms: I need to prep the data beforehand. Cheers Luigi On Thu, Nov 16, 2023 at 1:39 PM Rui Barradas wrote: > > Às 11:59 de 16/11/2023, Luigi Marongiu escreveu: > > Hello

[R] Fast way to draw mean values and 95% confidence intervals of groups with ggplot2

2023-11-16 Thread Luigi Marongiu
Hello, I have triplicate (column A) readings (column D) of samples exposed to different concentrations (column C) over time (column B). Is it possible to draw a line plot of the mean values for each concentration (C)? At the moment, I get a single line. Also, is there a simple way to draw the 95%

Re: [R] How to Calculate the Mean by Multiple Groups in R

2023-10-24 Thread Luigi Marongiu
T2 88.3 > > 31 BACT3 18.0 > > > > Or using a different form, that might be more straightforward to you: > > > >> aggregate(df[, c("OD", "ODnorm")], by = df[, c("Time", "Target", "Conc"

Re: [R] How to Calculate the Mean by Multiple Groups in R

2023-10-24 Thread Luigi Marongiu
t;Target", "Conc")], > > data = df, FUN = "mean") > Time Target Conc ODODnorm > 1 1 BACT1 765. 108.3 > 21 BACT2 745. 88.3 > 31 BACT3 675. 18.0 > > Sarah > > On Tue, Oct 24, 202

[R] How to Calculate the Mean by Multiple Groups in R

2023-10-24 Thread Luigi Marongiu
Hello, I have a data frame with different groups (Time, Target, Conc) and each entry has a triplicate value of the measurements OD and ODnorm. How can I merge the triplicates into a single mean value? I tried the following: ``` df = data.frame(Time=rep(1, 9), Well=paste("A", 1:9, sep=""),

Re: [R] How to draw plot marks without label?

2023-09-05 Thread Luigi Marongiu
, if this is not what you wanted, I hope you can use the above to modify > stripchart() to your desired specification. > > Cheers, > Bert > > On Tue, Sep 5, 2023 at 12:57 PM Luigi Marongiu > wrote: >> >> I would like to draw a graph where the y-lable

[R] How to draw plot marks without label?

2023-09-05 Thread Luigi Marongiu
I would like to draw a graph where the y-lables are missing but the marks still present. In this example, I get marks from 2 to 140 000 with increments of 20 000. I could use `plot(... yaxt="n"...)` combined with `axis(2, at..., label="")` but this needs to know exactly the sequence of marks

Re: [R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Luigi Marongiu
Thank you, the problem was indeed about factors. Case solved On Fri, Jul 14, 2023 at 7:05 PM Rui Barradas wrote: > > Às 17:33 de 14/07/2023, Luigi Marongiu escreveu: > > Hello, > > I am measuring a certain variable at given time intervals and > > different concentratio

[R] How to add error bars to a line plot with ggplot2?

2023-07-14 Thread Luigi Marongiu
Hello, I am measuring a certain variable at given time intervals and different concentrations of a reagent. I would like to make a scatter plot of the values, joined by a line to highlight the temporal measure. I can plot this all right. Now, since I have more than one replicate, I would like to

Re: [R] How to plot both lines and points by group on ggplot2

2023-07-01 Thread Luigi Marongiu
Thank you that is exactly it! The problem was to connect each point of the series 'Conc' with a line. Best regards Luigi On Sat, Jul 1, 2023 at 8:33 PM Chris Evans wrote: > > > On 01/07/2023 19:20, Luigi Marongiu wrote: > > Hello, > > I have a dataframe with me

[R] How to plot both lines and points by group on ggplot2

2023-07-01 Thread Luigi Marongiu
Hello, I have a dataframe with measurements stratified by the concentration of a certain substance. I would like to plot the points of the measures and connect the points within each series of concentrations. When I launch ggplot2 I get the error ``` geom_path: Each group consists of only one

Re: [R] How to test the difference between paired correlations?

2023-03-23 Thread Luigi Marongiu
as large or larger than the observed. > This is your p-value. > > Tim > > -Original Message- > From: R-help On Behalf Of Luigi Marongiu > Sent: Wednesday, March 22, 2023 5:12 PM > To: r-help > Subject: [R] How to test the difference between paired correla

[R] How to test the difference between paired correlations?

2023-03-22 Thread Luigi Marongiu
Hello, I have three numerical variables and I would like to test if their correlation is significantly different. I have seen that there is a package that "Test the difference between two (paired or unpaired) correlations". [https://www.personality-project.org/r/html/paired.r.html] However, there

Re: [R] How to draw chemical structures with R?

2022-12-05 Thread Luigi Marongiu
Thanks, I will. On Tue, Dec 6, 2022 at 7:21 AM Jeff Newmiller wrote: > > I have never seen this package mentioned on this list. You should contact the > package maintainer. > > On December 5, 2022 9:59:34 PM PST, Luigi Marongiu > wrote: > >Thanks for the tip! I think

Re: [R] How to draw chemical structures with R?

2022-12-05 Thread Luigi Marongiu
l established as it gets. > > I would look for an example of what you are trying and see if you can get the > example to work. > > LMH > > > Luigi Marongiu wrote: > > Hello,' > > I have seen from this link > > https://cran.r-project.org/web/packages/rcdk/vignettes/

[R] How to draw chemical structures with R?

2022-12-05 Thread Luigi Marongiu
Hello,' I have seen from this link https://cran.r-project.org/web/packages/rcdk/vignettes/using-rcdk.html that there is a way to draw chemical structures using R via rcdk package. I tried to draw a simple structure but I got an error. What is it missing? What is the correct syntax? Thanks ```

Re: [R] Select dataframe row containing a digit

2022-12-01 Thread Luigi Marongiu
Thank you, those are all viable solutions. Regards Luigi On Wed, Nov 30, 2022 at 8:59 PM Rolf Turner wrote: > > > On Wed, 30 Nov 2022 13:40:50 +0100 > Luigi Marongiu wrote: > > > Hello, > > I have a data frame where some lines containing strings including > > d

Re: [R] Select dataframe row containing a digit

2022-11-30 Thread Luigi Marongiu
Thank you, I have been trying with [:digit:] but did not work. It worked with `df$val[grepl('[0-9]', df$val)] = "NUM"` On Wed, Nov 30, 2022 at 2:02 PM Ivan Krylov wrote: > > В Wed, 30 Nov 2022 13:40:50 +0100 > Luigi Marongiu пишет: > > > I am formatting everyth

[R] Select dataframe row containing a digit

2022-11-30 Thread Luigi Marongiu
Hello, I have a data frame where some lines containing strings including digits. How do I select those rows and change their values? In essence, I have a data frame with different values assigned to the column "val". I am formatting everything to either "POS" and "NEG", but values entered as

Re: [R] Replace values based on neither condition

2022-10-28 Thread Luigi Marongiu
Perfect, thank you! On Fri, Oct 28, 2022 at 11:53 AM Rui Barradas wrote: > > Às 10:43 de 28/10/2022, Luigi Marongiu escreveu: > > Hello, > > I have a data frame with a string column. All data that are neither > > "POS" nor "NEG" should've replaced

[R] Replace values based on neither condition

2022-10-28 Thread Luigi Marongiu
Hello, I have a data frame with a string column. All data that are neither "POS" nor "NEG" should've replaced by an NA. How can I implement that (even with extra libraries)? My attempts actually wipe out POS and NEG... Thank you ``` df = data.frame(a = 1:5, b = c("", "31.35", "POS",

Re: [R] Interpreting fa.diagram from package psych

2022-09-12 Thread Luigi Marongiu
insemius > Sent: Sunday, September 11, 2022 11:50 PM > To: Ebert,Timothy Aaron ; Luigi Marongiu > > Cc: r-help > Subject: Re: [R] Interpreting fa.diagram from package psych > > [External Email] > > On 9/11/22 07:17, Ebert,Timothy Aaron wrote: > > It is a bad g

Re: [R] Interpreting fa.diagram from package psych

2022-09-11 Thread Luigi Marongiu
they represent? Is there a way to show an auto-legend? Thank you On Sat, Sep 10, 2022 at 11:33 PM David Winsemius wrote: > > > On 9/10/22 14:08, Luigi Marongiu wrote: > > Hello, > > I have plotted data from exploratory factor analysis, and I got a > > graph si

[R] how to add comma to string vector?

2022-06-10 Thread Luigi Marongiu
Hello, I need to convert an R vector to a python array. Essentially, I got a vector of strings where each element must be enclosed in single quotes. The problem is that each closing single quote should contain a comma. What is the regex trick to do that? I tried with: ``` > (raws = c("field_1",

Re: [R] Error in forest.meta : argument 3 matches multiple formal arguments

2022-05-26 Thread Luigi Marongiu
Thank you On Thu, May 26, 2022 at 12:38 PM Ivan Krylov wrote: > > В Thu, 26 May 2022 12:30:12 +0200 > Luigi Marongiu пишет: > > > > Error in forest.meta(m10, sortvar = TE, predict = TRUE, print.tau2 > > > = TRUE, : > > argument 3 matches multiple formal ar

[R] Error in forest.meta : argument 3 matches multiple formal arguments

2022-05-26 Thread Luigi Marongiu
Hello, I am using the package meta to plot a forest plot. My data looks like this: ``` X Entry Cases Ca_pos Controls Co_pos Method Tissue Disease Virus Set 6 de Villiers, 200782 72 82 61PCR colon/rectum cancer TTV 3 7 de Villiers, 2002

Re: [R] How to set colors, axis gap, and free scale in ggplot?

2022-02-22 Thread Luigi Marongiu
xt(size = 10,face = 'bold')) > ``` > > Ron. > > > On 22/02/2022 14:25, Luigi Marongiu wrote: > > I am trying instead to increase the size with `theme(strip.text.x = > > element_text(size = 10))` (evem from 1 onwards) or `theme(strip.text.x > > = element_text(f

Re: [R] How to set colors, axis gap, and free scale in ggplot?

2022-02-22 Thread Luigi Marongiu
I am trying instead to increase the size with `theme(strip.text.x = element_text(size = 10))` (evem from 1 onwards) or `theme(strip.text.x = element_text(face = "bold"))` but it gives an error (same in both cases, even when using `strip.text`): ``` No summary function supplied, defaulting to

Re: [R] How to set colors, axis gap, and free scale in ggplot?

2022-02-22 Thread Luigi Marongiu
No wonder it was not working: I was using the wrong functions (so far of manuals) This is great, thank you! All tips worked fine, including the free axis scale. On Tue, Feb 22, 2022 at 12:41 PM Ron Crump wrote: > > Hi Luigi, > > > # FROM HERE IT DOES NOT WORK > > facet_grid(. ~ Species,

[R] How to set colors, axis gap, and free scale in ggplot?

2022-02-22 Thread Luigi Marongiu
Hello, I have a dataframe with 3 columns: the actual measurement (Concentration), and two groups (Vitamin and Group). I would like to plot a barplot with superimposed a jitterplot, with error bars. I am using facet_grid. All that I can do, but the customization does not work. The customization is

[R] How to superimpose jitter and barplot in ggplot2?

2022-02-21 Thread Luigi Marongiu
Hello, I am following this post https://www.datanovia.com/en/lessons/ggplot-error-bars/ to superimpose a jitter plot and a barplot with error bars. Te example works: ``` df2 <- ToothGrowth df2$dose <- as.factor(df2$dose) head(df2, 3) df2.summary <- df2 %>% group_by(dose) %>% summarise( sd

Re: [R] how to plot numeric variable against several categories with lattice bwplot?

2022-01-17 Thread Luigi Marongiu
...) On Mon, Jan 17, 2022 at 4:22 AM Rolf Turner wrote: > > > On Thu, 13 Jan 2022 20:38:04 +0100 > Luigi Marongiu wrote: > > > Hello, > > I have a numerical variable (x) and a series of categories. I would > > like to make a box plot of x against each of the categories.

[R] how to plot numeric variable against several categories with lattice bwplot?

2022-01-13 Thread Luigi Marongiu
Hello, I have a numerical variable (x) and a series of categories. I would like to make a box plot of x against each of the categories. How can I arrange the data so that I can accomplish it with lattice? At the moment I got this: ``` df = data.frame(x = c(rep(1,5), rep(2,5), rep(3,5)), y =

[R] Error in using multiple correspondence analysis in R's FactoMineR

2022-01-09 Thread Luigi Marongiu
Hello, I am trying to apply multiple correspondence analysis to a data frame using the FactoMineR package following the post http://sebastien.ledien.free.fr/unofficial_factominer/factosbest/dimensions-description.html My data frame has this structure: ``` > str(df) 'data.frame': 27 obs. of 33

Re: [R] how to run r biotools boxM terst on multiple groups?

2022-01-04 Thread Luigi Marongiu
$int<- interaction(iris$bin, iris$Species) > boxM(iris[,1:4], iris[,7]) > > Cheers > Petr > > > -Original Message- > > From: R-help On Behalf Of Luigi Marongiu > > Sent: Tuesday, January 4, 2022 11:56 AM > > To: r-help > > Subject: [R] how to r

[R] how to run r biotools boxM terst on multiple groups?

2022-01-04 Thread Luigi Marongiu
I have a data frame containing a half dozen continuous measurements and over a dozen ordinal variables (such as, death, fever, symptoms etc). I would like to run a box matrix test and I am using biotools' boxM, but it allows to run only one ordinal group at the time. For instance: ``` >data(iris)

Re: [R] Format dates issues with R

2021-12-14 Thread Luigi Marongiu
Got it, thanks! On Tue, Dec 14, 2021 at 11:59 AM Ivan Krylov wrote: > > On Tue, 14 Dec 2021 11:54:08 +0100 > Luigi Marongiu wrote: > > > "9/29/2021" > > > format = "%d/%m/%y" > > > Why the conversion did not work? > > The

[R] Format dates issues with R

2021-12-14 Thread Luigi Marongiu
Hello, I have these kind of dates: ``` > ori[[n[3]]] [1] "9/20/2021" "9/20/2021" "9/20/2021" "9/20/2021" "9/20/2021" "9/20/2021" [7] "9/20/2021" "9/20/2021" "9/20/2021" "9/20/2021" "9/21/2021" "9/21/2021" [13] "9/21/2021" "9/21/2021" "9/21/2021" "9/21/2021" "9/21/2021" "9/21/2021" [19] "9/21/2021"

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

2021-11-17 Thread Luigi Marongiu
Awesome, thanks! On Wed, Nov 17, 2021 at 7:50 PM Bill Dunlap wrote: > > 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 d

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
icking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Wed, Nov 17, 2021 at 1:42 AM Luigi Marongiu > wrote: >> >> sorry, it was easier than expected: just add `lwd` to the main cal. >> sorry I coul

[R] R lattice contourplot: select only specific values

2021-11-17 Thread Luigi Marongiu
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 2.2 2.6 3.0 2.4 2.8 ``` I would like to plot the contour where the data get integer values (1.0, 2.0, 3.0) but also highlight where the 1.8 and 2.8 values occurred. Thus, I am

[R] vectorization of loops in R

2021-11-17 Thread Luigi Marongiu
Hello, I have a dataframe with 3 variables. I want to loop through it to get the mean value of the variable `z`, as follows: ``` df = data.frame(x = c(rep(1,5), rep(2,5), rep(3,5)), y = rep(letters[1:5],3), z = rnorm(15), stringsAsFactors = FALSE) m = vector() for (i in unique(df$y)) { s = df[df$y

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
sorry, it was easier than expected: just add `lwd` to the main cal. sorry I could not stop the message before checking... On Wed, Nov 17, 2021 at 10:31 AM Luigi Marongiu wrote: > > Hello, > I have generated a contourplot with lattice. How do I set the line > width? I tried with: >

[R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
Hello, I have generated a contourplot with lattice. How do I set the line width? I tried with: ``` library(lattice) contourplot(Z ~ X*Y, data = df, cuts = 3, panel=function(x,y,...){ panel.contourplot(lty=1, lwd = 3) }) ``` but did not work... Thank you

[R] How to use contour plot?

2021-11-16 Thread Luigi Marongiu
Hello, I have a dataframe with 3 values and that I would like to plot with contour: ``` > head(df) Y X Z 1 0.0008094667 50 1 2 0.0012360955 50 1 3 0.0016627243 50 1 4 0.0020893531 50 1 5 0.0025159819 50 1 6 0.0029426108 50 1 >

[R] How to run prop.test on 3-level factors?

2021-11-16 Thread Luigi Marongiu
Hello, I have a large database with a column containing a factor: ``` > str(df) 'data.frame': 500 obs. of 4 variables: $ MR : num 0.000809 0.001236 0.001663 0.002089 0.002516 ... $ FCN : num 2 2 2 2 2 2 2 2 2 2 ... $ Class: Factor w/ 3 levels "negative","positive",..: 1 1 1 1 1 1 1 1 1 1

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
Awesome, thanks! On Wed, Nov 10, 2021 at 10:33 PM Rasmus Liland wrote: > > Dear Luigi, > > Yes, from the named list of dataframes, > you access the demographic table like > that. > > You can remove dput() now, I used it > only to print the output; read ?dput, > it's very handy the next time you

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
; "2022-01-01" $ EnrolTime : chr "13:24:00" "14:25:00" ``` Still, I thought it might have been easier to run `odb.read`. But it works, thank you again! On Wed, Nov 10, 2021 at 7:03 PM Rasmus Liland wrote: > > On 2021-11-10 18:55 +0100, Luigi Marongiu wrot

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
Sure! I am attaching a simplified version of it. I did not see the quote text; it might be difficult to call all table's names since there are hundreds of columns.. On Wed, Nov 10, 2021 at 4:15 PM Rasmus Liland wrote: > > Are you willing to send me a part of the > the proof.odb so I can run the

Re: [R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
Thank you. I have used ODB, it looks easier to use (and install since it needs way fewer dependencies than odbc) but I can't run the SQL statement: ``` > library(ODB) Loading required package: DBI Loading required package: RJDBC Loading required package: rJava > db = odb.open("proof.odb", jarFile

[R] how to connect libreoffice base odb using R package odbc?

2021-11-10 Thread Luigi Marongiu
how can I connect to a LibreOffice base odb file using the package odbc for R? I tried with: > library(odbc) > library(DBI) > con <- dbConnect(odbc::odbc(), + driver = "PostgreSQL Driver", + database = "proof.odb", + uid = "", +

[R] How to select single table with ODB package

2021-11-05 Thread Luigi Marongiu
Hello, I am connecting R to a libreoffice-generated database (.odb) using the ODB package. I would like to link a dataframe to a specific table, but I cannot manage to extract a given table: ``` > db = odb.open(".../LOdatabase.odb", jarFile = NULL) > odb.tables(db) $demographic field.name

Re: [R] generate average frame from different data frames

2021-10-24 Thread Luigi Marongiu
Thanks for the tip! I'll check it out. On Sun, Oct 24, 2021 at 8:07 AM Jim Lemon wrote: > > Hi Luigi, > In that case you will want a binomial confidence interval. > > Jim > > On Sun, Oct 24, 2021 at 4:39 PM Luigi Marongiu > wrote: > > > > Thank you. Sor

Re: [R] create mean ksvm model

2021-10-23 Thread Luigi Marongiu
nto it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Sat, Oct 23, 2021 at 1:19 PM Luigi Marongiu > wrote: >> >> Hello, >> I am using the ksvm function from the library kernlab to generate an >> SVM classifica

Re: [R] generate average frame from different data frames

2021-10-23 Thread Luigi Marongiu
calculated > in much the same way. > > Jim > > On Sun, Oct 24, 2021 at 7:16 AM Luigi Marongiu > wrote: > > > > Hello, > > I have a series of classifications of the same data. I saved this > > classification in a single dataframe (but it could be a list).

[R] create mean ksvm model

2021-10-23 Thread Luigi Marongiu
Hello, I am using the ksvm function from the library kernlab to generate an SVM classification. I am running the model with k-mean cross-validation, thus obtaining different accuracy. Is it possible to merge the different models obtained with the separate data set to generate a kind of median

[R] generate average frame from different data frames

2021-10-23 Thread Luigi Marongiu
Hello, I have a series of classifications of the same data. I saved this classification in a single dataframe (but it could be a list). X and Y are the variable and Z is the classification by three raters. `I` is the individual identifier of each entry: ``` z1 = c(0,0,0,0,0,1,0,0,0,2,

[R] machine learning to define contours in R

2021-10-22 Thread Luigi Marongiu
Hello, I have run some support vector machine analysis. If I draw a grid of 10*10 points in a space, the model I built will assign the points to a given group. Lets' say: ``` results1 = data.frame(row_1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), row_2 = c(0, 0, 0, 1, 0,

Re: [R] Split plot panel into rows with different columns

2021-10-22 Thread Luigi Marongiu
hings into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Thu, Oct 21, 2021 at 2:00 PM Luigi Marongiu > wrote: >> >> Hello, >> I would like to draw 5 figures in the same plot. The layout is: >> first row: 1

[R] Split plot panel into rows with different columns

2021-10-21 Thread Luigi Marongiu
Hello, I would like to draw 5 figures in the same plot. The layout is: first row: 1 column second row: 2 columns third row: 2 columns I have used split.screen: ``` > split.screen(c(3, 1)) # split display into 3 screens [1] 1 2 3 > split.screen(c(1, 2), screen = 2) # split second screen

Re: [R] How to find local minimum between distributions using mixtools?

2021-10-14 Thread Luigi Marongiu
), to=max(x1,x2), length=399) > p <- a*dnorm(x, x1, s1) + (1-a)*dnorm(x, x2, s2) > m <- min(p) > x[x == m] > > On Wed, 13 Oct 2021 at 22:12, Luigi Marongiu wrote: > > > > Hello, > > I have two peaks distributions (and some noise values in between), and > >

Re: [R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Luigi Marongiu
Got it, thanks! On Thu, Oct 14, 2021 at 9:59 AM Eric Berger wrote: > > df[(df$Y>0.2) & (df$X<10),][2,] > > On Thu, Oct 14, 2021 at 10:52 AM Luigi Marongiu > wrote: >> >> Hello, >> I have selected a subset of a dataframe with the vector syntax (if >

[R] How to select given row of conditionally subsetted dataframe?

2021-10-14 Thread Luigi Marongiu
Hello, I have selected a subset of a dataframe with the vector syntax (if this is the name): ``` > df[(df$Y>0.2) & (df$X<10),] YX 10 0.2200642 1.591589 13 0.2941828 1.485951 ``` How can I select only the second row? I only managed to get the whole of whole columns: ``` >

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Luigi Marongiu
Thank you! On Wed, Oct 13, 2021 at 12:00 PM Deepayan Sarkar wrote: > > On Wed, Oct 13, 2021 at 12:13 PM Luigi Marongiu > wrote: > > > > I have seen that the only package that easily rotate the plot is > > ggplot, so I ran: > > ``` > > library(ggplot2)

[R] How to find local minimum between distributions using mixtools?

2021-10-13 Thread Luigi Marongiu
Hello, I have two peaks distributions (and some noise values in between), and I used mixtools to characterize the two overlapping data. How can I find the minimum between the peak distributions? The sigma value of the second population is close to that value, but I am not sure if this is really

Re: [R] How to rotate only one panel by 90 degrees in R plot?

2021-10-13 Thread Luigi Marongiu
print.trellis method > panel.width = list(1,"npc"), > panel.height = list(1, "npc") > ) > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka B

[R] How to rotate only one panel by 90 degrees in R plot?

2021-10-12 Thread Luigi Marongiu
Hello, I would like to show a density plot of the Y axis. To do that, I would like to split the plot into a panel 2/3 long and a density plot 1/3 long. The problem is that, since the density is on the Y axis, the density plot should be rotated byb90 degrees. I tried with the package gridGraphics

Re: [R] How to convert line plot to lattice xtplot?

2021-10-12 Thread Luigi Marongiu
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 Tue, Oct 12, 2021 at 6:49 AM Luigi Marongiu > wrote: >> >> Hello, >>

[R] How to convert line plot to lattice xtplot?

2021-10-12 Thread Luigi Marongiu
Hello, I have drawn data from a dataframe as follows: ``` Substance = rep(c("A", "B", "C", "D"),4) Concentration = rep(1:4,4) Value = c(62.8067, 116.2633, 92.2600, 9.8733, 14.8233, 92.3733, 98.9567, 1.4833, 0.6467, 50.6600, 25.7533,

Re: [R] How to add error bars to lattice xyplot

2021-10-12 Thread Luigi Marongiu
> "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 Mon, Oct 11, 2021 at 12:24 PM Luigi Marongiu > wrote: >> >&

Re: [R] How to add error bars to lattice xyplot

2021-10-11 Thread Luigi Marongiu
function (x,y) { panel.segments(x0 = log10(df$Concentration), x1 = log10(df$Concentration), y0 = df$Value - dfsd$Value, y1 = df$Value + dfsd$Value, col = COLS) } ) ``` I will check xYplot out, I think it is the tool for the job. On Mon, Oct 11, 2021 at 3:56 PM Deepayan Sarkar wrote: > > O

Re: [R] [External] Missing text in lattice key legend

2021-10-11 Thread Luigi Marongiu
Outlook for iOS > > From: R-help on behalf of Luigi Marongiu > > Sent: Monday, October 11, 2021 7:46:36 AM > To: r-help > Subject: [External] [R] Missing text in lattice key legend > > Hello, > I am drawing some data with lattice using: > ``` > library(lattice) &

Re: [R] Missing text in lattice key legend

2021-10-11 Thread Luigi Marongiu
Awesome, thanks! On Mon, Oct 11, 2021 at 2:19 PM Deepayan Sarkar wrote: > > On Mon, Oct 11, 2021 at 5:17 PM Luigi Marongiu > wrote: > > > > Hello, > > I am drawing some data with lattice using: > > ``` > > library(lattice) > > COLS = c(&qu

[R] How to add error bars to lattice xyplot

2021-10-11 Thread Luigi Marongiu
Hello, I am trying to plot data using lattice. The basic plot works: ``` Substance = rep(c("A", "B", "C", "D"),4) Concentration = rep(1:4,4), Value = c(62.8067, 116.2633, 92.2600, 9.8733, 14.8233, 92.3733, 98.9567, 1.4833, 0.6467, 50.6600,

[R] Missing text in lattice key legend

2021-10-11 Thread Luigi Marongiu
Hello, I am drawing some data with lattice using: ``` library(lattice) COLS = c("gold", "forestgreen", "darkslategray3", "purple") xyplot(Value ~ Concentration, group = Substance, data = inf_avg, pch = 16, cex = 1.2, type = "b", xlab=expression(bold(paste("Concentration (",

Re: [R] how to predict X given Y using logit regresion in R?

2021-10-02 Thread Luigi Marongiu
on, data = newdata, type="l") text(lod+0.2, 0.87, labels = round(lod, 2), cex = 0.9) ``` Case closed On Sat, Oct 2, 2021 at 4:33 PM Luigi Marongiu wrote: > > I tried with: > ``` > library(chemCal) > inverse.predict(model, 0.95) > > inverse.predict(model, 0.95) >

Re: [R] how to predict X given Y using logit regresion in R?

2021-10-02 Thread Luigi Marongiu
Hello, I also tried with ``` library(MASS) > dose.p(model,p=.95) Dose SE p = 0.95: 1.70912 96.26511 ``` which is closer to the expected 1.72 but with a very large error (I expected 1.10-2.34). Is this regression correct? On Sat, Oct 2, 2021 at 10:14 AM Luigi Marongiu wr

Re: [R] how to predict X given Y using logit regresion in R?

2021-10-02 Thread Luigi Marongiu
out 1.7. Could it be that model is based on glm whereas inverse.predict uses linear regression? On Sat, Oct 2, 2021 at 10:14 AM Luigi Marongiu wrote: > > Hello, > I have set a glm model using probit. I would like to use it to predict > X given Y. I have followed this example: > ``` &g

[R] how to predict X given Y using logit regresion in R?

2021-10-02 Thread Luigi Marongiu
Hello, I have set a glm model using probit. I would like to use it to predict X given Y. I have followed this example: ``` f2<-data.frame(age=c(10,20,30),weight=c(100,200,300)) f3<-data.frame(age=c(15,25)) f4<-data.frame(age=18) mod<-lm(weight~age,data=f2) > predict(mod,f3) 1 150 > predict(mod,f4)

[R] How to get a given cut-off in logit regression?

2021-10-01 Thread Luigi Marongiu
Hello, I would like to calculate the 95% success rate of a test. I have a series of dilutions and the proportion of positive results out of 37 attempts for each of them. I would like to find the concentration that gives 95% success and I used logit regression: ``` df <- data.frame(concentration =

Re: [R] how to combine logic test on vectors in R?

2021-10-01 Thread Luigi Marongiu
ll(z == "") >> [1] TRUE >> > z <- c("a","") >> > all(z == "") >> [1] FALSE >> >> If this isn't it, just ignore without reply. >> >> Bert Gunter >> >> "The trouble with having an o

Re: [R] how to combine logic test on vectors in R?

2021-09-30 Thread Luigi Marongiu
ly want an AND operator, & or &&, which will only > return TRUE if all elements are TRUE, > > More on logical operators: > https://stat.ethz.ch/R-manual/R-devel/library/base/html/Logic.html > > Sarah > > On Thu, Sep 30, 2021 at 9:07 AM Luigi Marongiu >

[R] how to combine logic test on vectors in R?

2021-09-30 Thread Luigi Marongiu
Hello, I have two data frames, each with three rows: ``` df_a <- data.frame(a = letters[1:3], b = LETTERS[1:3], q = c("", "", ""), stringsAsFactors = FALSE) df_b <- data.frame(a = letters[4:6], b = LETTERS[4:6], q = c("", "", "1.5"), stringsAsFactors = FALSE) ``` I need to test whether the

Re: [R] How to install package meta on Linux Ubuntu 21?

2021-09-29 Thread Luigi Marongiu
do not know the package names. > > > > > >> On Sep 29, 2021, at 9:46 AM, Luigi Marongiu > >> wrote: > >> > >> Hello > >> I have R version 4.1.1 (2021-08-10) -- "Kick Things", on an Ubuntu 21 > >> machine. I am tryi

[R] How to install package meta on Linux Ubuntu 21?

2021-09-29 Thread Luigi Marongiu
Hello I have R version 4.1.1 (2021-08-10) -- "Kick Things", on an Ubuntu 21 machine. I am trying to install the package meta but I get the following error: ``` ... ERROR: dependency ‘RcppEigen’ is not available for package ‘lme4’ * removing ‘/home/gigiux/R/x86_64-pc-linux-gnu-library/4.1/lme4’

Re: [R] alternative to subset(dataframe, select = - column) in R

2021-09-24 Thread Luigi Marongiu
ep 24, 2021 at 7:33 PM Rui Barradas wrote: > > Hello, > > Like this? > > > mtcars[names(mtcars) != "mpg"] > > > Hope this helps, > > Rui Barradas > > Às 15:09 de 24/09/21, Luigi Marongiu escreveu: > > Hello, > > this is a

[R] alternative to subset(dataframe, select = - column) in R

2021-09-24 Thread Luigi Marongiu
Hello, this is a very simple question but... what is the vector alternative to `subset(dataframe, select = - column)`? I tried with: ``` > x = new[-ID] Error in `[.data.frame`(new, -ID) : object 'ID' not found > x = new[-"ID"] Error in -"ID" : invalid argument to unary operator > x = new[[-"ID"]]

Re: [R] how to remove factors from whole dataframe?

2021-09-19 Thread Luigi Marongiu
r modifying df, not df1 is > > > df[sapply(df, is.factor)] <- lapply(df[sapply(df, is.factor)], as.character) > > > Hope this helps, > > Rui Barradas > > Às 11:03 de 19/09/21, Luigi Marongiu escreveu: > > Thank you Jim, but I obtain: > > ``` > >> s

Re: [R] how to remove factors from whole dataframe?

2021-09-19 Thread Luigi Marongiu
) > else return(x) > df1<-lapply(df,factor2character) > > Jim > > On Sun, Sep 19, 2021 at 8:03 PM Luigi Marongiu > wrote: > > > > Thank you Jim, but I obtain: > > ``` > > > str(df) > > 'data.frame': 5 obs. of 3 variables: > > $ region

Re: [R] how to remove factors from whole dataframe?

2021-09-19 Thread Luigi Marongiu
es : num 13 16 22 27 34 $ country: char "a","b","c","d",..: 1 2 3 4 5 ``` On Sun, Sep 19, 2021 at 11:37 AM Jim Lemon wrote: > > Hi Luigi, > It's easy: > > df1<-df[,!unlist(lapply(df,is.factor))] > > _except_ when there is only one

[R] how to remove factors from whole dataframe?

2021-09-19 Thread Luigi Marongiu
Hello, I woul dlike to remove factors from all the columns of a dataframe. I can do it n a column at the time with ``` df <- data.frame(region=factor(c('A', 'B', 'C', 'D', 'E')), sales = c(13, 16, 22, 27, 34), country=factor(c('a', 'b', 'c', 'd', 'e'))) new_df$region <-

Re: [R] show structure of selected columns of dataframe

2021-09-15 Thread Luigi Marongiu
Thanks On Wed, Sep 15, 2021 at 5:12 PM Jeff Newmiller wrote: > > Really? > > str( df[ , grep(".*_a*.", names(df)) ] ) > > > On September 15, 2021 7:53:17 AM PDT, Luigi Marongiu > wrote: > >Hello, > >I have a dataframe and I would like to b

[R] show structure of selected columns of dataframe

2021-09-15 Thread Luigi Marongiu
Hello, I have a dataframe and I would like to browse the information of its structure only for a subset of columns (since there are hundreds of them). For instance, I tried with grepping some columns as in: ``` df <- data.frame(var_a1 = c(letters[1:3], letters[1:4]), var2 =

Re: [R] How to globally convert NaN to NA in dataframe?

2021-09-03 Thread Luigi Marongiu
NA > 7 NA NA 0.7987658 > 8 NA NA -0.5225229 > 9 NA NA 0.7673103 > 10 NA NA -0.5263897 > > So my "nice compact command" > dat[sapply(dat, is.nan)] <- NA > > works as expected, but summary gives as mean NAN. > > Cheers > Petr > > > -O

Re: [R] Show only header of str() function

2021-09-02 Thread Luigi Marongiu
Thanks, that is perfect! On Thu, Sep 2, 2021 at 7:02 PM Deepayan Sarkar wrote: > > On Thu, Sep 2, 2021 at 9:26 PM Enrico Schumann > wrote: > > > > On Thu, 02 Sep 2021, Luigi Marongiu writes: > > > > > Hello, is it possible to show only the header (that i

Re: [R] How to globally convert NaN to NA in dataframe?

2021-09-02 Thread Luigi Marongiu
t; x[is.nan(x)] <- NA_real_ > > I'd also suggest this same solution for the other question you posted, > > x[x == 0] <- NA > > On Thu, Sep 2, 2021 at 10:01 AM Luigi Marongiu > wrote: >> >> Sorry, >> still I don't get it: >> ``` >> &g

  1   2   3   4   >