Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
well, figured it out, apparently placing the bquote results in a vector doesn't result in a vector of expressions, so you have to coerce it like so: dev.new() plot.new() plot.window(xlim = c(0, 1), ylim = c(0, 1)) legend("topleft", legend = bquote(paste("foo bar ", R^2 == .(2^2))), fill = "red") l

Re: [R] How to automatically restart nlme in a user-defined function

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 11:39 PM, Jun Shen wrote: Hi, everyone, I wrote a function, which includes an nlme estimation. The problem is sometimes nlme may not converge due to too many random effects. Say a, b are two parameters. if I specify random effects by: random = a+b~1, nlme fails to conver

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 11:22 PM, David Winsemius wrote: On Jul 10, 2010, at 10:45 PM, David Winsemius wrote: On Jul 10, 2010, at 8:58 PM, Murat Tasan wrote: hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here'

Re: [R] Passing a LaTeX length to Sweave

2010-07-10 Thread Thomas Levine
Darn. Well here's what I'll do %Preamble <>= columnwidth=whatever the \columnwidth is @ %Figures \setkeys{Gin}{width=\columnwidth} <>= plot(y~x) @ It needs to be exact so that the line weight and point size are consistent across figures and with the text. 2010/7/10 Duncan Murdoch : > On 10/07/2

[R] How to automatically restart nlme in a user-defined function

