Re: [R] MCP solver

2013-10-13 Thread Hans W Borchers
Maxwell, John McFarland jmmaxwell at wsu.edu writes: Hello, I'm trying to find a solver that will work for the mixed complementarity problem (MCP). I've searched the CRAN task view page on optimization and mathematical programming as well as many google searches to no avail. Does anyone

[R] Hungarian R User's Group: ggplot2 - The Grammar of Graphics

2013-10-13 Thread Gergely Daróczi
Dear useRs, I am more than happy to announce the next meeting of the Hungarian RUG that will take place on the 24th of October, and Zoltán Tóth, senior data engineer at Prezi.com, will speak about Hadley's awesome ggplot2 package. More details (HUN):

Re: [R] lmerTest

2013-10-13 Thread Uwe Ligges
On 13.10.2013 02:52, srecko joksimovic wrote: ok, ok... thanks. I'll try with R-sig-ME Or for short, you are trying to estimate more coefficients than you have degrees of freedom which is what rank of X = 1660 ncol(X) = 1895 tries to tell us. Best, Uwe Ligges On Sat, Oct 12, 2013 at

Re: [R] matrix values linked to vector index

2013-10-13 Thread Christoph Häni
Just a further suggestion: vec - c(3,2,5,0,1) mat - t(sapply(vec,=,1:max(vec))) ifelse(mat,1,0) Cheers, Christoph 2013/10/11 arun smartpink...@yahoo.com: Hi, In the example you showed: m1- matrix(0,length(vec),max(vec)) 1*!upper.tri(m1) #or m1[!upper.tri(m1)] -

Re: [R] matrix values linked to vector index

2013-10-13 Thread arun
Also: mat+0 #or mat*1 #However, sapply() based solutions would be slower in large matrices. #Speed makeMat3 - function(x,n){     if(is.numeric(x)){ x - as.integer(round(x)) x} stopifnot(is.integer(x)) if(length(x)=n max(x)=n){ indx-rep(rep(c(1,0),max(length(x),n)),rbind(x,n-x)) m1- 

Re: [R] lmerTest

2013-10-13 Thread srecko joksimovic
Thanks Uwe, I wasn't quite sure about that one... when I build model with that particular variable, that is what happen. have to check why... Best, Srecko On Sun, Oct 13, 2013 at 5:45 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 13.10.2013 02:52, srecko joksimovic wrote: ok,

Re: [R] [Urgent]replace several rows in matrix with a vector

2013-10-13 Thread arun
Hi, Try: a - matrix(0,100,3) a1- a a2 - a somerows- 1:5 b1- t(replicate(length(somerows),b))  a[somerows,]- b1 head(a) #or  b2- rep(b,each=length(somerows))  a1[somerows,]- b2 head(a1)  identical(a,a1) #[1] TRUE  somerows2- c(2,4,7,8,11,14)  b3 - rep(b,each=length(somerows2))  a2[somerows2,] -

[R] RODBC not connecting from my Mac

2013-10-13 Thread Mikkel Grum
iODBC appears no longer to come standard with OSX, so I installed unixodbc and set it up following instructions here:  http://www.boriel.com/en/2013/01/16/postgresql-odbc-connection-from-mac-os-x/ I connected to my remote database with isql -v mydsn. No problem. Then I tried from R:

[R] How can I use a script l (LaTeX \ell) in mathematical annotation of plots?

2013-10-13 Thread Byron Dom
Due to convention a script l - $$\ell$$ (LaTeX \ell) is used to represent a certain quantity in something I'm working on. I'm unable to figure out how to use it in R. It's not included in the list on ?plotmath.  Can anyone tell me how to use it?  Its unicode is U+2113. This page has a list of

Re: [R] How can I use a script l (LaTeX \ell) in mathematical annotation of plots?

2013-10-13 Thread Prof Brian Ripley
On 13/10/2013 18:53, Byron Dom wrote: Due to convention a script l - $$\ell$$ (LaTeX \ell) is used to represent a certain quantity in something I'm working on. I'm unable to figure out how to use it in R. It's not included in the list on ?plotmath. Can anyone tell me how to use it? Its

[R] using a variable for a column name in a formula

2013-10-13 Thread David Epstein
lm(height ~ ., data=X) works fine. However nnn - height ; lm(nnn ~ . ,data=X) fails How do I write such a formula, which depends on the value of a string variable like nnn above? A typical application might be a program that takes a data frame containing only numerical data, and figures out

Re: [R] using a variable for a column name in a formula

2013-10-13 Thread Sarah Goslee
This being R, there are likely other ways, but I use: lm(as.formula(paste(nnn, ~ .)),data=X) Sarah On Sun, Oct 13, 2013 at 5:04 PM, David Epstein david.epst...@warwick.ac.uk wrote: lm(height ~ ., data=X) works fine. However nnn - height ; lm(nnn ~ . ,data=X) fails How do I write such

