[R] Removing objects except user-defined functions

2015-02-19 Thread philippe massicotte
Dear R users. I would like to remove all object from my workspace except the function I have defined. However, is I use rm(list = ls()) everything is cleared. I was thinking to typeof to get information about objects, but I could not get it working right. Thank in advance, Phil

[R] Evaluating a formula

2015-01-16 Thread philippe massicotte
Hi all. How we evaluate a formula in R? Ex.: params - list(a = 2, b = 3) x - seq(1,10, length.out = 100) func1 - as.formula(y ~ a*x^2 + b*x) ##How to evaluate func1 using x and the params list ??? Thank you in advance, Phil [[alternative

[R] Substitute initial guesses of parameters in a function

2014-12-03 Thread philippe massicotte
Hi everyone, I have a formula like this: f - as.formula(y ~ p0a * exp(-0.5 * ((x - p1a)/p2a)^2)) I would like to dynamically provide starting values for p0a, p1a, p2a. Is there a way to do it? #Params estimates p - c(12, 10, 1) # This is where I have difficulties mystart - substitute(...)

Re: [R] Substitute initial guesses of parameters in a function

2014-12-03 Thread philippe massicotte
Thank you! Date: Wed, 3 Dec 2014 08:02:17 -0500 From: murdoch.dun...@gmail.com To: pmassico...@hotmail.com; r-help@r-project.org Subject: Re: [R] Substitute initial guesses of parameters in a function On 03/12/2014 7:37 AM, philippe massicotte wrote: Hi everyone, I have a formula like

[R] Formula with dynamic number of variables

2014-11-21 Thread philippe massicotte
Hi everyone. I have a non-linear model specified as this (6 variables, a0, S, K, p0, p1, p2): fit - nlsLM(formula = dat ~ a0 * exp(-S*(x - 250)) + K + ( C ) ) where C = (p0*exp(-0.5*((x-p1)/p2)^2)) The problem is that I do not know in advance how many component (C) I will have in the model.

[R] legend position

2013-12-02 Thread philippe massicotte
Hi all. I'm ploting a raster and I can't find the proper way to move the legend. For example, r = raster(system.file(external/test.grd, package=raster))plot(r) How can I put the legend at the desired position? Thank in advance,Phil [[alternative HTML

Re: [R] legend position

2013-12-02 Thread philippe massicotte
Thank you for reply. If I'm not wrong, legend(...) will works for discrete elements. I'm not sure hot to use it for a colorbar legend sur as the one in the example bellow. Phil Date: Mon, 2 Dec 2013 11:49:19 -0800 From: c...@witthoft.com To: r-help@r-project.org Subject: Re: [R] legend

Re: [R] legend position

2013-12-02 Thread philippe massicotte
Thank you, I'll try to work with lattice. Regards,Phil Date: Mon, 2 Dec 2013 12:06:50 -0800 From: c...@witthoft.com To: r-help@r-project.org Subject: Re: [R] legend position It occurs to me that perhaps you're referring to the 'color bar' on the right of the plot. AFAIK you cannot get at

Re: [R] legend position

2013-12-02 Thread philippe massicotte
Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of philippe massicotte Sent: Monday, December 2, 2013 1:22 PM To: r-help@r-project.org Subject: [R] legend

[R] data manipulation

2013-11-22 Thread philippe massicotte
Hi everyone. I have a list like this: neutral_classes = list(A = 71:100, B = 46:70, C = 21:45, D = 0:20) and I'm trying to return the letter of the named vector for with an integer belong. For example, B if I use the value 50. Any help would be greatly appreciated. Regards,Phil

Re: [R] data manipulation

2013-11-22 Thread philippe massicotte
, length))] # get one or more results with 'match': names(neutralVec[match(c(50, 20, 10, -4), neutralVec)]) # result: # [1] B D D NA Pat On 22/11/2013 16:58, philippe massicotte wrote: Hi everyone. I have a list like this: neutral_classes = list(A = 71:100, B = 46:70, C = 21

Re: [R] data manipulation

2013-11-22 Thread philippe massicotte
On 22/11/2013 16:58, philippe massicotte wrote: Hi everyone. I have a list like this: neutral_classes = list(A = 71:100, B = 46:70, C = 21:45, D = 0:20) and I'm trying to return the letter of the named vector for with an integer belong. For example, B if I use the value 50

[R] Trying to avoid nested loop

