[R] Elegant Code

2012-03-16 Thread Raphael Fraser
Hi, Can anyone help to write a more elegant version of my code? I am sure this can be put into a loop but I am having trouble creating the objects b1,b2,b3,...,etc. b1 - rigamma(50,1,1) theta1 - rgamma(50,0.5,(1/b1)) sim1 - rpois(50,theta1) b2 - rigamma(50,1,1) theta2 - rgamma(50,0.5,(1/b2))

[R] How to interpret glmnet lasso error

2012-03-16 Thread Ryan Zotti
I get an error when I try to use glmnet to fit a lasso model on some data. My code: lasso - glmnet(predictorPartitionTrainingM, targetPartitionTraining, alpha=1) The error that is returned: Error in elnet(x, is.sparse, ix, jx, y, weights, offset, type.gaussian, : NA/NaN/Inf in foreign

Re: [R] Generation of correlated variables

2012-03-16 Thread Petr Savicky
On Thu, Mar 15, 2012 at 11:23:28PM -, Ted Harding wrote: On 15-Mar-2012 Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all

Re: [R] Elegant Code

2012-03-16 Thread Berend Hasselman
On 16-03-2012, at 08:09, Raphael Fraser wrote: Hi, Can anyone help to write a more elegant version of my code? I am sure this can be put into a loop but I am having trouble creating the objects b1,b2,b3,...,etc. b1 - rigamma(50,1,1) theta1 - rgamma(50,0.5,(1/b1)) sim1 -

[R] Re : Elegant Code

2012-03-16 Thread Pascal Oettli
Hi Raphael, Something like that? require(pscl)sim - numeric() for(i in 1:5){   eval(parse(text=paste('b',i,' - rigamma(50,1,1)',sep='')))   eval(parse(text=paste('theta',i,' - rgamma(50,0.5,(1/b',i,'))',sep='')))   eval(parse(text=paste('sim',i,' - rpois(50,theta',1,')',sep='')))  

Re: [R] How to change the number of axis?

2012-03-16 Thread Jim Lemon
On 03/16/2012 01:28 AM, qiao xue wrote: Hi, I use R to plot a graph with 2 frames. Because the limit of pixel or others, the screen fail to show the graph. So I have to draw a point every 10 frames. So the total of x axis becomes 2000. So when imaging the picture, I still hope that the

Re: [R] Bar graph with 2 Y axis

2012-03-16 Thread Jim Lemon
On 03/16/2012 09:24 AM, KAYIS Seyit Ali wrote: Dear R users, I need to draw a barplot with 2 Y axis. I have 3 days each of wich having 2 groups (and error bar for each of them). The height of the 3rd day is too tall compared to others. That's why I have to use a second Y axis for that. I am

[R] ncd4 package

2012-03-16 Thread Amen
Hi I am using windows. I cant install ncdf4 package but it didn't work . any suggestions!! -- View this message in context: http://r.789695.n4.nabble.com/ncd4-package-tp4477496p4477496.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-16 Thread Bart6114
To visualize my problem a little; see this screenshot http://i40.tinypic.com/fodsm0.png http://i40.tinypic.com/fodsm0.png . So I would like factor level 4 to show up but without a bar (zero counts). Thanks -- View this message in context:

Re: [R] line plot over a barplot

2012-03-16 Thread Petr PIKAL
Hi Dear all, I have data in the following format : X-axisY-axis 010% 0-20 20% 20-4030% 40-6040% . and so on. I want to plot a bar graph of the above. Also I would want to add a trendline passing

Re: [R] ncd4 package

2012-03-16 Thread Stefan Luedtke
This one is for windows. http://cran.r-project.org/web/packages/RNetCDF/index.html but you need netcdf libraries and udunits libraries installed. http://cran.r-project.org/web/packages/RNetCDF/INSTALL Cheers See the On Fri, 2012-03-16 at 00:39 -0700, Amen wrote: Hi I am using

Re: [R] Re : Elegant Code

2012-03-16 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pascal Oettli Sent: Friday, March 16, 2012 12:36 AM To: Raphael Fraser Cc: r-help@r-project.org Subject: [R] Re : Elegant Code Hi Raphael, Something like that?

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-16 Thread R. Michael Weylandt
I can reproduce the OP's problem with ggplot 0.9.0 but I don't know how to solve it: perhaps you should take this to the ggplot2 mailing list: https://groups.google.com/group/ggplot2?pli=1 Michael On Fri, Mar 16, 2012 at 4:17 AM, Bart6114 bartsmeet...@gmail.com wrote: To visualize my problem a

[R] Change in behavior of update.views()?

2012-03-16 Thread Michael Kubovy
I haven't seen this cryptic warning before: update.views('Robust') Warning message: In update.views(Robust) : The following packages are not available: covRobust, distr, FRB, MASS, mblm, multinomRob, mvoutlier, quantreg, RandVar, rgam, RobAStBase, robfilter, RobLox, RobRex, robust, RobustAFT,

Re: [R] substituting own test statistics in a built-in function

2012-03-16 Thread Sarah Goslee
So then you need to find the code for those functions inside the source package you downloaded, and use it to make your own functions. The authors can't prevent you from seeing the code. Sarah On Mar 15, 2012 10:43 PM, Aparna Sampath aparna.sampat...@gmail.com wrote: Hi Sarah Goslee Thanking

Re: [R] Urgente: retiro de la lista

2012-03-16 Thread Martin Maechler
JB == Jaime Bernal-Hadad jaib...@yahoo.com on Thu, 15 Mar 2012 19:11:19 -0700 writes: JB Urgente JB Dedido al gran n�mero de correos recibidos que afectan seriamente mi trabajo, es urgente que me reitren de esta lista. JB Alguien me puede decir que debo hacer JB �

Re: [R] Timer on a function

2012-03-16 Thread Prof Brian Ripley
On Thu, 15 Mar 2012, Bert Gunter wrote: Bill et. al: 1. This is new to me. Thanks. 2. As I read the man page, this is not guaranteed to work if the model fitting function does not contain sufficient interrupts. Is that correct? Yes. If someone wrote a model fitting package in Fortran with

[R] multivariate regression and lm()

2012-03-16 Thread Ernest Lo
Hello, I would like to perform a multivariate regression analysis to model the relationship between m responses Y1, ... Ym and a single set of predictor variables X1, ..., Xr. Each response is assumed to follow its own regression model, and the error terms in each model can be correlated. Based

Re: [R] ncd4 package (really ncdf4)

2012-03-16 Thread Prof Brian Ripley
On Fri, 16 Mar 2012, Stefan Luedtke wrote: This one is for windows. http://cran.r-project.org/web/packages/RNetCDF/index.html but you need netcdf libraries and udunits libraries installed. http://cran.r-project.org/web/packages/RNetCDF/INSTALL Which are the non-Windows instructions. On

Re: [R] multivariate regression and lm()

2012-03-16 Thread John Fox
Dear Ernest, The ML estimator for the mulitvariate linear model assuming multinormal errors is the same as equation-by-equation LS, but multivariate tests performed for all of the responses on the resulting multivariate linear model object (e.g., by anova() or Anova() in the car package) will

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-16 Thread Helios de Rosario
You can tell that levels must not be dropped with scale_x_discrete(): library(ggplot2) mtcars$cyl-factor(mtcars$cyl) plot1 - ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar() plot1 + scale_x_discrete(drop=FALSE) Or explicitly set the values you want in the x axis with the argument limits:

Re: [R] ncd4 package (really ncdf4)

2012-03-16 Thread Stefan Luedtke
sorry, I did not know that, thanks! On Fri, 2012-03-16 at 11:35 +, Prof Brian Ripley wrote: On Fri, 16 Mar 2012, Stefan Luedtke wrote: This one is for windows. http://cran.r-project.org/web/packages/RNetCDF/index.html but you need netcdf libraries and udunits libraries

[R] Singleton pattern

2012-03-16 Thread David Cassany
Hi all, I know it may not have much sense thinking about a Singleton Pattern in an R application which doesn't use any OOP facilities, however I'm curious to know if anybody faced the same issue. I've been googling but using singleton pattern as a key word leads to typical OOP languages like Java

Re: [R] Change in behavior of update.views()?

2012-03-16 Thread Achim Zeileis
On Fri, 16 Mar 2012, Michael Kubovy wrote: I haven't seen this cryptic warning before: update.views('Robust') Warning message: In update.views(Robust) : The following packages are not available: covRobust, distr, FRB, MASS, mblm, multinomRob, mvoutlier, quantreg, RandVar, rgam, RobAStBase,

[R] help to split a ID column in a data.frame and create a new ID column

2012-03-16 Thread gianni lavaredo
Dear Researchers, I have a data.frame with 2 columns like this: mydf - data.frame(value=c(1,2,3,4,5),ID=c(Area_1,Area_2,Area_3,Area_4,Area_5)) mydf value ID 1 1 Area_1 2 2 Area_2 3 3 Area_3 4 4 Area_4 5 5 Area_5 I need to convert the *ID *in the following version

Re: [R] Generation of correlated variables

2012-03-16 Thread Petr Savicky
On Thu, Mar 15, 2012 at 10:48:48AM -0700, Filoche wrote: Hi everyone. Based on a dependent variable (y), I'm trying to generate some independent variables with a specified correlation. For this there's no problems. However, I would like that have all my regressors to be orthogonal (i.e. no

[R] var

2012-03-16 Thread Amen
ex.nc [1] file cruncep_tair_2010.nc has 4 dimensions: [1] longitude Size: 720 [1] latitude Size: 360 [1] time Size: 1460 [1] points_terre Size: 62482 [1] [1] file cruncep_tair_2010.nc has 4 variables: [1] int mask[longitude,latitude] Longname:mask Missval:NA [1]

[R] Spatstat - coordinates in observation window

2012-03-16 Thread Lucie V
Dear R users, I wish to run spatial point pattern analysis (e.g. pair correlation function, mark correlation function) for which I need to create an observation window (window=owin) from which the spatial analysis is generated. The command I used to create this observation window as

[R] How to Group Categorical data in R?

2012-03-16 Thread Manish Gupta
Hi, I am newbie to R and working on result presentation? My Input table is in following format A B CD X TCK Z U ZM E VZR Z U

Re: [R] Extending a group of S4 classes by setClassUnion ?

2012-03-16 Thread Alexander
Martin Morgan wrote On 03/15/2012 09:51 AM, Alexander wrote: Hi Martin, thanks for your quick answer. I didn't know that '.' could be missleading. Is there any standard way to name function for S4 objects? get,set etc..? Hi Alexander -- it's usually better to include the original email

Re: [R] ncd4 package

2012-03-16 Thread Amen
Thanks a lot I installed it but the interface did not show up I got this message Local ({pkg - select.list (sort (. Packages (all.available = TRUE)), graphics = TRUE) + If (nchar (pkg)) library (pkg, character.only = TRUE)}) Notification message: package 'RNetCDF has been compiled with version

Re: [R] ncd4 package

2012-03-16 Thread Amen
I got theses but no interface library(udunits2) library(ncdf) local({pkg - select.list(sort(.packages(all.available = TRUE)),graphics=TRUE) + if(nchar(pkg)) library(pkg, character.only=TRUE)}) -- View this message in context:

[R] R merge two dataframes with different row?

2012-03-16 Thread zhu free
Hi everyone, I have a question for R code to merge. Say I have two dataframes: File1 is: V1V2V3V4 1100101name1 2200201name2 2300301name3 3400401name4 3500501name5 4600601name6 4700701name7 File2 is: V1

Re: [R] Rolling regressions with sample extended one period at a time

2012-03-16 Thread pie'
hey, thanks for the hint. I too figured I'd have to write a for-loop. I have the problem now of how to extract the single element of the fitted values vector. For example, run 1 of the regression generates 80 fitted values, run 2 generates 81 fitted values, run 3 produces 82 fitted values and

[R] Problem reading mixed CSV file

2012-03-16 Thread Ashish Agarwal
I am having trouble reading this CSV file in R. There are six attributes that I need to read - CVar1, CVar2, Location, Year, Nvar3, Nvar4. Can somebody help in reading this file? On line 10 it has city and state separated by comma. I had been a user of SAS where I can use different format to read

[R] how to speed up the inefficient code

2012-03-16 Thread mrzung
hi, i'm really in trouble to simulate some experiment. that is, it takes too much time to process the following code. following is short example, ---

[R] Re : ncd4 package

2012-03-16 Thread Pascal Oettli
Hi, Package ncdf4 is not available for Windows. Regards, Pascal - Mail original - De : Amen amen.alya...@bordeaux.inra.fr À : r-help@r-project.org Cc : Envoyé le : Vendredi 16 mars 2012 16h39 Objet : [R] ncd4 package Hi I am using windows. I cant install ncdf4 package but it didn't

Re: [R] replacing values in Array

2012-03-16 Thread uday
Hey Gerrit , Thanks your solution works -- View this message in context: http://r.789695.n4.nabble.com/replacing-values-in-Array-tp4468739p4477758.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Adding mean values to boxplots

2012-03-16 Thread Cleland
That works great by the way. Thanks very much for your help! -- View this message in context: http://r.789695.n4.nabble.com/Adding-mean-values-to-boxplots-tp4474700p4478031.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] How to Group Categorical data in R?

2012-03-16 Thread Jorge I Velez
Hi Manish, Try # data set x - structure(list(V1 = structure(c(1L, 3L, 4L, 2L, 4L, 2L), .Label = c(A, E, X, Z), class = factor), V2 = structure(c(1L, 2L, 3L, 4L, 3L, 4L), .Label = c(B, T, U, V), class = factor), V3 = structure(c(1L, 1L, 3L, 3L, 3L, 2L), .Label = c(C, P, Z), class =

Re: [R] How to extend a slot of a class?

2012-03-16 Thread Igor Sosa Mayor
i think if you do: coord$time-YOURTIMEVECTOR should work and the new vector is put correctly in the data slot. Maybe also coord@data$time-YOURTIMEVECTOR On Wed, Mar 14, 2012 at 01:39:20PM +0100, Marco Smolla wrote: Hej hej, is there a way to extend the SpatialPointsDataFrame data slot?This

Re: [R] how to speed up the inefficient code

2012-03-16 Thread Jorge I Velez
Hi mrzung46, Try cbind(p, result_1 = rowSums((p-c(test))^2)) HTH, Jorge.- On Fri, Mar 16, 2012 at 8:32 AM, mrzung wrote: hi, i'm really in trouble to simulate some experiment. that is, it takes too much time to process the following code. following is short example,

Re: [R] help to split a ID column in a data.frame and create a new ID column

2012-03-16 Thread Jorge I Velez
Hi Gianni, Thank you for the reproducible example! Try mydf$newID - with(mydf, gsub(_, Sample, ID)) mydf HTH, Jorge.- On Fri, Mar 16, 2012 at 7:54 AM, gianni lavaredo wrote: Dear Researchers, I have a data.frame with 2 columns like this: mydf -

Re: [R] how to speed up the inefficient code

2012-03-16 Thread jim holtman
Try this -- use matrices instead of dataframes if you want speed: p-data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10),d=rnorm(10)) test-data.frame(a=rnorm(1),b=rnorm(1),c=rnorm(1),d=rnorm(1)) result-list() for(i in 1:nrow(p)){ + result[[i]]-sum((p[i,]-test)^2) + } result_1-unlist(result)

Re: [R] Ggplot barchart drops factor levels: how to show them with zero counts?

2012-03-16 Thread Ben Bolker
R. Michael Weylandt michael.weylandt at gmail.com writes: I can reproduce the OP's problem with ggplot 0.9.0 but I don't know how to solve it: perhaps you should take this to the ggplot2 mailing list: https://groups.google.com/group/ggplot2?pli=1 Michael On Fri, Mar 16, 2012 at 4:17

[R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I have the following code: x - data.frame(x1=1, x2=2, y1=3) x$y [1] 3 x$x NULL I was surprised (and definitely irritated?) when I realised that partial matching also works for the $. Is this intended? I assume the reason is that $ is

[R] contingency tables

2012-03-16 Thread mari681
Ok, before I definetly give up, and throw the laptop out of the window, or fill my data.frame manually, I'll ask for some help. I have a data.frame named MyTable with 3 columns, that looks like this: V1 V2 V3 red-jappearanceblood-n 105.032 red-j

Re: [R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Sarah Goslee
Hi Rainer, On Fri, Mar 16, 2012 at 9:45 AM, Rainer M Krug r.m.k...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I have the following code:  x - data.frame(x1=1, x2=2, y1=3)  x$y [1] 3  x$x NULL I was surprised (and definitely irritated?) when I realised that

Re: [R] Re : Elegant Code

2012-03-16 Thread Raphael Fraser
Thank you all. Your responses were very helpful. Raphael On Fri, Mar 16, 2012 at 5:04 AM, Daniel Nordlund djnordl...@frontier.com wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pascal Oettli Sent: Friday, March 16,

Re: [R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 16/03/12 14:54, Sarah Goslee wrote: Hi Rainer, On Fri, Mar 16, 2012 at 9:45 AM, Rainer M Krug r.m.k...@gmail.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I have the following code: x - data.frame(x1=1, x2=2, y1=3) x$y

Re: [R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Sarah Goslee
It's also a really good reason to use [[ in functions or anywhere there might be a chance of confusion. Absolutely - I think I have to change my habit. I always prefered using $ as it seemed to me more logical. I started out that way because it's shorter and nicer-looking code, but it

Re: [R] R merge two dataframes with different row?

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 5:51 AM, zhu free wrote: Hi everyone, I have a question for R code to merge. Say I have two dataframes: File1 is: V1V2V3V4 1100101name1 2200201name2 2300301name3 3400401name4 3500501name5 4600

Re: [R] contingency tables

2012-03-16 Thread Milan Bouchet-Valat
Le vendredi 16 mars 2012 à 06:46 -0700, mari681 a écrit : Ok, before I definetly give up, and throw the laptop out of the window, or fill my data.frame manually, I'll ask for some help. I have a data.frame named MyTable with 3 columns, that looks like this: snip The elements on the first

Re: [R] contingency tables

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 9:46 AM, mari681 wrote: Ok, before I definetly give up, and throw the laptop out of the window, or fill my data.frame manually, I'll ask for some help. I have a data.frame named MyTable with 3 columns, that looks like this: V1 V2

Re: [R] ROC Analysis

2012-03-16 Thread Camille Leclerc
Hi everybody, Pascal, your script works again but I want to calculate the LR otherwise. I know the likelihood ratio is linked at the roc curve and so there are different ways to calculate the LR. The slope of an ROC curve can be defined in three ways: (1) as the tangent at a particular point on

[R] multiple density plot

2012-03-16 Thread statquant2
Hello I am looking for a special plot. Let's suppose I have *100 days and *each day I have a (1D) distribution of the same variable. I would like to plot *dates on x axis and *one distribution per date on the y axe. Do you know a way of doing it ?

[R] How to start R in maximized size???

2012-03-16 Thread Christofer Bogaso
Dear all, when I start R, I want that the console window should be in the Maximized size automatically. Can somebody help me how to achieve that? Thanks and regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] How to start R in maximized size???

2012-03-16 Thread Duncan Murdoch
On 16/03/2012 10:23 AM, Christofer Bogaso wrote: Dear all, when I start R, I want that the console window should be in the Maximized size automatically. Can somebody help me how to achieve that? If you are working in Windows and starting R by clicking on the shortcut, just change the Run:

[R] plot columns

2012-03-16 Thread aoife doherty
Hey guys, can anyone help? i have a sample table: table - structure(c(4, 7, 0.2, 3, .1, 7, 222, 3, 10, 5, 11, 8, 8, 10, 7), .Dim = c(5L, 3L), .Dimnames = list(c(gene1, gene2, gene3, gene4, gene5), c(codon1, codon2, codon3))) table codon1 codon2 codon3 gene14.0 7 11

Re: [R] where I can find more color names or color definition?

2012-03-16 Thread David Reiner
I found this useful: http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.pdf HTH, -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of FJ M Sent: Wednesday, March 14, 2012 3:39 PM To: totang...@gmail.com; R

Re: [R] How to start R in maximized size???

2012-03-16 Thread Christofer Bogaso
No no, I meant to say the console window, where we type the syntax etc. BTW, what is the official name of this window? Thanks, On Fri, Mar 16, 2012 at 8:15 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 16/03/2012 10:23 AM, Christofer Bogaso wrote: Dear all, when I start R, I want

Re: [R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Ben Bolker
Sarah Goslee sarah.goslee at gmail.com writes: R: lots of ways to do the same thing, but some of them are booby-trapped. Fortune candidate! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Partial matching when using $ ? Feature or bug?

2012-03-16 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 16/03/12 15:05, Sarah Goslee wrote: It's also a really good reason to use [[ in functions or anywhere there might be a chance of confusion. Absolutely - I think I have to change my habit. I always prefered using $ as it seemed to me more

Re: [R] How to start R in maximized size???

2012-03-16 Thread Kevin Wright
Duncan's suggestion worked for me. What about it didn't work for you? Kevin On Fri, Mar 16, 2012 at 9:35 AM, Christofer Bogaso bogaso.christo...@gmail.com wrote: No no, I meant to say the console window, where we type the syntax etc. BTW, what is the official name of this window?

Re: [R] How to start R in maximized size???

2012-03-16 Thread Duncan Murdoch
On 16/03/2012 10:35 AM, Christofer Bogaso wrote: No no, I meant to say the console window, where we type the syntax etc. BTW, what is the official name of this window? I think console window is good enough. Duncan Murdoch Thanks, On Fri, Mar 16, 2012 at 8:15 PM, Duncan Murdoch

Re: [R] How to start R in maximized size???

2012-03-16 Thread Christofer Bogaso
But unfortunately it did not work for me. I am using R-2.14.2 with windows 7 home basic Thanks, On Fri, Mar 16, 2012 at 8:26 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 16/03/2012 10:35 AM, Christofer Bogaso wrote: No no, I meant to say the console window, where we type the syntax

Re: [R] plot columns

2012-03-16 Thread R. Michael Weylandt michael.weyla...@gmail.com
plot(codon3 ~ codon1, data = table) should work but I'm not in a position to verify. If for some reason it doesn't does plot(codon3 ~ codon1, data = as.data.frame(table)) get it? Michael On Mar 16, 2012, at 10:32 AM, aoife doherty aoife.m.dohe...@gmail.com wrote: Hey guys, can anyone help?

Re: [R] Timer on a function

2012-03-16 Thread William Dunlap
From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Using setTimeLimit(transient = TRUE) is slightly simpler here. Brian, I thought I should have been able to use transient=TRUE instead of the on.exit(setTimeLimit()) but that gave me an unwanted error report after the top-level expression

Re: [R] Re : Elegant Code

2012-03-16 Thread Ranjan Maitra
Wonder if this is part of some assignment with points on elegance of code. Sort of when I teach a class.. On Fri, 16 Mar 2012 10:02:48 -0400 Raphael Fraser raphael.fra...@gmail.com wrote: Thank you all. Your responses were very helpful. Raphael On Fri, Mar 16, 2012 at 5:04 AM, Daniel

Re: [R] Singleton pattern

2012-03-16 Thread Bryan Hanson
Since no one else has bit, I'll take a stab. I'm an experienced R person, but I've recently been teaching myself objective-c and I've been using singletons quite a bit (and mis-using them quite a bit!). Not a computer scientist at all. You've been warned. I don't think there is a comparable

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread jim holtman
What do you mean by Mixed? If a field has a comma, then it is supposed be to enclosed in quotes. You could preprocess the file looking for cases where there are more fields than there there are supposed to be, and if they are always in the same place, you could enclose them in quotes and then

[R] Faster way to implement this search?

2012-03-16 Thread Walter Anderson
I am working on a simulation where I need to count the number of matches for an arbitrary pattern in a large sequence of binomial factors. My current code is for(indx in 1:(length(bin.05)-3)) if ((bin.05[indx] == test.pattern[1]) (bin.05[indx+1] == test.pattern[2])

[R] quadprog error?

2012-03-16 Thread none
I forgot to attach the problem data, 'quadprog.Rdata' file, in my prior email. I want to report a following error with quadprog. The solve.QP function finds a solution to the problem below that violates the last equality constraint. I tried to solve the same problem using ipop from kernlab

Re: [R] Singleton pattern

2012-03-16 Thread j verzani
David Cassany david.cassany at transmuralbiotech.com writes: Hi all, I know it may not have much sense thinking about a Singleton Pattern in an R application which doesn't use any OOP facilities, however I'm curious to know if anybody faced the same issue. I've been googling but using

Re: [R] Singleton pattern

2012-03-16 Thread Jan T. Kim
Using the singleton pattern in R has never occurred to me so far, as I think it applies to languages that support multiple references to one instance. R doesn't do that, at least not in ways that would be required for applying the singleton pattern as described in the GoF book, anyway. One would

[R] a question about writing C extensions to functions

2012-03-16 Thread Erin Hodgess
Dear R People: I'm not sure if I should ask this here or in Rcpp, but I thought I'd start here first. If I'm writing a C program, when do I know to use SEXP vs. int or float, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University

[R] bias sampling

2012-03-16 Thread niloo javan
hi i want to analyze Right Censore-Length bias data under cox model with covariate. what is the package ? tank you. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread Ashish Agarwal
I want to import this CSV file into R. The CSV file is ,,,1968,21,0 ,,Boston,1968,13,0 ,,Boston,1968,18,0 ,,Chicago,1967,44,0 ,,Providence,1968,17,0 ,,Providence,1969,48,0 ,,Binky,1968,24,0 ,,Chicago,1968,23,0 ,,Dally,1968,7,0 ,,Raleigh, North Carol,1968,25,0 Addy ABC-Dogs

Re: [R] quadprog error?

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 12:20 PM, none wrote: I forgot to attach the problem data, 'quadprog.Rdata' file, in my prior email. Please read the Posting Guide's description of what kind of attachments the mail-server will accept. -- David Winsemius, MD West Hartford, CT

Re: [R] Faster way to implement this search?

2012-03-16 Thread Sarah Goslee
There's almost certainly a better way, but I'd be more inclined to look for it if you'd provide a small reproducible example so I could actually try it. Without knowing the structure of your data, it's very hard to offer alternatives. Sarah On Fri, Mar 16, 2012 at 12:59 PM, Walter Anderson

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 1:11 PM, Ashish Agarwal wrote: I want to import this CSV file into R. The CSV file is ,,,1968,21,0 ,,Boston,1968,13,0 ,,Boston,1968,18,0 ,,Chicago,1967,44,0 ,,Providence,1968,17,0 ,,Providence,1969,48,0 ,,Binky,1968,24,0 ,,Chicago,1968,23,0 ,,Dally,1968,7,0 ,,Raleigh,

Re: [R] Faster way to implement this search?

2012-03-16 Thread William Dunlap
You didn't show your complete code but the following may help you speed things up. Compare a function, f0, structured like your code and one, f1, that calls sum once instead of counting length(x)-3 times. f0 - function(x, test.pattern) { count - 0 for(indx in seq_len(length(x)-3)) {

[R] Changing axis labels depending on panel in lattice

2012-03-16 Thread Saptarshi Guha
Hello, I am lattice scatterplot that has 2 panels (could be a few more). Both panels have a y-axis label that is different on the left and right sides. However the right hand side axis labelling depends on which panel i'm in . (I am plotting two curves in one panel, the left y-axis has the scale

Re: [R] Changing axis labels depending on panel in lattice

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 1:34 PM, Saptarshi Guha wrote: Hello, I am lattice scatterplot that has 2 panels (could be a few more). Both panels have a y-axis label that is different on the left and right sides. However the right hand side axis labelling depends on which panel i'm in . (I am

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread Ashish Agarwal
Line 10 has City and State that too separated by comma. For line 10 how can I read differently as compared to the other lines? On Fri, Mar 16, 2012 at 10:59 PM, David Winsemius dwinsem...@comcast.net wrote: On Mar 16, 2012, at 1:11 PM, Ashish Agarwal wrote: I want to import this CSV file into

Re: [R] summing transfers

2012-03-16 Thread Farley, Robert
I just want the weighted sum of all the cases where either route is found in VEHx and the other is found in the previous or subsequent variable. The only examples I can think of producing are the following: # OBDataSumm - read.spss(P:/Data/OBSurveys/OBSurvey-2010-2011/Final Delivery, Metro

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread Peter Ehlers
On 2012-03-16 10:48, Ashish Agarwal wrote: Line 10 has City and State that too separated by comma. For line 10 how can I read differently as compared to the other lines? Edit the file and put quotes around the city-state combination: Raleigh, North Carol Also: always run count.fields() on

Re: [R] eigenvalues of matrices of partial derivatives with ryacas

2012-03-16 Thread Adam Zeilinger
Dear Gabor, Thank you so much for your help! Your suggested code worked! I have a couple of questions. I'm trying to understand your code so I can use it in future programming needs. First, my understanding of the first line of your code is that it creates an R function EigenValues that

[R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread Saptarshi Guha
Hello, Is there a way to add ylab on the right hand side also (in lattice)? Different from the left hand side? Cheers Saptarshi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Problem reading mixed CSV file

2012-03-16 Thread Ashish Agarwal
I have a file that is 5000 records and to edit that file is not easy. Is there any way to line 10 differently to account for changes in the third field? On Fri, Mar 16, 2012 at 11:35 PM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2012-03-16 10:48, Ashish Agarwal wrote: Line 10 has City and

Re: [R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread Richard M. Heiberger
from ?xyplot use the ylab.right argument On Fri, Mar 16, 2012 at 2:11 PM, Saptarshi Guha saptarshi.g...@gmail.comwrote: Hello, Is there a way to add ylab on the right hand side also (in lattice)? Different from the left hand side? Cheers Saptarshi [[alternative HTML version

Re: [R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 2:53 PM, Richard M. Heiberger wrote: from ?xyplot use the ylab.right argument On Fri, Mar 16, 2012 at 2:11 PM, Saptarshi Guha saptarshi.g...@gmail.com wrote: Hello, Is there a way to add ylab on the right hand side also (in lattice)? Different from the left hand

Re: [R] Y-axis label on the right hand side in lattice?

2012-03-16 Thread David Winsemius
On Mar 16, 2012, at 3:03 PM, David Winsemius wrote: On Mar 16, 2012, at 2:53 PM, Richard M. Heiberger wrote: from ?xyplot use the ylab.right argument On Fri, Mar 16, 2012 at 2:11 PM, Saptarshi Guha saptarshi.g...@gmail.com wrote: Hello, Is there a way to add ylab on the right hand

Re: [R] Spatstat - coordinates in observation window

2012-03-16 Thread Rolf Turner
On 16/03/12 23:02, Lucie V wrote: Dear R users, I wish to run spatial point pattern analysis (e.g. pair correlation function, mark correlation function) for which I need to create an observation window (window=owin) from which the spatial analysis is generated. The command I used to create

Re: [R] ggplot2: goem_smooth and suppress messages

2012-03-16 Thread Brian Diggs
On 3/15/2012 4:11 PM, tibaker wrote: Hi When I run my script using ggplot and geom_smooth I get messages that I would like to suppress: p- ggplot(dataSubset) p- p + aes(x = as.Date(factor(key),format=%Y%m%d)) + geom_line() p- p + geom_smooth(span=0.2,se=FALSE,size=0.7) The messages look like

Re: [R] R-help Digest, Vol 109, Issue 16

2012-03-16 Thread Gerald Lindsly
Q #1: yesterday: A: 1. Restructure your database with NoSQL.  See MongoDB.org.     2. Choose application language with which to work (and get Driver) and write your code.     3. R package - rmongodb. __ R-help@r-project.org mailing list

Re: [R] Apt-get

2012-03-16 Thread Scott Raynaud
Ok.  When I type in sudo add-apt-repository ppa:marutter/rrutter I get a prompt for a password.  I enter my domain password and get some print about adding the ppa and requeting that I press enter.  I press enter and this is followed by print stating that the key B04C661B is being requested from

[R] ggplot axis limit

2012-03-16 Thread mdvaan
Hi, This is probably an easy one, but I am new to ggplot2 and cannot find an answer online. I am bar plotting values of 10 groups. These values are all within a 90-100 range, so I would like leave out the area of the bars below 90. If I say graph + scale_y_continuous(limit=c(90, 100)), it does

[R] plotting border over map

2012-03-16 Thread uday
I am using following codes to plot map library(sp) library(rgdal) library(maps) library(gplots) library(clim.pact) library(fields) source(/R/PlotGridded2DMap.R) source(/R/image.plot.fix.R) source(/R/image.plot.plt.fix.r)

[R] ggmap crash

2012-03-16 Thread Hasan Diwan
Not sure if this is the right place to report this, but: Am using ggmap to generate a map of a bounding box from 161 latitude/longitude pairs and the code crashes R (in ess). Data is at http://analysis.d8u.us/~hdiwan/plotSource.csv and the code to read it is below. I'm not sure if ess, emacs,

  1   2   >