Re: [R] split dataframe to several dataframes in R

2015-02-17 Thread Chris Campbell
# However, it may be that storing your # data objects as a single object, such as a list, is more useful. Chris Campbell, PhD Tel. +44 (0)1249 705 450 | Mobile. +44 (0) 7929 628 349 www.mango-solutions.com Mango Solutions 2 Methuen Park, Chippenham, Wiltshire. SN14 OGB UK

Re: [R] Combinations of values in two columns

2013-11-01 Thread Chris Campbell
a a 0 2a b 1 3a c 1 4a d 0 5b a 1 6b b 0 7b c 0 8 b d 0 9c a 0 10 c b 0 11 c c 0 12 c

Re: [R] Make Multiple plots in R

2013-10-31 Thread Chris Campbell
available for your object, you can type: > methods(class = "geomap") I hope this helps. Best wishes Chris Chris Campbell, PhD Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628 349 ccampb...@mango-solutions.com | http://www.mango-solutions.com

Re: [R] deSolve question

2013-06-20 Thread Chris Campbell
term that is divided. Therefore the outputs of these functions should not be the same. Best wishes Chris Chris Campbell, PhD Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628 349 mailto:ccampb...@mango-solutions.com | http://www.mango-solutions.com Mango Solutions, 2 Methuen Park

Re: [R] How to fit the cumulative probability distributive functiion with the gamma distribution?

2013-06-13 Thread Chris Campbell
rmel_data_gamma_zpsbb0146ee.png # hopefully this gives you some ideas Chris Campbell, PhD Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628349 mailto:ccampb...@mango-solutions.com | http://www.mango-solutions.com Mango Solutions, 2 Methuen Park, Chippenham, Wiltshire , SN14

Re: [R] find the position of first observation for each subject

2013-06-13 Thread Chris Campbell
which(!duplicated(ds[, "id"])) Chris Campbell, PhD Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628 349 mailto:ccampb...@mango-solutions.com | http://www.mango-solutions.com Mango Solutions, 2 Methuen Park, Chippenham, Wiltshire , SN14 OGB UK -Original Message- From: r

Re: [R] how to show a dataset in 3d?

2013-05-15 Thread Chris Campbell
7 1.165 7 -0.609 -0.344 0.953 ") dat1 <- read.table(con, header = TRUE) require(rgl) cols <- rainbow(n = length(dat1$Subject)) plot3d(dat1[, 2:4], col = cols) Chris Campbell Tel. +44 (0) 1249 705 450 | Mobile. +44 (0) 7929 628349 mailto:ccampb...@mango-s

Re: [R] Filling Lists or Arrays of variable dimensions

2012-12-20 Thread Chris Campbell
reates a copy of that object, so for very complicated structures you will run into speed and memory issues. Assigning to an existing element is clean, and will normally be less wasteful than creating a new object each time. Best wishes Chris Chris Campbell Tel. +44 (0) 1249 705 450 | Mob

Re: [R] an entry level (stupid) question

2012-12-20 Thread Chris Campbell
Hi Yanyuan Check out: ?"==" ?"[" ?"<-" You should be able to assign the column quickly with no more than two lines of code using square brackets and assign. Or to literally use if, look at: ?"ifelse" Happy Christmas Chr

Re: [R] Filling Lists or Arrays of variable dimensions

2012-12-20 Thread Chris Campbell
eing an error similar to this one: > out[[1:3]] <- 1 Error in `[[<-`(`*tmp*`, i, value = value) : recursive indexing failed at level 2 This is because double square brackets for lists can only set a single list element at once; grid[1, ] is longer. Happy Christmas Chris

Re: [R] Subsetting problem data, 2

2012-07-20 Thread Chris Campbell
<- toyColIndex[!duplicated(toyColIndex)] # select the elements we want toyData[, toyColIndex] # alternatively we could use regular expressions grep(pattern = ("x|z"), x = names(toyData)) # hope this helps Best wishes Chri

Re: [R] write list to ascii

2012-07-19 Thread Chris Campbell
t;- paste("$", names(abc), " ", aa, sep = "") # write out data write.table(bb, "aa.txt", col.names = FALSE, row.names = FALSE, quote = FALSE) # hope this helps Best wishes Chris Chris Campbell Mango Solutions Data Analysis th

Re: [R] How to create axis y axis for horizontal bar plot?

2012-05-18 Thread Chris Campbell
# Hi Manish, try this # locate the y axis central positions barObj <- plot(factor(mtcars$gear, labels = paste(3:5, "Gears")), horiz = TRUE) # create the plot plot(factor(mtcars$gear, labels = paste(3:5, "Gears")), horiz = TRUE) # add axes axis(side = 2, at = c(barObj), la

Re: [R] Loop struggle

2012-03-09 Thread Chris Campbell
A1[i] <- 1 + } > data1 SP A1 1 2 1 2 2 2 3 1 1 Hope this helps, Chris Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 705450 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of titta majasalmi Sent: 0

Re: [R] Trend predictions using R projects!!