Re: [R] using a variable for a column name in a formula

2013-10-13 Thread arun
Hi, May be: set.seed(24)  X - data.frame(weight=sample(100:250,20,replace=TRUE),height=sample(140:190,20,replace=TRUE)) Others - colnames(X)[!colnames(X)%in%height]  nnn - height res - lm(formula(paste(nnn,~,paste(Others, sep=+))),data=X)  res1- lm(height~.,data=X) #or res2-

Re: [R] using a variable for a column name in a formula

2013-10-13 Thread arun
Sorry, a mistake in the code: #should be collapse instead of sep res - lm(formula(paste(nnn,~,paste(Others, collapse=+))),data=X) A.K. On Sunday, October 13, 2013 5:55 PM, arun smartpink...@yahoo.com wrote: Hi, May be: set.seed(24)  X -

Re: [R] using a variable for a column name in a formula

2013-10-13 Thread p_connolly
On 2013-10-14 10:04, David Epstein wrote: lm(height ~ ., data=X) works fine. However nnn - height ; lm(nnn ~ . ,data=X) fails How do I write such a formula, which depends on the value of a string variable like nnn above? as.formula() with paste() could work, but from where you are now, try

Re: [R] Loop over factor returns NA

2013-10-13 Thread Mikkel Grum
You'll need to tell us what class you time variable is in, e.g. the output of str(AB), but the following might work: for (i in unique(as.character(AB$time)) { Intervall - AB[as.character(AB$time) ==i, ] ... } Depending on the format, as.numeric( ) might work too. Regards Mikkel On Saturday,

Re: [R] using a variable for a column name in a formula

2013-10-13 Thread arun
Hi, I am getting this: #Using an example dataset: set.seed(24)  X - data.frame(weight=sample(100:250,20,replace=TRUE),height=sample(140:190,20,replace=TRUE)) nnn - height res - lm(as.formula(paste(nnn, ~.)),data=X)  res2 - lm(get(nnn) ~ . ,data=X)  coef(res)  (Intercept)   weight

Re: [R] Looping over names of multiple data frames in an R for() loop XXXX

2013-10-13 Thread Mikkel Grum
You might want to try: assign(d[1], read.csv(yourfile.csv)) ... write.csv(d1, yourfile.csv, append = FALSE) Regards Mikkel On Friday, October 11, 2013 2:53 PM, Dan Abner dan.abne...@gmail.com wrote: Hi everybody, I thought I was using the get() fn correctly here to loop over multiple data

[R] RODBC on Mac

2013-10-13 Thread Mikkel Grum
iODBC appears no longer to come standard with OSX, so I installed unixodbc and set it up following instructions here:  http://www.boriel.com/en/2013/01/16/postgresql-odbc-connection-from-mac-os-x/ I connected to my remote database with isql -v mydsn. No problem. Then I tried from R:

Re: [R] Loop over factor returns NA

2013-10-13 Thread Mikkel Grum
You'll need to tell us what class you time variable is in, e.g. the output of str(AB), but the following might work: for (i in unique(as.character(AB$time)) { Intervall - AB[as.character(AB$time) ==i, ] ... } Depending on the format, as.numeric( ) might work too. Regards Mikkel On Saturday,

[R] ENMCA in EnQuireR problems!

2013-10-13 Thread longoc
Hello, I am a post-doc of the Federal University of Santa Catarina State (UFSC). Last year, used EnQuireR for hirarchical cluster analisis and end up very well. I formated my computer couple months ago and installed R again as version x64 3.0.2. have new data which ENMCA function of

Re: [R] Splitting times into groups based on a range of times

2013-10-13 Thread arun
Hi Ben, It looks like the condition is not met in majority of the split elements.  So, when you create a dataframe with the a column with 0 element and another column with an element, it shows the Error message. data.frame(dt2=NULL,group=1) #Error in data.frame(dt2 = NULL, group = 1) :  #

Re: [R] R plotting

2013-10-13 Thread Mikkel Grum
Hi This seems to work: spdata$color - ifelse(spdata$change 0, red, green) plot(spdata$date, log(spdata$close), col = spdata$color) Regards Mikkel On Friday, October 11, 2013 5:14 PM, Mubar simon.keu...@student.unisg.ch wrote: Hi I have a question regarding plots in R. I have data from the

[R] R help

2013-10-13 Thread Shameem Akhtar
Dear, I want to use for loop and if..else condition together for finding such value from a two column in a spreadsheet. Thanks Regards Shameem Akhtar [[alternative HTML version deleted]] __ R-help@r-project.org mailing list