[R] substr gives empty output

2018-01-21 Thread Luigi Marongiu
Dear all, I have a string, let's say "testing", and I would like to extract in sequence each letter (character) from it. But when I use substr() I only properly get the first character, the rest is empty (""). What am I getting wrong? For example, I have this code: >>> x <- "testing" k <- nchar(x)

Re: [R] substr gives empty output

2018-01-23 Thread Luigi Marongiu
u should get what you want. > Cheers, > Tim > > > Date: Sun, 21 Jan 2018 10:50:31 -0500 > > From: Ek Esawi > > To: Luigi Marongiu , r-help@r-project.org > > Subject: Re: [R] substr gives empty output > > Message-ID: > > > ri_...@mail.gmail.com

[R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
Dear all, I have a dataframe with a column representing the names of the elements (a, b, etc) and one with their frequencies. How can I plot the frequencies so that each element has an associated frequency value? I have been thinking of a histogram, but I have found it difficult to implement. I hav

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
ou are after? > > group <- c("a", "b", "c", "d", "e") > freq <-c(1, 2, 2, 5, 3) > x = rep(group, freq) > barplot(table(x)) > > Cheers, > Ben > > > > On Jun 7, 2018, at 6:00 AM, Luigi Marongiu wrote: > > Dear a

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
uot;e") > freq <-c(1, 2, 2, 5, 3) > x = rep(group, freq) > barplot(table(x)) > > Cheers, > Ben > > > > On Jun 7, 2018, at 6:00 AM, Luigi Marongiu wrote: > > Dear all, > I have a dataframe with a column representing the names of the > elements

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
I suggest getting a your hands on a > copy of https://www.r-project.org/doc/bib/R-books_bib.html#R:Sarkar:2008 It's > really worth it if you plan to spend time with lattice. > > Cheers, > Ben > > > On Jun 7, 2018, at 7:02 AM, Luigi Marongiu wrote: > > also, w

[R] Lattice stacked barplot vertical bars

2017-09-22 Thread Luigi Marongiu
Dear all, I have made a barplot using lattice in which the bars are stacked horizontally. I would like to stack them vertically, but if I use the parameter 'horizontal = FALSE' I get the error: 'Error in FUN(X[[i]], ...) : invalid 'type' (character) of argument'. The problem I face is that, in draw

Re: [R] Lattice stacked barplot vertical bars

2017-09-22 Thread Luigi Marongiu
c("yellow", "orange")) > ), > strip = strip.custom(factor.levels = c("Cases","Controls"), > strip.levels=TRUE, > strip.names=FALSE, > par.strip.text = list(cex = 1) > )

[R] Upgrade R 3.2 to 3.3 using tar.gz file on Ubuntu 16.04

2016-09-13 Thread Luigi Marongiu
Dear all, I am working on Linux Ubuntu 16.04 and I have installed R 3.2. I need to upgrade to R 3.3 and I tried several options available online with no success. I downloaded the tar.gz file for R 3.3 and I would like to ask how can I use this file in order to accomplish the upgrade. Many thanks, L

[R] Handling NA values in a if statement

2015-04-17 Thread Luigi Marongiu
Dear all, I have a vector with a certain range of values including infinity and NA. I would like to remove the values that are outside a given range (lower level = ll and upper level = ul) but I am getting the error due to the NA values (missing value where TRUE/FALSE needed). I then included the !

Re: [R] Handling NA values in a if statement

2015-04-20 Thread Luigi Marongiu
lt;- NA } else { x[i] <- x[i] } } return(x) } (X<-clipper(x, ll, ul)) that works all right. Best regards Luigi On Fri, Apr 17, 2015 at 11:43 PM, Marc Schwartz wrote: > On Apr 17, 2015, at 5:23 PM, Luigi Marongiu wrote: >> >> Dear all, >> I have a vector with a c

[R] high density plots using lattice dotplot()

2015-04-20 Thread Luigi Marongiu
Dear all, I am trying to plot the results of a PCR experiments that involves 384 individual plots. Admittedly the space for the plots will be tiny, but I just nedd some icon to have a feeling of the layout of the experiment and a quick comparison of the plots. I believe that lattice would be the ri

[R] select portion of text file using R

2015-04-20 Thread Luigi Marongiu
Dear all, I have a flat file (tab delimited) derived from an excel file which is subdivided in different parts: a first part is reporting metadata, then there is a first spreadsheet indicated by [ ], then the actual data and the second spreadsheet with the same format [ ] and then the data. How can