2012-03-01 Thread Chris Campbell
Hi Neeraj Check out the task view of some of the many options for trending, time series analysis and visualisation at http://cran.r-project.org/web/views/TimeSeries.html Best wishes Chris Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 705450 -Original Message

Re: [R] How to simulate demographic (specifically, sub-group) data?

2012-02-29 Thread Chris Campbell
Hi Alok See ?createCovariates in MSToolkit. Best wishes Chris Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 705450 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bhupatkar, Alok Sent: 29 February 2012 16

Re: [R] How to remove an object that is loaded every time R is opened?

2012-02-29 Thread Chris Campbell
object. Hope this helps Chris Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 705450 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Love Sent: 29 February 2012 15:10 To: r-help@r-project.org Subject: [R

Re: [R] sqlite create new unique id

2012-02-22 Thread Chris Campbell
. Best wishes Chris Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -Original Message- From: Jadhav, Alok [mailto:alok.jad...@credit-suisse.com] Sent: 22 February 2012 01:30 To: Chris Campbell; r-help@r-project.org Cc: Rory Arneil; Jakub Barszczewski Subject

Re: [R] sqlite create new unique id

2012-02-21 Thread Chris Campbell
Hi Alok Are you certain that you are keeping your connection open? last_insert_rowid() returns id of last inserted row from the current database connection (which invoked the function). Is it possible that every time you run the query you making a new connection? Hope this helps, Chris

Re: [R] Weighted mad

2012-02-07 Thread Chris Campbell
42 0.2824177 Regards, Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bond, Stephen Sent: 07 February 2012 14:55 To: r-help@r-project.org Subject: [R] Weighted

Re: [R] Selecting contiguous, irregularly-shaped sets of values from arrays

2012-02-01 Thread Chris Campbell
y z A 0.3089046 -0.003350135 -0.4506777 NA NA B -1.5895009 0.336233539 -0.3237293 NA NA C -1.0324022 -1.119037223 -1.1525350 NA NA D -0.8440912 -0.44418 NA NA NA E NA 0.391232210 0.4967601 NA NA Hope this helps. Best wishes, Chris Campbell MANGO SOLUTIONS Data Analysi

Re: [R] Change line colors based on data values in Lattice

2012-01-31 Thread Chris Campbell
anel.xyplot(x, y, type = "n", ...) for(i in seq_along(x)) { panel.lines(c(x[i], x[i + 1]), c(y[i], y[i + 1]), col = cols[i]) } } xyplot(y ~ x, data = newdf, groups = g, panel = newpanel, cols = c("blue", "pink", "blue", "pink")[new

Re: [R] Generating unque patient IDs

2012-01-11 Thread Chris Campbell
tor(x) > levels(y) [1] "16" "17" "18" > z <- as.numeric(y) > z [1] 1 1 2 2 3 3 Regards, Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -Original Message- From: r-help-boun...@r-project.org [m

Re: [R] CairoPDF and greek letter spacing

2012-01-11 Thread Chris Campbell
As a workaround you could use escape characters, then adjust the font style as necessary. cairo_pdf(file = "zend.pdf") print(xyplot(y ~ x, data = data.frame(x = 1:10, y = 1:10), main = "Length (\u03BCm)")) dev.off() Regards Chris Campbell MANGO SOLUTIONS Data Analys

Re: [R] transparency using plot+points with sp classes

2011-12-28 Thread Chris Campbell
0.4) plot(xy.sp[1:10,], pch = 21, col = "red", cex = 20, bg = col1) points(xy.sp[11:20, ], pch = 21, col = "darkgreen", cex = 10, bg = col2) # Happy Christmas! Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -Original Message- From:

Re: [R] Calculate AUC Using the Trapezoidal Method

2011-12-15 Thread Chris Campbell
The arguments time, id and dv take character strings. AUC(Data, time = "Time", id = "Fraction", dv = "Variable") Fraction AUC 1 C1 4413.549 Regards, Chris Campbell MANGO SOLUTIONS Data Analysis that Delivers +44 1249 767700 -Original Messa

Re: [R] Legendre polynomials

2010-12-08 Thread Chris Campbell
Hi Alaios Have a look at the package gsl. There is a family of Legendre functions, with additional functions available from the ALF package (http://www.gnu.org/software/gsl/). All the best Chris Campbell MANGOSOLUTIONS, R Training and Consulting T: +44 (0)1249 767700 Ext: 233 F: +44 (0)1249

Re: [R] lattice: strip panel function question

2010-12-06 Thread Chris Campbell
he plot order Hope this helps. Chris Campbell MANGOSOLUTIONS, R Consulting and Training T: +44 (0)1249 767700 Ext: 233 F: +44 (0)1249 767707 M: +44 (0)7967 028876 www.mango-solutions.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf O

Re: [R] [lattice] densityplot label the peak.

2010-11-12 Thread Chris Campbell
On Thu, Nov 11, 2010 at 11:45, Joon Yeong Kim wrote: > I tried using panel function but wasn't sure how to get the y value for the > peak of the densityplot. > > I'm thinking there should be a way to retrieve the densityplot object so > that I can get the (x,y) values of the curve directly from t

Re: [R] define colors for groups in lattice xyplot

2010-09-03 Thread Chris Campbell
;)), superpose.line = list(col = c("red", "green", "blue")) ) xyplot( result ~ time | location, data=dataset,groups=genotype,pch=19, type = "b", par.settings = par.settings) ### Hope this helps Chris ### Hadley Wickham, Creator of ggplot2 - teaching in

