[R] what is wrong with for and if cycle in R

2013-12-19 Thread Jie Tang
hi I used a two nested cycle by if and for by such code for(ity in 1:4) { if (ity==1£© { print(ity) } } when I run the code it failed and R tell me that error: unrespected '}' in } and when I reduce a } for(ity in 1:4) { if (ity==2£© { print(ity) } R will print 4 but not 2 as what I repect

Re: [R] what is wrong with for and if cycle in R

2013-12-19 Thread Ingmar Visser
I get this error below, there seems to be hidden character in your input instead of a parenthesis: for(ity in 1:4) + { + if (ity==1) Error: unexpected input in: { if (ity==1Ô { + print(ity) + } Error in print(ity) : object 'ity' not found } Error: unexpected '}' in } hth, Ingmar On Thu,

Re: [R] what is wrong with for and if cycle in R

2013-12-19 Thread Pascal Oettli
Hi, It seems the right prenthesis ) in the if statement is in different encoding. From your script: charToRaw('if (ity==1)')[11:13] [1] ef bc 89 charToRaw(')') [1] 29 By changing the right parenthesis, it works fine. HTH, Pascal On 19 December 2013 18:07, Jie Tang totang...@gmail.com

Re: [R] GLMM parameter estimates giving opposite trends

2013-12-19 Thread Ben Bolker
Diana Virkki d.virkki at griffith.edu.au writes: I apologize if this is a simple question. I am running GLMM's using glmmML and model averaging with MuMIn. One of the parameter estimates for a parameter (firefreq) in the best model is giving a positive number, where in reality I know

Re: [R] plot different groups as factors

2013-12-19 Thread Duncan Mackay
Hi Luigi A quick guess with lattice library(lattice) structure(list(time = c(18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,

Re: [R] 3D Surface Plot

2013-12-19 Thread Adams, Jean
Check out the wireframe() function in the R package lattice ... library(lattice) ?wireframe Jean On Wed, Dec 18, 2013 at 9:30 AM, Simon Delay-Fortier simon.delay-fort...@mail.mcgill.ca wrote: Hi everyone,I am a very new user of r. I am now mandated to draw a 3-d surface (and possibly

[R] cure fraction model

2013-12-19 Thread L... L...
Dear all, is there an R function to simulate random observations from a cure fraction model (random observations with long-term survivos). Some references how can I do this will be welcome. Best Regards ML [[alternative HTML version deleted]]

Re: [R] Ternary plot and filled contour

2013-12-19 Thread Nicholas Hamilton
Dear Francesco, I wanted to mention that I have just published on CRAN, a package for R, for the plotting of ternary diagrams. It is based off ggplot2, which is highly regarded, and, my website can be viewed at www.ggtern.com, including many examples, specifically including a case study at

Re: [R] Ternary plot and filled contour

2013-12-19 Thread Francesco Nutini
Nice job Nicholas!thanks for the e-mail. Regards, Francesco --- Francesco Nutini CNR-IREA Institute for Electromagnetic Sensing of the Environment Via Bassini 15, 20133 Milano (Italy) Tel: +39-02 23699 297 www.irea.cnr.it

Re: [R] ternary contour plot

2013-12-19 Thread Nicholas Hamilton
Dear Walmes, I wanted to mention that I have just published on CRAN, a package for R, for the plotting of ternary diagrams. It is based off ggplot2, which is highly regarded, and, my website can be viewed at www.ggtern.com, including many examples, specifically including a case study at the

Re: [R] ternary contour plot

2013-12-19 Thread Cleber N.Borges
hello, i make here my suggeestion of a Ternary Plot as a RSM. cleber trimage - function(f){ [[elided Yahoo spam]] t1 = length(x) im = aux = numeric(0) for( i in seq( 1, t1, by = 2 ) ){ #idx = seq( t1**2, i*t1, by = -t1 ) - ((t1 - i):0)

Re: [R] read .slk file

2013-12-19 Thread David Winsemius
On Dec 16, 2013, at 3:10 PM, Santosh wrote: Dear Rxperts.. I recently received a data file with the extension .slk. If I save the file as MS Excel file, I am able to read in R without issues. Is it possible to read this .slk file without converting into another R-readable data format?

Re: [R] cure fraction model

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 5:32 AM, L... L... wrote: Dear all, is there an R function to simulate random observations from a cure fraction model (random observations with long-term survivos). Some references how can I do this will be welcome. Shouldn't be too hard to set up a mixture of weibull

[R] creating list of variables description

2013-12-19 Thread C Lin
Dear R-users, Can someone suggest a good way to keep a list of variables description in R? Something to provide more detailed information on the variables that I have. Kind of like this list: http://www.thearda.com/pals/researchers/VARIABLE_DESCRIPT_LIST%20-%20public.pdfI'd like to be able to

Re: [R] Using assign with mapply

2013-12-19 Thread Julio Sergio Santana
Greg Snow 538280 at gmail.com writes: The take home message that you should be learning from your struggles is to Not Use The 'assign' Function! and Do Not Use Global Variables Like This. R has lists (and environments) that make working with objects that are associated with each other

Re: [R] creating list of variables description

2013-12-19 Thread C Lin
Sorry the link should be this one:http://www.thearda.com/pals/researchers/VARIABLE_DESCRIPT_LIST%20-%20public.pdf From: bac...@hotmail.com To: r-help@r-project.org Date: Thu, 19 Dec 2013 13:20:54 -0500 Subject: [R] creating list of variables description Dear R-users, Can someone

[R] Inconsistent computation of an integral

2013-12-19 Thread Aurélien Philippot
Dear R experts, I computed the same integral in two different ways, and find different values in R. The difference is due to the max function that is part of the integrand. In the first case, I keep it as such, in the second case, I split it in two depending on the values of the variable of

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread Simon Kiss
Hello Bill, that is fantastic and it's quite a bit above what I could write. Is there a way to make the model type an argument to the function so that you can specify whether one is running glm, lm and such? I tried to modify it by inserting an argument modelType below, but that doesn't work.

Re: [R] creating list of variables description

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 10:20 AM, C Lin wrote: Dear R-users, Can someone suggest a good way to keep a list of variables description in R? Something to provide more detailed information on the variables that I have. Kind of like this list:

[R] A function which is a sum of other functions...

2013-12-19 Thread Onur Uncu
Dear R Users I have a list of functions. Each function in the list is a function of single variable. I would like to create a function (of one variable) which represents the sum of all the functions in the list. So, if the functions in my list are f1(x),..,f5(x) then I would like a new

Re: [R] Inconsistent computation of an integral

2013-12-19 Thread William Dunlap
I think you want to use pmax(x-50, 0), which returns a vector the length of x, instead of max(x-50,0), which returns a scalar. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread William Dunlap
call[[1]] - quote(modelType) # ' makes call[[1]] the same as as.name(modelType). You want as.name(modelType). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: Simon Kiss [mailto:sjk...@gmail.com] Sent: Thursday, December 19, 2013

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 11:10 AM, William Dunlap wrote: call[[1]] - quote(modelType) # ' makes call[[1]] the same as as.name(modelType). You want as.name(modelType). Just so I can see if I understand ... that is because `as.name` will evaluate `modelType` whereas

Re: [R] A function which is a sum of other functions...

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 11:05 AM, Onur Uncu wrote: Dear R Users I have a list of functions. Each function in the list is a function of single variable. I would like to create a function (of one variable) which represents the sum of all the functions in the list. So, if the functions in

Re: [R] A function which is a sum of other functions...

2013-12-19 Thread William Dunlap
List - list(abs, function(x)x*10, function(x)x*100) f - function(x)Reduce(`+`, lapply(List, function(func)func(x))) f(-1:2) [1] -1090 111 222 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 11:30 AM, David Winsemius wrote: On Dec 19, 2013, at 11:10 AM, William Dunlap wrote: call[[1]] - quote(modelType) # ' makes call[[1]] the same as as.name(modelType). You want as.name(modelType). Just so I can see if I understand ... that is because

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread William Dunlap
Just so I can see if I understand ... that is because `as.name` will evaluate `modelType` whereas as.name(modelType) would look for the function `modelType` and not find such a name in the namespace? Almost. as.name(modelType) will evaluate modelType so modelType could be a character

Re: [R] A function which is a sum of other functions...

2013-12-19 Thread William Dunlap
List - list(abs, function(x)x*10, function(x)x*100) f - function(x)Reduce(`+`, lapply(List, function(func)func(x))) f(-1:2) [1] -1090 111 222 In that formulation lapply() applies each function in List to x, returning a list of vectors containing the results (run it outside of

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread David Winsemius
On Dec 19, 2013, at 11:45 AM, William Dunlap wrote: Just so I can see if I understand ... that is because `as.name` will evaluate `modelType` whereas as.name(modelType) would look for the function `modelType` and not find such a name in the namespace? Almost. as.name(modelType) will

[R] pixel based percentile among rasters

2013-12-19 Thread Parks, Sean -FS
Hi, Say I have 1000 rasters, or a raster stack composed of 1000 rasters. I am interested in knowing the percentile for each pixel among these 1000 rasters. The result would be 1000 rasters, each depicting the percentile value of each pixel among the 1000 original rasters. Can anyone please

Re: [R] multicore and mclapply problem in calculation server

2013-12-19 Thread p_connolly
On Wed, 18-Dec-2013 at 09:28AM +0100, Juan Antonio Balbuena wrote: | |Hello |I am using package multicore for parallel computing in a Altix UltraViolet |1000 server with 64 CPUs and 960 GB of RAM memory. Access is managed by |means of a SGE queue system. This is the first time

[R] hist() : is there a way to change the border width?

2013-12-19 Thread capricy gao
I have played around with it and found that the only color could be changed. But I really would like to change the width... Thanks a lot :) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread Simon Kiss
Hi there: Just to tie this altogether. Here is the final function f- function (modelType, responseName, predictorNames, data, ..., envir = parent.frame()) { call - match.call() call$formula - formula(envir = envir, paste(responseName, sep = ~ ,

Re: [R] Help using mapply to run multiple models

2013-12-19 Thread William Dunlap
I do get this error: Error in glm.control(modelType = glm) : unused argument(s) (modelType = glm) Add the line call$modelType - NULL # omit modelType argument to your function. Otherwise f(glm, ...) makes the call glm(modelType=glm, ...) where you want it to make the call

Re: [R] read .slk file

2013-12-19 Thread Santosh
Dear Rxperts.. Thanks for your response... Will keep you posted. Santosh On Thu, Dec 19, 2013 at 10:06 AM, David Winsemius dwinsem...@comcast.netwrote: On Dec 16, 2013, at 3:10 PM, Santosh wrote: Dear Rxperts.. I recently received a data file with the extension .slk. If I save the

[R] spending most of my time in assignments?

2013-12-19 Thread Ross Boylan
My code seems to be spending most of its time in assignment statements, in some cases simple assignment of a model frame or model matrix. Can anyone provide any insights into what's going on, or how to speed things up? For starters, is it possible that the reports are not accurate, or that I am

[R] Searching the help archives - 404 error?

2013-12-19 Thread Simon Kiss
I'm using Mac OS 10.8.5, Chrome 31 and Safari 6.1. Recently, when entering anything into the search box here: http://tolstoy.newcastle.edu.au/R/ I get this response when searching using either Chrome or Safari: 404. That’s an error. The requested URL /u/newcastlemaths?q=rprofilesa=Google+Search

[R] Color With a Function

2013-12-19 Thread bradford
I use ggplot2 a lot and am wondering why I can't just color with a function? For example, if value 0 then use red else use green. How would you guys suggest to color these bar graphs so that positive is green and negative is red? ggplot(melt(df,measure.vars=c(data1, data2, data3, data4)),

Re: [R] Searching the help archives - 404 error?

2013-12-19 Thread Jeff Newmiller
There is no the help archives... there are numerous archives, some of which are not of the same quality as others. You might have better luck following the link included in the footer of every email from this list: https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] spending most of my time in assignments?

2013-12-19 Thread Duncan Murdoch
On 13-12-19 6:37 PM, Ross Boylan wrote: My code seems to be spending most of its time in assignment statements, in some cases simple assignment of a model frame or model matrix. Can anyone provide any insights into what's going on, or how to speed things up? You are seeing a lot of time being

Re: [R] Color With a Function

2013-12-19 Thread Jeff Newmiller
Design questions (why...) should go to the package maintainer. You need to learn to ask complete questions [1] and post in plain text rather than HTML on this list. I think that normal practice is to add a factor column that reflects the coloring you want, and then reference it. E.g.:

[R] Fitting particle size analysis data

2013-12-19 Thread Zorig Davaanyam
Hi all, How do you fit a sieve analysis data to a statistical function? I have many sieve analysis data of crushed rocks and I'd like to find out which statistical distributions describe the particular particle size distributions (PSD) the best. So basically I need to find fitted parameters to

Re: [R] hist() : is there a way to change the border width?

2013-12-19 Thread Jim Lemon
On 12/20/2013 08:19 AM, capricy gao wrote: I have played around with it and found that the only color could be changed. But I really would like to change the width... Hi Capricy, Try this on the first example for hist: hist(islands) par(lwd=3) hist(islands) Jim

Re: [R] Color With a Function

2013-12-19 Thread Jim Lemon
On 12/20/2013 10:38 AM, bradford wrote: I use ggplot2 a lot and am wondering why I can't just color with a function? For example, if value 0 then use red else use green. How would you guys suggest to color these bar graphs so that positive is green and negative is red?

[R] Strange subvector output -- x[n] != x[1:n][n]

2013-12-19 Thread Gewart
Hi, Can anyone explain what is going on...!? For a vector x=seq(min,max,0.01), when generating sub-vector a based on a starting value st, things go as expected as long as st is not too close to the beginning of x. For example, if x starts at -5 and increments by 0.01, whenever I try to generate

Re: [R] Strange subvector output -- x[n] != x[1:n][n]

2013-12-19 Thread Jeff Newmiller
Sigh. Google couldn't help you? Try FAQ 7.31 and then use non-fractions to generate sequences... scale as desired. This is not unique to R. --- Jeff NewmillerThe . . Go Live...