2013-10-04 Thread philippe massicotte
Dear R users. I'm trying to avoid using nested loops in the following code but I'm not sure how to proceed. Any help would be greatly appreciated. With regards,Phil X = matrix(rnorm(100), 10, 10) ## Version with nested loopsresult = 0 for(m in 1:nrow(X)){ for(n in 1:ncol(X)){if(X[m,n] !=

Re: [R] Trying to avoid nested loop

2013-10-04 Thread philippe massicotte
Thank you for your answer. This is what I needed. From: s.elli...@lgcgroup.com To: r-help@r-project.org Date: Fri, 4 Oct 2013 15:13:49 +0100 Subject: Re: [R] Trying to avoid nested loop I'm trying to avoid using nested loops in the following code but I'm not sure how to proceed. Any

[R] Combining rasters

2013-09-06 Thread philippe massicotte
Hi everyone. I would like to know if it is possible to combine rasters in R to form a collage. For example, I would like to place 2 copies of the R logo side by side. r = raster(system.file(external/rlogo.grd, package = raster)) After reading the help file (maybe I missed it) I did not

Re: [R] Problem with converting F to FALSE

2013-09-05 Thread philippe massicotte
Look at colClasses in ?read.csv Date: Thu, 5 Sep 2013 18:14:49 +0530 From: kiran4u2...@gmail.com To: r-help@r-project.org Subject: [R] Problem with converting F to FALSE Hi, I have a peculier problem in R-Project that is when my CSV file have one column with all values as 'F' the

[R] Histogram

2013-09-04 Thread philippe massicotte
Hi everyone. I'm currently translating some Matlab code into R. However, I realized that the hsit function produce different results in both languages. in Matlab, hist(1:10, 10) will produce 10 bins with a count of 1 in each, but in R it will produce 9 classes with count of 2,1,1,1,1,1,1,1,1.

Re: [R] Histogram

2013-09-04 Thread philippe massicotte
the only way to get exactly the number of breaks you want is to specify the break intervals yourself. David Carlson -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of philippe massicotte Sent: Wednesday

[R] RCurl and google trends

2013-05-29 Thread Philippe Massicotte
('name=GALX\\s*value=([^]+)'), replacement = \\1) authenticatePage - postForm(authenticateURL, .params = list(Email = usr, Passwd = psw, GALX = galx), curl = ch, .opts = list(verbose = F)) return(ch) } With regards, Phil -- Philippe Massicotte, Ph. D. Stagiaire

[R] Fine control of plot

2013-03-12 Thread philippe massicotte
Hi everyone. I'm trying to create a graph where I could plot some lines on the right side. Here an example: layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(6,2), heights=c(1,1)) x = 1:100y = rnorm(x)+xplot(x,y) reg = lm(y~x)abline(reg, col = red) plot(1, type=n, axes=F, xlab=, ylab=, xlim =

Re: [R] Fine control of plot

2013-03-12 Thread philippe massicotte
Hi and thank you for your answer.  Sorry for the html post, here's the code: (you missed a break line between +x and plot(...)  layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(6,2), heights=c(1,1))  x = 1:100  y = rnorm(x)+x  plot(x,y)  reg = lm(y~x)  abline(reg, col = red)  plot(1,

Re: [R] Fine control of plot

2013-03-12 Thread philippe massicotte
)) but the better way is to see xpd within ?par as described here: https://stat.ethz.ch/pipermail/r-help/2009-July/206311.html along with par()$mai to set the margins appropriately. Sarah On Tue, Mar 12, 2013 at 3:50 PM, philippe massicotte pmassico...@hotmail.com wrote: Hi and thank you for your answer

[R] Combining boxplot

2013-02-25 Thread Philippe Massicotte
Hi everyone. I have two data frames that contain the same variables but with different number of observation. I would like to know it was possible to combine the data so I can have paired boxplot on the same figure. For example, df1 = data.frame(x = rnorm(100)) df1$type = ifelse(df1$x

[R] Help with layout

2013-02-22 Thread philippe massicotte
Dear R users. I'm new with layout and I can't figure how to teak my graphs. I have the following code: layout(matrix(c(1,2,3), 3, 1, byrow = TRUE), heights=c(0.3,0.3,0.6)) boxplot(rnorm(100), horizontal=TRUE, axes=FALSE) boxplot(rnorm(100), horizontal=TRUE, axes=FALSE) hist(rnorm(100))