Re: [R] Putting legend *outside* plotting area

2010-08-30 Thread Chris Campbell
On Sun, Aug 29, 2010 at 20:00, Worik R wrote: > Is there a simple way to put a legend outside the plot area for a simple > plot? > > I found... (at http://www.harding.edu/fmccown/R/) > > # Expand right side of clipping rect to make room for the legend > *par(xpd=T, mar=par()$mar+c(0,0,0,4))* > >

Re: [R] sendmailR-package-valid code needed

2010-08-23 Thread Chris Campbell
msg <- "It works!" sendmail(from, to, subject, msg, control=list(smtpServer="ASPMX.L.GOOGLE.COM")) Cheers Chris Hadley Wickham, Creator of ggplot2 - teaching in the UK. 1st - 2nd November 2010. To book your seat please go to http://mango-solutions.com/news.html

Re: [R] xyplot - I can't find colors in my picture

2010-08-16 Thread Chris Campbell
. To book your seat please go to http://mango-solutions.com/news.html Chris Campbell, PhD MANGOSOLUTIONS T: +44 (0)1249 767700 Ext: 233 F: +44 (0)1249 767707 M: +44 (0)7967 028876 www.mango-solutions.com Unit 2 Greenways Business Park Bellinger Close Chippenham Wilts SN15 1BN UK -Original

Re: [R] expression over-plotted

2010-03-26 Thread Chris Campbell
On Fri, Mar 26, 2010 at 16:05, Brad Eck wrote: > >   When I try to add the following annotation to a plot the entries are plotted >   one on top of the other.  I'm trying to get something that looks like " eta >   =  0.2  "  where the Greek letter is used on the plot.  I realize that >   expressio

Re: [R] for loop function output

2010-02-12 Thread Chris Campbell
On Fri, Feb 12, 2010 at 01:26, seydahmet ercan wrote: > Hello all, > I am trying to run a simulation. the simulation presented below. > >> rep=5 >> sr=.10 # selection ratio >> pmin=.10 # minority ratio >> nap=1000 # total number of applicant >> nsle=sr*nap # number of ee selected >> nb=nap*pmin #

Re: [R] Legend symbol?

2010-02-04 Thread Chris Campbell
On Thu, Feb 4, 2010 at 14:59, Douglas M. Hultstrand wrote: > Hello, > > I am creating a plot/image using different data and a couple fit lines (see > attached image).  In the legend, I want the Default and Exponential symbol > to be a line.  I am using the pch command, I tried to use "-" to repres

Re: [R] create an object in a loop (v3)

2010-02-02 Thread Chris Campbell
On Tue, Feb 2, 2010 at 11:44, Ivan Calandra wrote: > Hi David, > > Thanks for your answer. > But I don't really see how I can extend it with my real data. > The thing is that I have more than 3 names and 1 value for each name. > Moreover, each is different from one run to another. That is why I wa

Re: [R] hiding/protecting utility functions in .Rprofile

2010-02-02 Thread Chris Campbell
On Mon, Feb 1, 2010 at 13:19, Michael Friendly wrote: > [Env: WinXp, R 2.9.2] > In my .Rprofile, I define a number of utility functions I'd like to have > available in my R session, but don't want them > to be *normally* listed by ls(), or more importantly, saved if I save my > session variables/f

Re: [R] Legend for two plots

2009-12-18 Thread Chris Campbell
On Fri, Dec 18, 2009 at 12:03, Marc Giombetti wrote: > Dear R users, > > I am new to R and I couldn't figure out how to solve the following > problem: > > I am trying to put a legend below two plots using the code below. The > legend appears in the second plot, > but I want the legend to appear b

Re: [R] Labels in horizontal dendrogram not placed correctly?

2009-11-18 Thread Chris Campbell
On Mon, Nov 16, 2009 at 07:28, joris meys wrote: > Hi all, > > I tried plotting a horizontal dendrogram, but it seems as if the > labels are not taken into account in the function plot.dendrogram(). > > A minimal example : > Test <- data.frame( >    x1x = c(1:10), >    x2x = c(2:11), >    

Re: [R] question about function heatmap

2009-11-18 Thread Chris Campbell
On Tue, Nov 17, 2009 at 17:03, Waverley @ Palo Alto wrote: > Hi, > > I am using the function heatmap(stats) to draw a microarray heatmap, > columns are samples and rows are gene features. > > I did a 2D clustering during the heatmap drawing.  The features and > samples indeed cluster into several