2010-07-10 Thread Jun Shen
Hi, everyone, I wrote a function, which includes an nlme estimation. The problem is sometimes nlme may not converge due to too many random effects. Say a, b are two parameters. if I specify random effects by: random = a+b~1, nlme fails to converge. Then I have to constrain the random effects i

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
ok, here's a self-contained example. topleft legend will plot 1 example of exactly what i want, but only 1 line. bottomleft legend will plot what i had hoped would work... as it's the logical extension of the topleft example to two cases. dev.new() plot.new() plot.window(xlim = c(0, 1), ylim = c(

Re: [R] eliminating constant variables

2010-07-10 Thread pdb
Awsome! It made sense once I realised SD=standard deviation ! pdb -- View this message in context: http://r.789695.n4.nabble.com/eliminating-constant-variables-tp2284831p2284915.html Sent from the R help mailing list archive at Nabble.com. __ R-help

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 10:45 PM, David Winsemius wrote: On Jul 10, 2010, at 8:58 PM, Murat Tasan wrote: hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here's a working legend(...) call that is close to what i'd l

Re: [R] difficulty with R expressions in text/legend

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 8:58 PM, Murat Tasan wrote: hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here's a working legend(...) call that is close to what i'd like (where x and y are returned from an lm(...) call):

Re: [R] contourplot by year

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 5:58 PM, Sally_roman wrote: Hi - I have a dataframe with 4 variables - long, lat, temp and year. I would like to plot temperature by lat and long in contour plots by year. There are 391 data points. When I try contourplot(temp~long*lat|year,data=hake,cuts=10,labels

[R] difficulty with R expressions in text/legend

2010-07-10 Thread Murat Tasan
hi, i'm trying to prepend some plain (i.e. unevalutated) text to a typographically evaluated R expression in a legend(...) call. here's a working legend(...) call that is close to what i'd like (where x and y are returned from an lm(...) call): legend("topleft", legend = c(bquote(R^2 == .(summary

Re: [R] Passing a LaTeX length to Sweave

2010-07-10 Thread Duncan Murdoch
On 10/07/2010 10:35 AM, Thomas Levine wrote: I'd really love to do this \setkeys{Gin}{width=\columnwidth} <>= plot(y~x) @ The \columnwidth macro does not work, of course, in the second line. What can I do instead? Pass a number. As long as it's reasonably close to the truth the graphs wi

Re: [R] Not nice behaviour of nlminb (windows 32 bit, version 2.11.1)

2010-07-10 Thread Duncan Murdoch
On 10/07/2010 7:32 PM, Ravi Varadhan wrote: Hi, The best solution would be to identify where the problem is in the FORTRAN code and correct it. However, this problem of premature termination due to absolute function convergence is highly unlikely to occur in practice. As John Nash noted, th

Re: [R] package installation for Windows 7

2010-07-10 Thread Duncan Murdoch
On 10/07/2010 10:37 AM, David Bickel wrote: Thank you, Prof. Murdoch. I have this: > .libPaths() [1] "\\Users\\dbickel/R/win-library/2.11" "C:/R/R-2.11.1/library" That first path doesn't look like it would work in Windows: it has no drive letter, so its meaning will depend on the driver

Re: [R] eliminating constant variables

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 6:28 PM, pdb wrote: > > Hi all, > > I have a large data set and want to immediately build a 'blind' model > without first examining the data. Now it appears in the data there are a lot > of fields that are constant or all missing values - which prevents the model > from bei

Re: [R] eliminating constant variables

2010-07-10 Thread pdb
Yep - that is what I want. Cheers Jim you Legend. -- View this message in context: http://r.789695.n4.nabble.com/eliminating-constant-variables-tp2284831p2284861.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

Re: [R] eliminating constant variables

2010-07-10 Thread jim holtman
Is this what you want: > test <- data.frame(a=runif(10), b=rep(NA, 10), c=rep(3,10), d=runif(10)) > test a b c d 1 0.3390729 NA 3 0.4346595 2 0.8394404 NA 3 0.7125147 3 0.3466835 NA 3 0.344 4 0.3337749 NA 3 0.3253522 5 0.4763512 NA 3 0.7570871 6 0.8921983 NA 3 0.20269

Re: [R] eliminating constant variables

2010-07-10 Thread pdb
Hi Jim, Thanks for your response, although I was probably not clear about exactly what I want to achieve, please let me see if I can explain a little better... There are certain (unknown) columns in my data that contain either NULL in every row, or the same value in every row (eg '1'). These co

Re: [R] Not nice behaviour of nlminb (windows 32 bit, version 2.11.1)

2010-07-10 Thread Ravi Varadhan
Hi, The best solution would be to identify where the problem is in the FORTRAN code and correct it. However, this problem of premature termination due to absolute function convergence is highly unlikely to occur in practice. As John Nash noted, this is going to be highly unlikely for multi-di

Re: [R] eliminating constant variables

2010-07-10 Thread jim holtman
You can remove NAs with: train <- subset(train, !is.na(TargetVariable)) I am not sure what you mean by constant values. You could use 'table' to determine which values appear the most and then remove them: x <- table(train$TargetVariable) train <- subset(train, !(TargetVariable %in% names(x)[x

[R] contourplot by year

2010-07-10 Thread Sally_roman
Hi - I have a dataframe with 4 variables - long, lat, temp and year. I would like to plot temperature by lat and long in contour plots by year. There are 391 data points. When I try contourplot(temp~long*lat|year,data=hake,cuts=10,labels = TRUE,contour = TRUE,pretty = TRUE,region=TRUE) I get

[R] eliminating constant variables

2010-07-10 Thread pdb
Hi all, I have a large data set and want to immediately build a 'blind' model without first examining the data. Now it appears in the data there are a lot of fields that are constant or all missing values - which prevents the model from being built. Can someone point me the right direction as to

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread stephen sefick
I don't have tinnR to test - I would suspect that this is possible, but I may be naive. 2010/7/10 Leandro Marino : > What I was trying to say is that TINNR has a possibility to connect to R on > a server. I want to know if its possible to have the r in a server with > ubuntu and use it from the TI

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread Leandro Marino
What I was trying to say is that TINNR has a possibility to connect to R on a server. I want to know if its possible to have the r in a server with ubuntu and use it from the TINNR software. Sent from my mobile. Att, Leandro Marino http://www.leandromarino.com.br (Fotógrafo) http://est.leandroma

Re: [R] apply is slower than for loop?

2010-07-10 Thread Gene Leynes
Yes, that's actually quite helpful. I think this gets to the point that Patrick Burns was making in Ch. 4 of the Inferno book. I think the "sapply" is breaking the problem into chunks that make it more efficient. This is a prototype of a function that I will probably use quite often, so it's wor

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread Vojtěch Zeisek
Hello, well, if You wish, You can always write scripts in R and then send it to Ubuntu server, but it is too complicated. Tinn-R is Windows only, but Rkward is IMHO much more better. You can not work in Windows in Tinn-R and send it directly to R running on remote Linux server. Best regards, Voj

Re: [R] Passing a LaTeX length to Sweave

2010-07-10 Thread Sharpie
Thomas Levine wrote: > > I'd really love to do this > > \setkeys{Gin}{width=\columnwidth} > <>= > plot(y~x) > @ > > The \columnwidth macro does not work, of course, in the second line. > What can I do instead? > This may be difficult as there is no two-way communication between R and LaTeX i

[R] SVD in microarray

2010-07-10 Thread chen chao
Hi, I want to use singular value decompositions (SVD) to remove some artifacts in my microarray data. what i do is replacing the first eigenvalue to zero: library(MASS) data <- as.matrix(read.table("data.txt", header=TRUE,row.names=1, sep = "\t", as.is = TRUE)) a.svd <- svd(data) length(a.svd$d)

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:17 PM, Gabor Grothendieck wrote: > On Sat, Jul 10, 2010 at 3:34 PM, Bogaso Christofer > wrote: >> Thanks Gabor for your input. However my question is, is your solution >> general for any value of "a" and "b?" >> > > #1 and #2 are general. > > For #3 I think there is a po

Re: [R] accessing return variables from a function

2010-07-10 Thread Noah Silverman
Thanks! -N On 7/9/10 2:20 AM, Noah Silverman wrote: > Hi, > > I am trying to figure out a "short" way to access two values output from > the sort function. > > >> x <- c(3,4,3,6,78,3,1,2) >> sort(x, index.return=T) >> > $x > [1] 1 2 3 3 3 4 6 78 > > $ix > [1] 7 8 1 3 6 2 4 5 > > >

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread Cedrick W. Johnson
You can do that, as well as install RKWard if you want a "gui" front end and use ssh/x11 forwarding. If I think what you want to do is control a remote ubuntu instance via windows using Tinn, I don't think that is possible. You could look into Rserve/etc and possibly try to go that route as wel

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread Vojtěch Zeisek
Hi Dne Sat 10. of July 2010 20:46:33 Leandro Marino napsal(a): > *Hi, > > I want to know how can I configure R in a Ubuntu to be a server. > > I am planning to use R in a Windows machine with Tinn-R, but I want R > running at an Ubuntu Lucid machine. > > How can i do this? Install Ubuntu and s

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:34 PM, Bogaso Christofer wrote: > Thanks Gabor for your input. However my question is, is your solution > general for any value of "a" and "b?" > #1 and #2 are general. For #3 I think there is a possibility you might in general have to do the same tricks as #1 and #2 bu

Re: [R] getting data from table command

2010-07-10 Thread Linlin Yan
> d <- 1:4 > f <- c(2,3,3,1) > rep(d,f) [1] 1 1 2 2 2 3 3 3 4 On Sat, Jul 10, 2010 at 10:55 PM, nn roh wrote: > Hi, > > I have a question relating to R package > > If i  have the frequencies of data   how i can get the data  as following : > > 1 2 3 4      data > 2 3  3 1      frequency > > Whic

Re: [R] Need help on date calculation

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 3:17 PM, Bogaso Christofer wrote: Hi all, please see my code: library(zoo) a <- as.yearmon("March-2010", "%B-%Y") b <- as.yearmon("May-2010", "%B-%Y") nn <- (b-a)*12 # number of months in between them nn [1] 2 as.integer(nn) [1] 1 What is the correct way to find

Re: [R] Need help on date calculation

2010-07-10 Thread Bogaso Christofer
Thanks Gabor for your input. However my question is, is your solution general for any value of "a" and "b?" -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: 11 July 2010 00:42 To: Bogaso Christofer Cc: r-help@r-project.org Subject: Re: [R] Need help on da

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:07 PM, Gabor Grothendieck wrote: > On Sat, Jul 10, 2010 at 3:17 PM, Bogaso Christofer > wrote: >> Hi all, please see my code: >> >> >> >>> library(zoo) >> >>> a <- as.yearmon("March-2010", "%B-%Y") >> >>> b <- as.yearmon("May-2010", "%B-%Y") >> >>> >> >>> nn <- (b-a)*12

Re: [R] Need help on date calculation

2010-07-10 Thread Gabor Grothendieck
On Sat, Jul 10, 2010 at 3:17 PM, Bogaso Christofer wrote: > Hi all, please see my code: > > > >> library(zoo) > >> a <- as.yearmon("March-2010", "%B-%Y") > >> b <- as.yearmon("May-2010", "%B-%Y") > >> > >> nn <- (b-a)*12   # number of months in between them > >> nn > > [1] 2 > >> as.integer(nn) >

Re: [R] Using Ubuntu as a Server

2010-07-10 Thread stephen sefick
Do you mean just installing R on a server? I have R installed onto a server. I ssh -X ... and everything works just fine. On Sat, Jul 10, 2010 at 1:46 PM, Leandro Marino wrote: > *Hi, > > I want to know how can I configure R in a Ubuntu to be a server. > > I am planning to use R in a Windows ma

Re: [R] getting data from table command

2010-07-10 Thread jim holtman
Is this what you want: > x <- c(1,2,2,2,3,3,3,4,4,5) > z <- table(x) > z x 1 2 3 4 5 1 3 3 2 1 > as.integer(rep(names(z), z)) [1] 1 2 2 2 3 3 3 4 4 5 > On Sat, Jul 10, 2010 at 10:55 AM, nn roh wrote: > Hi, > > I have a question relating to R package > > If i  have the frequencies of data   how

[R] Need help on date calculation

2010-07-10 Thread Bogaso Christofer
Hi all, please see my code: > library(zoo) > a <- as.yearmon("March-2010", "%B-%Y") > b <- as.yearmon("May-2010", "%B-%Y") > > nn <- (b-a)*12 # number of months in between them > nn [1] 2 > as.integer(nn) [1] 1 What is the correct way to find the number of months between "a" and

[R] getting data from table command

2010-07-10 Thread nn roh
Hi, I have a question relating to R package If i have the frequencies of data how i can get the data as following : 1 2 3 4 data 2 3 3 1 frequency Which command i can use to get the data set in the above example should be 1 1 2 2 2 3 3 3 4 Thanks Nada [[alternati

Re: [R] R-help Digest, Vol 89, Issue 10

2010-07-10 Thread mat
Raghu Those packages are still not on CRAN. You can download the current version from R-forge: *|install.packages("blotter", repos="http://R-Forge.R-project.org";) Mat |* Le 10. 07. 10 12:00, r-help-requ...@r-project.org a écrit : > Message: 137 > Date: Sat, 10 Jul 2010 08:32:38 +0100 > From:

[R] getting data from table command

2010-07-10 Thread nn roh
Hi, I have a question relating to R package If i have the frequencies of data as following 1 2 3 4 data 2 3 3 1 frequency Which command i can use to get the data set in the above example should be 1 2 3 4 Thanks Nada [[alternative HTML version deleted]]

[R] Using Ubuntu as a Server

2010-07-10 Thread Leandro Marino
*Hi, I want to know how can I configure R in a Ubuntu to be a server. I am planning to use R in a Windows machine with Tinn-R, but I want R running at an Ubuntu Lucid machine. How can i do this? *Atenciosamente, Leandro Marino http://est.leandromarino.com.br/Blog (Estatístico) Cel.: + 55 21 98

[R] a very particular plot

2010-07-10 Thread Ian Bentley
Hi all, Thanks for the really great help I've received on this board in the past. I have a very particular graph that I'm trying to plot, and I'm not really sure how to do it. I think I should be able to use ggplot for this, but I'm not really sure how. I have a data.frame which contains fifty

Re: [R] quantstrat and blotter unavailable

2010-07-10 Thread Uwe Ligges
On 10.07.2010 15:59, David Winsemius wrote: On Jul 10, 2010, at 3:32 AM, Raghu wrote: These packages were not available. Are these the only places to go for backtesting technical trading systems other than ttrTests pls? Is it possible that your install packages default for your unnamed OS

Re: [R] Check Dates

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 9:42 AM, nvanzuy...@gmail.com wrote: Dear Kevin, Assuming that closure and referral are two columns in your df and you have already converted them to date columns. The following should work: df$Dec04<- ifelse(df$referral <"2005-01-01" & df$closure > "2003-12-31" | d

Re: [R] package installation for Windows 7

2010-07-10 Thread David Bickel
Thank you, Prof. Murdoch. I have this: > .libPaths() [1] "\\Users\\dbickel/R/win-library/2.11" "C:/R/R-2.11.1/library" Since the following naive line in the profile failed, I just moved the new packages to the same directory as the default packages. .libPaths(c("C:/Users/dbickel/R/win-library

[R] Passing a LaTeX length to Sweave

2010-07-10 Thread Thomas Levine
I'd really love to do this \setkeys{Gin}{width=\columnwidth} <>= plot(y~x) @ The \columnwidth macro does not work, of course, in the second line. What can I do instead? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help P

Re: [R] Check Dates

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 9:29 AM, Wang, Kevin (SYD) wrote: Hi, I'm trying to check a column of dates and creating indicator variables showing different time periods. For example, if I were to do this in Excel I would have something like: Year to Dec 2004=IF(AND(referral datedate>DATE(2003,1

Re: [R] quantstrat and blotter unavailable

2010-07-10 Thread David Winsemius
On Jul 10, 2010, at 3:32 AM, Raghu wrote: These packages were not available. Are these the only places to go for backtesting technical trading systems other than ttrTests pls? Is it possible that your install packages default for your unnamed OS is binary or win-binary and that these packag

[R] Not nice behaviour of nlminb (windows 32 bit, version, 2.11.1)

2010-07-10 Thread Prof. John C Nash
I won't add to the quite long discussion about the vagaries of nlminb, but will note that over a long period of software work in this optimization area I've found a number of programs and packages that do strange things when the objective is a function of a single parameter. Some methods quite e

Re: [R] apply is slower than for loop?

2010-07-10 Thread Allan Engelhardt
On 09/07/10 21:19, Duncan Murdoch wrote: On 09/07/2010 4:11 PM, Gene Leynes wrote: I thought the "apply" functions are faster than for loops, but my most recent test shows that apply actually takes a significantly longer than a for loop. Am I missing something? Probably not. apply() need

Re: [R] Check Dates

2010-07-10 Thread nvanzuydam
Dear Kevin, Assuming that closure and referral are two columns in your df and you have already converted them to date columns. The following should work: df$Dec04<- ifelse(df$referral <"2005-01-01" & df$closure > "2003-12-31" | df$closure== "", "Yes", "No") if you are trying to account for

[R] Check Dates

2010-07-10 Thread Wang, Kevin (SYD)
Hi, I'm trying to check a column of dates and creating indicator variables showing different time periods. For example, if I were to do this in Excel I would have something like: Year to Dec 2004=IF(AND(referral dateDATE(2003,12,31), LEN($closure date) = 0)), "Yes", "No") for the "Year to Dec

Re: [R] package installation for Windows 7

2010-07-10 Thread Duncan Murdoch
David Bickel wrote: Now that I have installed R outside "Program files" to get past the permissions problem, there are packages I can only access from certain working directories: setwd("U:/Calc/zTemp") # "U:" points to a USB hard drive library(splines) # ok library(locfdr) Error in l

Re: [R] package installation for Windows 7

2010-07-10 Thread David Bickel
Now that I have installed R outside "Program files" to get past the permissions problem, there are packages I can only access from certain working directories: > setwd("U:/Calc/zTemp") # "U:" points to a USB hard drive > library(splines) # ok > library(locfdr) Error in library(locfdr) : there is

Re: [R] Not nice behaviour of nlminb (windows 32 bit, version 2.11.1)

2010-07-10 Thread Duncan Murdoch
Ravi Varadhan wrote: Hi, The absolute function stopping criterion is not meant for any positive objective function. It is meant for functions whose minimum is 0. Here is what David Gay's documentation from PORT says: "6 - absolute function convergence: |f (x)| < V(AFCTOL) = V(31). This tes

[R] quantstrat and blotter unavailable

2010-07-10 Thread Raghu
These packages were not available. Are these the only places to go for backtesting technical trading systems other than ttrTests pls? > install.packages("quantstrat", repos="http://R-Forge.R-project.org";) Warning in install.packages("quantstrat", repos = " http://R-Forge.R-project.org";) : arg

Re: [R] how to plot two histograms overlapped in the same plane coordinate

2010-07-10 Thread Jim Lemon
On 07/09/2010 11:29 PM, Mao Jianfeng wrote: Dear R-help listers, I am new. I just want to get helps on how to plot two histograms overlapped in the same plane coordinate. What I did is very ugly. Could you please help me to improve it? I want to got a plot with semi- transparent overlapping regi