[R] create function to plot high density data using lattice

2015-04-23 Thread Luigi Marongiu
Dear all, with the most useful help of Duncan I updated a script to plot high density data in the form of 384 squares containing tiny plots. The function works and it is possible to create a pdf version of the output. but when i try to make a function out of this script, the resulting pdf file is e

Re: [R] select portion of text file using R

2015-04-27 Thread Luigi Marongiu
\tCycle \tTarget \tName \tRn \t1 \t1 \tAdeno 1 \t0.82 \t1 \t2 \tAdeno 1\ \t0.93 ... \t2 \t1 \tAdeno 2 \t0.78 ... On Mon, Apr 20, 2015 at 12:17 PM, Duncan Murdoch wrote: > On 20/04/2015 3:28 AM, Luigi Marongiu wrote: >> Dear all, >> I have a flat file (tab delimited) derived from a

[R] add outer strip for levels in lattice plot (useOuterStrips alternative for Lattice)

2015-07-05 Thread Luigi Marongiu
Dear all, I would like to add an outer strip or something like that on a lattice plot I am making. Such plot contains 384 cells and, since I am not interested in the axis values, I set: scales = list( x = list(draw = FALSE), y = list(draw = FALSE),

Re: [R] add outer strip for levels in lattice plot (useOuterStrips alternative for Lattice)

2015-07-08 Thread Luigi Marongiu
gt; and > https://stat.ethz.ch/pipermail/r-help/2007-July/135551.html > > otherwise have a look at ?trellis.focus and > https://stat.ethz.ch/pipermail/r-help/2006-July/109585.html > > failing that ?gridRect and ?gridText from library(grid) > > Regards > > Duncan > &

Re: [R] add outer strip for levels in lattice plot (useOuterStrips alternative for Lattice)

2015-07-11 Thread Luigi Marongiu
uncan Mackay wrote: > Hi Luigi > > If you wanted to add some text you could use grid.text from the grid package > > I use it regularly for annotating > > See also > https://stat.ethz.ch/pipermail/r-help/2005-February/066264.html > > https://stat.ethz.ch/pipermai

[R] change font size within the panel.text function (package lattice)

2015-07-11 Thread Luigi Marongiu
Dear all, I am adding some text to the panels of a graph generated through the lattice function using the argument: xyplot( ..., panel = function(x, y,...) { panel.xyplot(x,y,...) panel.text(0,0,labels=V[panel.numb

[R] convert character vector to decimal for numeric testing

2015-07-15 Thread Luigi Marongiu
Dear all, I have a vector that comes from some calculations I am making and this vectors turns out to be in character format rather than numerical. I can convert it in numerical format but then the calculations are not correct, as you can see in the following example. I was also expecting that roun

[R] plot auto key and text into panels using lattice

2015-07-20 Thread Luigi Marongiu
Dear all, I am writing some text into several panels which I can do with this script (in capital the variables): xyplot(Y ~ X | Z, data = DATAFRAME, groups = Z, ylab= "Y", xlab="X", main="TITLE", scales = list

[R] force values for elements of a dataframe below cut-off

2015-07-27 Thread Luigi Marongiu
Dear all, I would like to clip the data of a dataframe by forcing the value of the elements below a cut-off to 0. I believe that the function to be used is sapply but I could not have the call working properly. Would you have any tip? Best regards Luigi >>> value <- c(5.43, 6.63, 0, 6.2, 5.61, 0,

[R] assign optimal cut-off to variable using Epi/pROC packages

2015-07-27 Thread Luigi Marongiu
Dear all, I am calculating the optimal cut-off for a test against a gold standard measure. I can determine the cut-off (in the following example 5.905) but I would like to assign it to an atomic variable so that the cut-off is updated every time the data is changed. I am using the ROC and roc funct

[R] RAxML using R

2014-12-28 Thread Luigi Marongiu
Dear all, I would like to run RAxML for phylogenetic analysis as indicated on Paradis' "Analysis of phylogenetic and evolution with R" (p. 158) thus I tried to use the package phyloch and its function raxml(). I am using Linux Ubuntu 14 and I was able to successfully install RAxML on my machine

Re: [R] RAxML using R

2014-12-29 Thread Luigi Marongiu
adas Em 28-12-2014 23:09, Luigi Marongiu escreveu: Dear all, I would like to run RAxML for phylogenetic analysis as indicated on Paradis' "Analysis of phylogenetic and evolution with R" (p. 158) thus I tried to use the package phyloch and its function raxml(). I am using Linux Ubuntu 1

Re: [R] RAxML using R

2014-12-30 Thread Luigi Marongiu
t; devtools package will make this easier: > > library(devtools) > nstall_url("http://www.christophheibl.de/phyloch_1.5-5.tar.gz";) > library(phyloch) > example(raxml) > > HTH, > Ista > > On Mon, Dec 29, 2014 at 9:23 AM, Luigi Marongiu > wrote: >> Dear R

[R] add scale bar using add.scale.bar() on the main plot drawn with zoom() of the ape package

2015-01-01 Thread Luigi Marongiu
Dear all, I am drawing a phylogenetic tree using the zoom() function of the ape package. Since I have 476 sequences in my allagnment, this allows me to have the outlook of the main tree and then highlight a portion of it, and this works fine. However I would like to draw a scale bar using add.s

[R] Select subtree with vector of leaves using zoom function of the ape package

2015-01-01 Thread Luigi Marongiu
Dear all, I am drawing a phylogenetic tree using the zoom() function of the ape package. Since I have 476 sequences in my alignment, this allows me to have the outlook of the main tree and then highlight a portion of it, and this works fine. At the moment I am using the approach of indicating th

[R] add bootstrap to neighbour joining tree using nj function (ape package)

2015-01-06 Thread Luigi Marongiu
Dear all, I am trying to create a neighbour joining tree using the nj() function of ape. I would like to add also the bootstrap. I created a distance matrix with the Kimura 80 algorithm using the muscle function. If I use nj on the distance matrix without any other argument I do obtain the tre

[R] Select best maximum likelihood tree with raxml (package ips)

2015-01-07 Thread Luigi Marongiu
Dear all, I am trying to build a maximum likelihood (ML) tree using the raxml function of the package ips. I implemented the following script: tr<-raxml(seq.align,exec = "/usr/bin/raxmlHPC",b = 100, N = 10) where tr is the resulting tree, seq.align is the DNA alignment created wi

[R] extract file name from a path string

2015-02-26 Thread Luigi Marongiu
Dear all, what code should I write in order to extract the file name from a give path? Let's say that I want to get the file "my file.xls" which is in the directory/folder "My documents"; since I work both with Windows and Linux, the paths I am looking at are in the format: path.windows<-"\\home$\

[R] pcrfit model for qpcR package

2015-03-10 Thread Luigi Marongiu
Dear all, I have been trying to apply the Cy0 algorithm of the package qpcR by creating an object "obj" with the normalized fluorescent data from a 384 plate whose characteristics were TaqMan chemistry and 45 cycles. The import of the object was successful but when I implemented the pcrfit model (i

[R] create pcrfit model with qpcR package

2015-03-15 Thread Luigi Marongiu
Dear all, I am trying to set a model using the pcrfit() function of the qpcR package. I have defined a dataframe with 45 cycles (rows) and 4 readings (columns) derived from a TaqMan qPCR with relative quantification. The data is based on the normalized fluorescent results (main fluorescence minus R

[R] open xlsx file using read.xls function of gdata package

2015-04-03 Thread Luigi Marongiu
Dear all, I am trying to open excel files using the gdata package. I can do that using a .xls file, but the same file, containing the same data, formatted in .xlsx gives error (R does not recognize the pattern from where to start reading the data). Doen anybody knows whether it is possible to read

[R] calculate Cy0 with qpcR package when fitting is failed

2015-04-13 Thread Luigi Marongiu
Dear all, i am trying to calculate the Cy0 from a series of PCR runs in the 384-well. I can create the regression model using the modlist function: ml<-modlist( obj, cyc = 1, model = l4, norm = "FALSE", remove = "none" ) where obj is the dataframe with the fluo

[R] Erase content of dataframe in a single stroke

2018-09-27 Thread Luigi Marongiu
Dear all, I would like to erase the content of a dataframe -- but not the dataframe itself -- in a simple and fast way. At the moment I do that by re-defining the dataframe itself in this way: > df <- data.frame(A = numeric(), + B = numeric(), + C = character())

[R] Boxplot: draw outliers in colours

2018-09-28 Thread Luigi Marongiu
Dear all, I am trying to overlap two series of boxplots on the same graph. In order to distinguish the outliers from one series to the other, would be possible to colour the outliers?: instead of the standard black, is it possible to give a chosen colour? Thank you >>> This is the example. I could

[R] Boxplot with linear (not categorical) x-axis

2018-09-28 Thread Luigi Marongiu
Dear all, I am using boxplot to draw some data. Would be possible to have the X-axis linear (as in a scatter plot) instead of the standard categorical axis? The data I have is subdivided into three groups at the numerical values 1, 3, 5; boxplot treats these as categorical values; in fact, I can wr

Re: [R] Boxplot with linear (not categorical) x-axis

2018-09-30 Thread Luigi Marongiu
xplot(y~x) > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Fri, Sep 28, 2018 at 3:05 AM, Luigi Marongiu > wrote: >> >> Dear all, >> I am using boxplot to draw some data. Would be possible to have the >> X-axis linear (as in a scatter plot)

[R] R plot split screen in uneven panels

2018-12-12 Thread Luigi Marongiu
Dear all, I would like to draw two plots in the same device so that there is a single row and two columns, with the first column being 1/3 of the device's width. I am creating a PNG object with width = 30 and height = 20 cm. I know that I should use split.screen or layout but I am lost with the mat

Re: [R] R plot split screen in uneven panels

2018-12-13 Thread Luigi Marongiu
ng much more flexibly(and therefore requiring more effort to learn). >> >> Cheers, >> Bert >> >> >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along and >> sticking things into it." >> -- Op

[R] convert columns of dataframe to same factor levels

2018-12-19 Thread Luigi Marongiu
Dear all, I have a data frame with character values where each character is a level; however, not all columns of the data frame have the same characters thus, when generating the data frame with stringsAsFactors = TRUE, the levels are different for each column. Is there a way to provide a single ve

Re: [R] convert columns of dataframe to same factor levels

2018-12-19 Thread Luigi Marongiu
Thank you, that worked fine for me. Best wishes of merry Christmas and happy new year, Luigi On Wed, Dec 19, 2018 at 12:19 PM Duncan Murdoch wrote: > > On 19/12/2018 5:58 AM, Luigi Marongiu wrote: > > Dear all, > > I have a data frame with character values where each charac

[R] extract hyperplan from e1071 model

2018-12-20 Thread Luigi Marongiu
Dear all, I am using the package e1071 for modeling SVM. I obtain a model from the data and I can plot the results; the plot shows the support vectors (as 'X's) and the shaded areas as it should be. However, I don't like the plot generated from the model and I would like instead to have more contro

[R] Kernlab Error in .local(x, ...) when plot model

2018-12-28 Thread Luigi Marongiu
Dear all, I have generated a model with KERNLAB using the following steps: the data is a dataframe df of two numerical variables x and y, and each point is assigned a z value that is a factor of two levels: positive and negative. The data has the strucutre: > str(df) 'data.frame': 1574 obs. of 3 va

[R] error in plotting model from kernlab

2019-01-07 Thread Luigi Marongiu
Dear all, I have a set of data in this form: > str 'data.frame': 1574 obs. of 14 variables: $ serial: int 12751 14157 7226 15663 11088 10464 1003 10427 11934 3999 ... $ plate : int 43 46 22 50 38 37 3 37 41 11 ... $ well : int 79 333 314 303 336 96 235 59 30 159 ... $ sample: int 266 295

Re: [R] error in plotting model from kernlab

2019-01-07 Thread Luigi Marongiu
ation. > > [1] https://stat.ethz.ch/pipermail/r-help/2018-December/461010.html > > On January 7, 2019 4:26:20 AM PST, Luigi Marongiu > wrote: > >Dear all, > >I have a set of data in this form: > >> str > >'data.frame': 1574 obs. of 14 variables

Re: [R] error in plotting model from kernlab

2019-01-08 Thread Luigi Marongiu
th(df$cons) > > > > plot(mod, data = df) > > > kernlab::plot(mod, data = df) > > but I get this error: > > > > Error in .local(x, ...) : > > Only plots of classification ksvm objects supported > > > > seems to me selfexplanatory. What did ma

[R] Add point label to lattice cloud plot (3D scatter)

2019-02-28 Thread Luigi Marongiu
Dear all, is there a way to add the labels of the points to a 3D scatter plot obtained with lattice's cloud? I can now plot the data, but when trying to add the label I get the error: `Error in multiple && !outer : invalid 'x' type in 'x && y'` The script I wrote runs like this: >>> df = data.fr

[R] add points to lattice cloud plot (3D scatter)

2019-02-28 Thread Luigi Marongiu
Dear all, is it possible to add points to a lattice cloud plot (3D scatter)? I can plot the main data, but what if I wanted to add another point. In R there is the high level plotting function plot(), then the low level points() or lines() etc. What is the equivalent for lattice? Thank you >>>

Re: [R] add points to lattice cloud plot (3D scatter)

2019-02-28 Thread Luigi Marongiu
indeed a double ll at the start > > Michael > > On 28/02/2019 10:39, Luigi Marongiu wrote: > > Dear all, > > is it possible to add points to a lattice cloud plot (3D scatter)? I > > can plot the main data, but what if I wanted to add another point. In > > R there

Re: [R] add points to lattice cloud plot (3D scatter)

2019-02-28 Thread Luigi Marongiu
39 a.m., Luigi Marongiu wrote: > > Dear all, > > is it possible to add points to a lattice cloud plot (3D scatter)? I > > can plot the main data, but what if I wanted to add another point. In > > R there is the high level plotting function plot(), then the low level > >

Re: [R] add points to lattice cloud plot (3D scatter)

2019-02-28 Thread Luigi Marongiu
ing how you structure the data before you create the plot. Read > the vignette and some tutorials. > > On February 28, 2019 7:38:52 AM PST, Luigi Marongiu > wrote: > >I see. I have been thinking of superimposing two plots with > >par(new=TRUE), but how could I remove all th

[R] Display common color scale on multiple scatter3D plots

2019-03-14 Thread Luigi Marongiu
Dear all, I am trying to display multivariate data using the library plot3D. I have 3 variables that go on the axis and a fourth that I would like to display as a color shade. However, the scale differs between plots because the data I am using varies. Would be possible to maintain a single scale s

Re: [R] Display common color scale on multiple scatter3D plots

2019-03-15 Thread Luigi Marongiu
6, cex = 2,clim=c(0.5,3)) > scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2,clim=c(0.5,3)) > > Jim > > On Thu, Mar 14, 2019 at 9:32 PM Luigi Marongiu > wrote: > > > > Dear all, > > I am trying to display multivariate data using the library plot3D. I > >

[R] scatterplot using plot() function with factorial data

2014-08-27 Thread Luigi Marongiu
Dear all, I would like to ask whether is possible to draw a scatterplot using the simple plot() function when the data is factorial. Without the addition of the argument factor(), plot() represent the factorial data on a linear scale whereas using this argument transforms plot() from a scatterplot

[R] modify strip labels with given text using lattice package

2015-08-31 Thread Luigi Marongiu
Dear all, I am drawing a barchart plot with lattice and the resulting strips are taking the value of the variable being compared (in this example "assay"). However I would like to write myself the value to place into the strips, let's say I want to call the variables as "molecular test" and "serolo

[R] Conditional replacement and removal of data frame values

2015-08-31 Thread Luigi Marongiu
Dear all, I have a data frame and I would like to do the following: a) replace value of one variable "a" according to the value of another one "b" b) remove all the instances of the variable "b" For the sake of argument, let's say I have the following data frame: test <- rep(c("Adenovirus", "Rotav

[R] convert list int data frame

2015-09-14 Thread Luigi Marongiu
Dear all, i would like to convert a list onto a data frame object. Is there an easy way of doing it? I know I should use unlist() but I am not sure about the implementation for the addition of the row numbers; or I could extract one member at the time with something like x <- my.list[[i]] but then

[R] Truncation of character fields in a data frame

2015-09-27 Thread Luigi Marongiu
Dear all, I am reading a txt file into the R environment to create a data frame, however I have notice that some entries have a truncated version of a field, so for instance I get "Astro" instead of "Astro 1-Astro 1" and "Sapo" for "Sapo #1-Sapo_1" and "Sapo #2-Sapo_2", but I also get "Adeno 40/41

[R] How to calculate variance on multiple numbers at once?

2015-11-11 Thread Luigi Marongiu
Dear all, if I have a sample set of the following numbers x1=0.09, x2=0.94, x3=0.48, x4=0.74, x5=0.04 I can calculate the variance easily. But if each x is actually a subset of multiple values, what would be the formula to calculate the variance? and it is possible to implement such mathematical f

Re: [R] How to calculate variance on multiple numbers at once?

2015-11-12 Thread Luigi Marongiu
mple > and/or http://adv-r.had.co.nz/Reproducibility.html for suggestions on how to > pose a question here. In particular data should be supplied in dput() format > as it gives us a copy of exactly how the data is formatted on your machine. > > > John Kane > Kingston ON Canada &g

[R] variance of repeated measurements

2015-11-16 Thread Luigi Marongiu
Dear all, how can I calculate the global variance of repeated measurements? can I simply use the var() function or shall i use more sophisticated tools such as aov()? and in the latter case, how can i extract the variance value? I am providing an example. Thank you. best regards luigi >>> samp <-

[R] define number of clusters in kmeans/apcluster analysis

2015-12-13 Thread Luigi Marongiu
Dear all, I am trying to do some cluster analysis, both with the base R and the apcluster. Both methods give 2 clusters, which is what I am looking for since I am interested in identifying positive and negative results. However I could not find a way to fine-tuning the analysis in order to properl

[R] lattice strip.custom in plot for multiple groups

2015-12-18 Thread Luigi Marongiu
Dear all, I am plotting the count of some data subdivided in different groups. the variables i am using are: A = tests performed B = positive/negative results (but in this case the results are all positive, so all 1) C = multiple (1) or single (0) test applied D = count of instances E = cases (1) o

[R] introduce axis break lattice plot multipanel

2015-12-18 Thread Luigi Marongiu
Dear all, I am plotting some data using lattice's barchart. One of the counts I am plotting has a very large value with respect to the other variables and I would like to introduce a break in the axis to compensate for this 'anomaly' and give more breath to the other bars. In this example the high

[R] neuralnet to discriminate a given outcome by giving cutoff outputs

2015-12-20 Thread Luigi Marongiu
Dear all, I am trying to use neural networks to discriminate positive and negative outcomes from a test; this outcome is given in the z variable of the example I am providing. Each outcome is associated with a pair of variables x and y and I was planning to identify the cut-offs that could separate

[R] interpolation using R for PCR quantification

2015-12-24 Thread Luigi Marongiu
Dear all, I am a newbie in interpolation using R and I would like to learn better the procedure. I am applying interpolation to quantify nucleic acid targets using an assay known as PCR. To do this, I have two sets of variables: standard of known concentrations and query for which I need to identif

[R] Improve training of predictive neural networks

2016-01-13 Thread Luigi Marongiu
Dear all, I am trying to train a predictive neural network to guess the positivity/negativity of some tests I have done. I am using the library pnn and I have empirically identified the best sigma to use in the algorithm but the results I got are affected by false positive results. The actual datas

[R] cut-off point to separate overlapping distributions

2016-02-14 Thread Luigi Marongiu
dear all, I have a set of data that can be defined as bimodal; would be possible to define a cut-off to split it? my mathematical/statistical knowledge is limited, my apologies, thus i am not sure what kind of area this problem belongs to; at the moment I can fit -- thanks to previous help from the

[R] non parametric algorithm npEM (library mixtools) usage

2016-02-15 Thread Luigi Marongiu
Dear all, I am using mixtols to find cut-off values from datasets. At the moment I can run the parametric function normalmixEM from the library mixtools, but I owuld like to generalize the procedure with the non parametric version npEM. However I am confused regarding the arguments to use in this i

[R] fine tune changepoint

2017-02-08 Thread Luigi Marongiu
Dear all, I am using the package changepoint to identify a cut-off between positive and negative values for an assay. I followed the vignette of the package and the results are replicated, so I tried with a dataset of my choice. In the assay, the positive have a value above 0.8 and the negative bel

[R] cluster data in lattice dotplot and show stdev

2017-02-16 Thread Luigi Marongiu
dear all, i have a set of data that is separated in the variables: cluster (two runs), type (blank, negative and positive) and target (A and B), each duplicated. I am plotting it with lattice and the result is a 2x2 matrix plot in which the top two cells (or panels) are relative to run 2, the lower

[R] single strip for the same group in dotplot lattice

2017-02-22 Thread Luigi Marongiu
dear all, I have a set of data that is subdivided in cluster (run 1/run 2) and in target (A/B). When plotting, I obtain a panel strip with "run 1" and "run 2" for each "A" and "B" panel, so "run 1" appears twice and so does "run 2". It is possible to merge the strip together so that I will have "ru

Re: [R] single strip for the same group in dotplot lattice

2017-02-22 Thread Luigi Marongiu
; my.data$clus2 <- with(my.data, interaction(cluster, target)) > > and call: dotplot(value ~ type| clus2, ... ) > > > Philip > > > On 22/02/2017 8:03 PM, Luigi Marongiu wrote: > >> dear all, >> I have a set of data that is subdivided in cluster (run 1/run

Re: [R] single strip for the same group in dotplot lattice

2017-02-23 Thread Luigi Marongiu
> par.strip.text = list(cex = 1) ), >xlab = "Target", >ylab = "Reading", >auto.key = T, >panel = panel.superpose > ) > > dotplot( > value ~ type|cluster, > mdata2, > groups = typeT, > par.settings

Re: [R] single strip for the same group in dotplot lattice

2017-02-24 Thread Luigi Marongiu
quot;Negative", "Positive"), col="black"), rectangles = list(col=c("grey", "green", "red")) ) ) ) <<< also, the answer provided by Paul does the job all right, but uses the package grid instead of lattice. The stripless package (Bert

[R] add median value and standard deviation bar to lattice plot

2017-03-15 Thread Luigi Marongiu
Dear all, I am analyzing some multivariate data that is organized like this: 1st variable = cluster (A or B) 2nd variable = target (a, b, c, d, e) 3rd variable = type (blank, negative, positive) 4th variable = sample (the actual name of the sample) 5th variable = average (the actual reading -- plea

Re: [R] add median value and standard deviation bar to lattice plot

2017-03-16 Thread Luigi Marongiu
tive"), col="black"), > rectangles = list(col=c("grey", "green", "red")) > ) >) > ) > > FWIW, I think adding 1 sd bars is a bad idea statistically. > > And though it made no difference here, please post in pain

Re: [R] add median value and standard deviation bar to lattice plot

2017-03-17 Thread Luigi Marongiu
t; "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 Thu, Mar 16, 2017 at 1:38 AM, Luigi Marongiu > wrote: >> dear Bert, &

[R] plot empty when drawing from custom function

2017-03-28 Thread Luigi Marongiu
Dear all, I have set a function to draw some data using lattice; the drawing works when I use lattice on its own, but if I put it into my custom function, the final plot is empty, yet the terminal reports RStudioGD 1 as normal. What am I missing? regards, Luigi >>> cluster <- c(rep("A", 90

[R] customize labels useOuterStrips lattice

2017-03-30 Thread Luigi Marongiu
Dear all, I am plotting some data using lattice and the function useOuterStrips to make use of more labels. It is possible to customize the labels of useOuterStrips so I can decide what to write in it? instead of having, let's say, A and B I could put something more descriptive. best regards luigi

Re: [R] Some code to run Hutcheson t-test using R

2020-09-11 Thread Luigi Marongiu
Actually, in the working example, Hutcheson himself did not report the term µ1µ2: `t0 = h1-h2/(var1-var2)^1/2`. so I think we can live without it. Case closed. Thank you On Fri, Sep 11, 2020 at 11:11 AM Luigi Marongiu wrote: > > Hello, > I have just realized in the original paper, the

Re: [R] Some code to run Hutcheson t-test using R

2020-09-11 Thread Luigi Marongiu
Thank you for the clarification. On Fri, Sep 11, 2020 at 2:36 PM Karl Schilling wrote: > > Dear Luigi: > > no, µ1µ2 is not "missing" > > First, it should actually be "µ1 - µ2". > > And as your usual null-hypothesis when comparing h1 and h2 is that they > are not different (i.e. µ1 = µ2), the latt

[R] package plotrix: how to account for two two z categories

2020-09-23 Thread Luigi Marongiu
Hello, I have an experiment measuring optical density (OD) when comparing three parameters: a) concentration of the target b) concentration of the probe c) concentration of the reporter antibody. Using plotrix I can nicely draw the first two into clusters, but I can't get separation for the third p

Re: [R] package plotrix: how to account for two two z categories

2020-09-25 Thread Luigi Marongiu
> way I could think of to show the nesting was dots with horizontal > > > lines and it looked messy and was quite hard to visualize the nesting. > > > If you do have any great ideas I always welcome contributions to > > > plotrix. > > > > > > Jim >

[R] How to assign the same levels to a dataframe column?

2020-10-20 Thread Luigi Marongiu
Hello, I have a dataframe df with a column x that has these unique values: "L" "M" "V" "N" "H". I can assign a factor to it: ``` df$x = as.factor(df$x) > [1] L M V N H Levels: H L M N V ``` I now need to get a subset of this dataframe. I could do the same thing as before on the subset sf, but I wou

Re: [R] How to assign the same levels to a dataframe column?

2020-10-20 Thread Luigi Marongiu
rows with the same level. It will be on you to decide what statistical > properties (proportions?) you want to maintain between the full data set and > your subset. > > On October 20, 2020 6:42:27 AM PDT, Luigi Marongiu > wrote: > >Hello, > >I have a dataframe df with a col

[R] How to shade area between lines in ggplot2

2020-10-23 Thread Luigi Marongiu
Hello, I am running SVM and showing the results with ggplot2. The results include the decision boundaries, which are two dashed lines parallel to a solid line. I would like to remove the dashed lines and use a shaded area instead. How can I do that? Here is the code I wrote.. ``` library(e1071) lib

Re: [R] How to shade area between lines in ggplot2

2020-10-23 Thread Luigi Marongiu
n-lines-using-g > gplot-in-r > > Cheers > Petr > > > -Original Message- > > From: R-help On Behalf Of Luigi Marongiu > > Sent: Friday, October 23, 2020 9:59 AM > > To: r-help > > Subject: [R] How to shade area between lines in ggplot2 > >

Re: [R] How to shade area between lines in ggplot2

2020-10-23 Thread Luigi Marongiu
On Fri, Oct 23, 2020 at 10:26 AM PIKAL Petr wrote: > > Hi > > Did you try google? I got several answers using your question > > e.g. > https://stackoverflow.com/questions/54687321/fill-area-between-lines-using-g > gplot-in-r > > Cheers > Petr > > > -Orig

Re: [R] How to shade area between lines in ggplot2

2020-10-23 Thread Luigi Marongiu
n-lines-using-g > gplot-in-r > > Cheers > Petr > > > -Original Message- > > From: R-help On Behalf Of Luigi Marongiu > > Sent: Friday, October 23, 2020 9:59 AM > > To: r-help > > Subject: [R] How to shade area between lines in ggplot2 > > >

Re: [R] How to shade area between lines in ggplot2

2020-10-23 Thread Luigi Marongiu
min = slope_1*x + intercept_1 - 1/w[2], > ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1)) > > Cheers > Petr > > > -Original Message- > > From: Luigi Marongiu > > Sent: Friday, October 23, 2020 11:11 AM > > To: PIKAL P

Re: [R] How to shade area between lines in ggplot2

2020-10-27 Thread Luigi Marongiu
1*x + intercept_1 + 1/w[2]), fill = "yellow", alpha=0.1) > > Cheers > Petr > > > -Original Message- > > From: Luigi Marongiu > > Sent: Friday, October 23, 2020 3:30 PM > > To: PIKAL Petr > > Cc: r-help > > Subject: Re: [R] How to shade area b

[R] R for-loop to add layer to lattice plot

2020-10-27 Thread Luigi Marongiu
Hello, I am using e1071 to run support vector machine. I would like to plot the data with lattice and specifically show the hyperplanes created by the system. I can store the hyperplane as a contour in an object, and I can plot one object at a time. Since there will be thousands of elements to plot

Re: [R] R for-loop to add layer to lattice plot

2020-10-28 Thread Luigi Marongiu
Awesome, thanks! On Wed, Oct 28, 2020 at 7:00 AM Deepayan Sarkar wrote: > > On Tue, Oct 27, 2020 at 6:04 PM Luigi Marongiu > wrote: > > > > Hello, > > I am using e1071 to run support vector machine. I would like to plot > > the data with lattice and specificall

[R] fast way to find most common value across columns dataframe

2020-10-31 Thread Luigi Marongiu
Hello, I have a large dataframe (1 000 000 rows, 1000 columns) where the columns contain a character. I would like to determine the most common character for each row. In the example below, I can parse one row at the time and find the most common character (apart for ties...). But I think this will

Re: [R] fast way to find most common value across columns dataframe

2020-10-31 Thread Luigi Marongiu
t;> >> library(prettyR) >> apply(as.matrix(df),1,Mode) >> [1] "C" "B" "D" ">1 mode" ">1 mode" ">1 mode" "D" >> [8] "C" "B" ">1 mode"

[R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
Hello is it possible to color the data of a dataframe according to the values of one column? I have a dataframe that OI have subdivided into X and Y, with a third Z with the sample number. I would like to plot Y~X but coloring using Z. But I would like to use base R and not lines. Is that possible?

Re: [R] Plot dataframe with color based on a column value

2021-01-24 Thread Luigi Marongiu
- reshape(ROI, v.names = "Y", timevar = "Z", idvar = "X", > direction = "wide") > matplot(roi_wide, type = "l", lwd = 3, lty = "solid", col = colrs) > > > Hope this helps, > > Rui Barradas > > Às 14:48 de 24/01/21, Lui

  1   2   3   4   >