Re: [R] Annotate a segmented linear regression plot

2012-09-27 Thread David Winsemius
On Sep 27, 2012, at 9:07 PM, Ben Harrison wrote: > Hello, > > I have produced some segmented regressions with the segmented package by > Viggo Mutteo. I have some example data and code below. I want to annotate > the individual segments with the slope parameter (actually it would be > nicer to a

Re: [R] Simple Question

2012-09-27 Thread David Winsemius
On Sep 27, 2012, at 11:13 PM, Bhupendrasinh Thakre wrote: > > Hi Everyone, > > I am trying a very simple task to append the Timestamp with a variable name > so something like > a_2012_09_27_00_12_30 <- rnorm(1,2,1). If you want to assign a value to a character-name you need to use ... `assig

Re: [R] Simple Question

2012-09-27 Thread Pascal Oettli
Hello, Try the following: b <- unclass(Sys.time()) eval(parse(text=paste("c_",b," <- rnorm(1,2,1)",sep=""))) ls() Regards, Pascal Le 28/09/2012 15:13, Bhupendrasinh Thakre a écrit : Hi Everyone, I am trying a very simple task to append the Timestamp with a variable name so something like

Re: [R] Simple Question

2012-09-27 Thread K. Elo
Hi! 28.09.2012 09:13, Bhupendrasinh Thakre wrote: Statement I tried : b <- unclass(Sys.time()) b = 1348812597 c_b <- rnorm(1,2,1) Do you mean this: --- code --- > df<-data.frame("x"=0,"y"=0) > colnames(df) [1] "x" "y" > colnames(df)[2]<-paste("b",unclass(Sys.time()),sep="_") > colnames(df)

[R] Simple Question

2012-09-27 Thread Bhupendrasinh Thakre
Hi Everyone, I am trying a very simple task to append the Timestamp with a variable name so something like a_2012_09_27_00_12_30 <- rnorm(1,2,1). Tried some commands but it doesn't work out well. Hope someone has some answer on it. Session Info R version 2.15.1 (2012-06-22) Platform: i386-

Re: [R] How to test if there is a subvector in a longer vector

2012-09-27 Thread K. Elo
Hi! 28.09.2012 08:41, Atte Tenkanen wrote: Sorry. I should have mentioned that the order of the components is important. So c(1,4,6) is accepted as a subvector of c(2,1,1,4,6,3), but not of c(2,1,1,6,4,3). How to test this? How about this: --- code --- g1<- c(2,1,1,4,6,3) g2<- c(2,1,1,6,4

Re: [R] List of Variables in Original Order

2012-09-27 Thread arun
HI, May be this helps you: set.seed(1)  mat1<-matrix(rnorm(60,5),nrow=5,ncol=12) colnames(mat1)<-paste0("Var",1:12) vec2<-format(c(1,cor(mat1[,1],mat1[,2:12])),digits=4) vec3<-colnames(mat1) arr2<-array(rbind(vec3,vec2),dim=c(2,3,4)) res<-data.frame(do.call(rbind,lapply(1:dim(arr2)[3],fun

Re: [R] How to test if there is a subvector in a longer vector

2012-09-27 Thread Atte Tenkanen
Sorry. I should have mentioned that the order of the components is important. So c(1,4,6) is accepted as a subvector of c(2,1,1,4,6,3), but not of c(2,1,1,6,4,3). How to test this? Cc: R help Aihe: Re: [R] How to test if there is a subvector in a longer

Re: [R] Start and End day of a month

2012-09-27 Thread Gabor Grothendieck
On Thu, Sep 27, 2012 at 8:21 AM, Rantony wrote: > Hi, > > Can anyone please help to get "StartDay" and "End-day of a particular month" > with time ? > > For eg:- Input wil be "2012-09-27" > > i need to get output as given below > > StartDt <- "2012-09-01 00:00:01" > EndDt <- "2012-09-30 23:59:59"

[R] Annotate a segmented linear regression plot

2012-09-27 Thread Ben Harrison
Hello, I have produced some segmented regressions with the segmented package by Viggo Mutteo. I have some example data and code below. I want to annotate the individual segments with the slope parameter (actually it would be nicer to annotate with 1000*slope and add some small amount of text as we

Re: [R] How to test if there is a subvector in a longer vector

2012-09-27 Thread arun
Hi, Try this: Not sure whether this is the fastest: set.seed(932) vec1<-sample(1:10,6,replace=TRUE)  vec2<-sample(1:7,3,replace=TRUE)  vec2[vec2%in%vec1] #[1] 5 library(rbenchmark)  benchmark(isTRUE(all(vec2%in%vec1)),replications=1e4) # test replications elapsed relative us

Re: [R] Start and End day of a month

2012-09-27 Thread arun
HI Joshua, Thanks for providing much easier solution. But, I am getting the output from dat1 as: #  inputDate   startDate endDate #1 2012-09-27 2012-09-27 00:00:01 2012-09-27 23:59:59 #2 2012-09-28 2012-09-28 00:00:01 2012-09-28 23:59:59 #3 2012-07-24 2012-07-24 00:00:01 2012-

Re: [R] Generating an autocorrelated binary variable

2012-09-27 Thread Rolf Turner
I have no idea what your code is doing, nor why you want correlated binary variables. Correlation makes little or no sense in the context of binary random variables --- or more generally in the context of discrete random variables. Be that as it may, it is an easy calculation to show that if

Re: [R] How to test if there is a subvector in a longer vector

2012-09-27 Thread David Winsemius
On Sep 27, 2012, at 2:00 PM, Atte Tenkanen wrote: > Hi, > > There are certainly several ways to test, whether a longer vector includes a > subvector. > For instance, c(1,4,6) is included in c(2,1,1,4,6,3). How to test this and > which would be the fastest way to do it? > > all( c(1,4,6) %in

Re: [R] How to write R package

2012-09-27 Thread Steve Lianoglou
On Thu, Sep 27, 2012 at 5:15 PM, Dr. Alireza Zolfaghari wrote: > Hi List, > Would you please send me a good link to talk me through on how to write a R > package? There are many, many, many resources: http://lmgtfy.com/?q=writing+r+packages+tutorial Take the first hit. -steve -- Steve Lianogl

Re: [R] Start and End day of a month

2012-09-27 Thread Joshua Ulrich
On Thu, Sep 27, 2012 at 3:05 PM, arun wrote: > HI, > For a vector of dates: > Using Michael's suggestion: > library(xts) > library(zoo) > Dt<-c("2012-09-27","2012-09-28","2012-07-24","2012-06-05","2012-12-03") > newDt<-strsplit(format(as.yearmon(Dt),"%Y-%m"),split="-") > StartDt<-do.call(rbind,lap

[R] changing outlier shapes of boxplots using lattice

2012-09-27 Thread Elaine Kuo
Hello This is Elaine. I am using package lattice to generate boxplots. Using Richard's code, the display was almost perfect except the outlier shape. Based on the following code, the outliers are vertical lines. However, I want the outliers to be empty circles. Please kindly help how to modify th

[R] List of Variables in Original Order

2012-09-27 Thread rkulp
I am trying to Sweave the output of calculating correlations between one variable and several others. I wanted to print a table where the odd-numbered rows contain the variable names and the even-numbered rows contain the correlations. So if VarA is correlated with all the variables in mydata.df, t

[R] How to write R package

2012-09-27 Thread Dr. Alireza Zolfaghari
Hi List, Would you please send me a good link to talk me through on how to write a R package? thanks Alireza [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] [R-sig-hpc] Quickest way to make a large "empty" file on disk?

2012-09-27 Thread Rui Barradas
Hello, If you really need to trash your disk, why not use seek()? > fl <- file("Test.txt", open = "wb") > seek(fl, where = 1024, origin = "start", rw = "write") [1] 0 > writeChar(character(1), fl, nchars = 1, useBytes = TRUE) Warning message: In writeChar(character(1), fl, nchars = 1, useBytes

[R] What to use for ti in back-transforming summary statistics from F-T double square-root transformation in 'metafor'

2012-09-27 Thread Liu, Chunyan
Hi Dr. Viechtbauer, I'm doing meta-analysis using your package 'metafor'. I used the 'IRFT' to transform the incident rate. But when I tried to back-transform the summary estimates from function rma, I don't know what's the appropriate ti to feed in function transf.iirft. I searched and found y

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Rui Barradas
Hello, again. There was another error in the line in question. TRUE does not need quotes. In fact, with quotes you're comparing to a character string, not to a logical value. And the other tip still holds, use as follows in the complete and corrected line below. Health2PairsOnly <- PairIDs[

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Rui Barradas
Hello, That way of refering to variables can be troublesome. Try PairIDs[, "Pairiddups"] Hope this helps, Rui Barradas Em 27-09-2012 20:46, GradStudentDD escreveu: Hi, I have a data set of observations by either one person or a pair of people. I want to only keep the pair observations, and

[R] Generating an autocorrelated binary variable

2012-09-27 Thread Simon Zehnder
Hi R-fellows, I am trying to simulate a multivariate correlated sample via the Gaussian copula method. One variable is a binary variable, that should be autocorrelated. The autocorrelation should be rho = 0.2. Furthermore, the overall probability to get either outcome of the binary variable sho

[R] Autocorrelated binary variable

2012-09-27 Thread Simon Zehnder
Hi R-fellows, I am trying to simulate a multivariate correlated sample via the Gaussian copula method. One variable is a binary variable, that should be autocorrelated. The autocorrelation should be rho = 0.2. Furthermore, the overall probability to get either outcome of the binary variable sho

Re: [R] Start and End day of a month

2012-09-27 Thread arun
HI, For a vector of dates: Using Michael's suggestion: library(xts) library(zoo) Dt<-c("2012-09-27","2012-09-28","2012-07-24","2012-06-05","2012-12-03") newDt<-strsplit(format(as.yearmon(Dt),"%Y-%m"),split="-") StartDt<-do.call(rbind,lapply(lapply(lapply(newDt,`[`,1:2),function(x) as.numeric

[R] How to test if there is a subvector in a longer vector

2012-09-27 Thread Atte Tenkanen
Hi, There are certainly several ways to test, whether a longer vector includes a subvector. For instance, c(1,4,6) is included in c(2,1,1,4,6,3). How to test this and which would be the fastest way to do it? Best, Atte Tenkanen, FT, MuM http://users.utu.fi/attenka/ ___

[R] Questions about the functions ar.ols and auto.arima when fitting an AR model

2012-09-27 Thread jpm miao
Hi, I am trying to fit an AR model, maximum order =4, order selection criterion is aic. I wonder why these two give different results: m1<-ar.ols(x, aic=TRUE, method="ols", order.max=4) m1<-auto.arima(x,d=0, D=0, max.p=4, max.P=0, max.q=0, max.Q=0, ic="aic") Could they both use the f

Re: [R] z-score to percentile, and back again (Normal)

2012-09-27 Thread Jeff Newmiller
?Distributions The more general term for percentile is quantile. help.search("quantile") --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] z-score to percentile, and back again (Normal)

2012-09-27 Thread Peter Petto
In R, what is the best way to convert z-scores (Normal distribution) to a percentiles, and vice-versa. (I'll be looking to do the same with other distributions eventually.) === Peter Petto Bay Village, OH 440.249.4289 __ R-help@r-project.org maili

Re: [R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread Simon Knapp
#By using cbind in: PairIDs<-cbind(PairID, PairIDDuplicates) #You create a numeric matrix (the logical #vector PairIDDuplicates gets converted #to numeric - note that your second column #contains 1s and 0s, not Trues and Falses). #Matricies are not subsetable using $, #they are basically a vector

[R] problems with mle2 convergence and with writing gradient function

2012-09-27 Thread Adam Zeilinger
Dear R help, I am trying solve an MLE convergence problem: I would like to estimate four parameters, p1, p2, mu1, mu2, which relate to the probabilities, P1, P2, P3, of a multinomial (trinomial) distribution. I am using the mle2() function and feeding it a time series dataset composed of four

Re: [R] install.packages on windows

2012-09-27 Thread Duncan Murdoch
On 12-09-27 2:53 PM, Anju R wrote: Sometimes when I try to install certain packages I get a warning message. For example, I tried to install the package "Imtest" on windows R version 2.15.1 and got the following message: Warning message: package ‘Imtest’ is not available (for R version 2.15.1)

Re: [R] Drawing asymmetric error bars

2012-09-27 Thread David L Carlson
You can always roll your own with something like: > x1 <- c(4, 5, 7) > x2 <- c(5, 6, 9) > plot(c(1.5, 2.5), cbind(x1[2], x2[2]), xlab="", ylab="", xlim=c(1, 3), ylim=c(0, 10), xaxt="n") > axis(1, at=1:2+.5, labels=c("Group 1", "Group 2")) > arrows(1.5, x1[2], 1.5, c(x1[1], x1[3]), angle=90,

Re: [R] problem with nls starting values

2012-09-27 Thread Ben Bolker
On 12-09-27 05:34 PM, Bert Gunter wrote: > Good point, Ben. > > I followed up my earlier reply offline with a brief note to Benedikt > pointing out that "No" was the wrong answer: "maybe, maybe not" would > have been better. > > Nevertheless, the important point here is that even if you do get >

Re: [R] problem with nls starting values

2012-09-27 Thread Bert Gunter
Good point, Ben. I followed up my earlier reply offline with a brief note to Benedikt pointing out that "No" was the wrong answer: "maybe, maybe not" would have been better. Nevertheless, the important point here is that even if you do get convergence, the over-parameterization means that the est

Re: [R] problem with nls starting values

2012-09-27 Thread Ben Bolker
Bert Gunter gene.com> writes: > > On Thu, Sep 27, 2012 at 12:43 PM, Benedikt Gehr > ieu.uzh.ch> wrote: > > now I feel very silly! I swear I was trying this for a long time and it > > didn't work. Now that I closed R and restarted it it works also on my > > machine. > > > > So is the only proble

Re: [R] Guideline

2012-09-27 Thread Jeff Newmiller
Wouldn't the correct approach be to use the software and give credit appropriately for the software and libraries you use? Branding is not an issue... familiarity is. This is open source software... read the license(s). ---

[R] Paired -test in NADA package

2012-09-27 Thread Jake Beaulieu
Hi all, I would like to run a paired t-test with censored data using the NADA package. Here is an example data set: data <- data.frame(group=rep(c('a','b'), each=6), obs=c(2,2,5,7,10,10,5,5,6,8,5,9), cen=c(T,T,F,F,F,F,F,F,F,F,F,F)) #A two sample t-test can be executed as follows: library(NADA

Re: [R] problem with nls starting values

2012-09-27 Thread Bert Gunter
On Thu, Sep 27, 2012 at 12:43 PM, Benedikt Gehr wrote: > now I feel very silly! I swear I was trying this for a long time and it > didn't work. Now that I closed R and restarted it it works also on my > machine. > > So is the only problem that my model is overparametrized with the data I > have? P

[R] Keep rows in a dataset if one value in a column is duplicated

2012-09-27 Thread GradStudentDD
Hi, I have a data set of observations by either one person or a pair of people. I want to only keep the pair observations, and was using the code below until it gave me the error " $ operator is invalid for atomic vectors". I am just beginning to learn R, so I apologize if the code is really rough

[R] PLS-DA and LV variance with mixOmics

2012-09-27 Thread Roberto
Hi all, I need to obtain the LV variance from my PLS-DA analysis. I tried to read the reference manuale of the package, but I do not found information about that. Someone know a way to do it? Thank you, Roberto -- View this message in context: http://r.789695.n4.nabble.com/PLS-DA-and-LV-varia

[R] install.packages on windows

2012-09-27 Thread Anju R
Sometimes when I try to install certain packages I get a warning message. For example, I tried to install the package "Imtest" on windows R version 2.15.1 and got the following message: Warning message: package ‘Imtest’ is not available (for R version 2.15.1) How can I install the above package?

Re: [R] problem with nls starting values

2012-09-27 Thread Benedikt Gehr
now I feel very silly! I swear I was trying this for a long time and it didn't work. Now that I closed R and restarted it it works also on my machine. So is the only problem that my model is overparametrized with the data I have? however shouldn't it be possible to fit an nls to these data?

Re: [R] problem with nls starting values

2012-09-27 Thread Berend Hasselman
On 27-09-2012, at 21:15, Benedikt Gehr wrote: > thanks for your reply > > I agree that an lm model would fit just as well, however the expectation from > a mechanistic point of view would be a non-linear relationship. > > Also when I "simulate" data as in > > y_val<-115-118*exp(-0.12*(seq(1,

Re: [R] [R-sig-hpc] Quickest way to make a large "empty" file on disk?

2012-09-27 Thread Jonathan Greenberg
Folks: Asked this question some time ago, and found what appeared (at first) to be the best solution, but I'm now finding a new problem. First off, it seemed like ff as Jens suggested worked: # outdata_ncells = the number of rows * number of columns * number of bands in an image: out<-ff(vmode="

Re: [R] problem with nls starting values

2012-09-27 Thread Benedikt Gehr
thanks for your reply I agree that an lm model would fit just as well, however the expectation from a mechanistic point of view would be a non-linear relationship. Also when I "simulate" data as in y_val<-115-118*exp(-0.12*(seq(1,100)+rnorm(100,0,0.8))) x_val<-seq(1:100) plot(y_val~x_val) sum

Re: [R] erasing a polygon

2012-09-27 Thread Terry Therneau
I was able to puzzle it out with the help of the book "R Graphics" (Murrell). When par("bg") = "transparenent" one needs to use col="white", otherwise the old code col=0 works correctly. The default for pdf and x11, the two I use, is transparent. Terry Therneau On 09/27/2012 08:48 AM, PIKAL

Re: [R] equivalent of Stata "by construct"

2012-09-27 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Pradipto Banerjee > Sent: Thursday, September 27, 2012 9:13 AM > To: r-help@r-project.org > Subject: [R] equivalent of Stata "by construct" > > I am evaluating a switch from Stata

Re: [R] problem with nls starting values

2012-09-27 Thread Bert Gunter
My guess: You probably are overfitting your data. A straight line does about as well as anything except for the 3 high leverage points, which the minimization is probably having trouble with. -- Bert On Thu, Sep 27, 2012 at 10:43 AM, Benedikt Gehr wrote: > quantiles<-c(seq(.05,.95,0.05)) > sl

Re: [R] Speeding up time conversion

2012-09-27 Thread Prof Brian Ripley
Users forget how much is an OS service. This is OS X not R being slow. On a recent Linux box it takes about 90s. But at least you can easily parallelize it: see ?pvec in package parallel for one way to do this (and one way not to). If the file contain a high proportion of duplicates, making a

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Curt Seeliger
> And as for the thermodynamics analogy, I agree. I'm looking for Alan > Kay's to help me hide complexity. Whups, that should read "I'm looking for Alan Kay's daemon to help me hide complexity." stupid editor... cur -- Curt Seeliger, Data Ranger Raytheon Information Services - Contractor to O

[R] problem with nls starting values

2012-09-27 Thread Benedikt Gehr
Hi I would like to fit a non-linear regression to the follwoing data: quantiles<-c(seq(.05,.95,0.05)) slopes<-c( 0.00e+00, 1.622074e-04 , 3.103918e-03 , 2.169135e-03 , 9.585523e-04 ,1.412327e-03 , 4.288103e-05, -1.351171e-04 , 2.885810e-04 ,-4.574773e-04 , -2.368968e-03, -3.104634e-03, -5

Re: [R] Problem with grid.rect

2012-09-27 Thread Bert Gunter
(Sorry, forgot to cc to the list) -- Bert On Thu, Sep 27, 2012 at 10:41 AM, Bert Gunter wrote: > Perrick: > > You have an a extra ")" after yscale = > so the pushViewport statement is ignored and the rest does what you ask it to. > > -- Bert > > On Thu, Sep 27, 2012 at 9:39 AM, Pierrick Bruneau

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Curt Seeliger
From: "Daniel Nordlund" > > > > ... > > > > I'd like to have the code source files from the 'local' git repository > > > > without modification, where 'local' could mean c:\yada\ for one > > person, m:\my documents\wetlands\ for another, ... > > each user could set a PROJECT_PATH environment var

Re: [R] equivalent of Stata "by construct"

2012-09-27 Thread Duncan Murdoch
On 27/09/2012 12:13 PM, Pradipto Banerjee wrote: I am evaluating a switch from Stata to R. I don't need to extensive Statistical methods, but the main reason I am exploring the switch is the coding flexibility in R (e.g. Stata does not support linear/quadratic programming). I have been going o

[R] Speeding up time conversion

2012-09-27 Thread Fisher Dennis
R 2.15.1 OS X.7.4 Colleagues, I have a large dataset (27773536 records, the file is several GB) that contains a column of date / time entries in the format: "2/1/2011 13:25:01" I need to convert these to numeric values (ideally in seconds; the origin [e.g., 1970-01-01] is not impor

[R] SURVREG Function

2012-09-27 Thread Francesca Meucci
Hi, I need some help to manage frailty in Survreg function; in particular I'm looking for more information about frailty in survreg function applied to a loglogistic hazard function. Actually I need to develope a predictor for frailty random variable realization (similar to the Proportional Haz

[R] Problem with grid.rect

2012-09-27 Thread Pierrick Bruneau
I have a stupid problem that is currently driving me crazy... Let us suppose that I want to draw a big red square in the middle of my current device (say X11) I tried the following code : pushViewport(viewport(xscale=c(0,1), yscale=c(0,1)), just=c("center", "center")) vp1 <- viewport(x=unit(0.5,

[R] equivalent of Stata "by construct"

2012-09-27 Thread Pradipto Banerjee
I am evaluating a switch from Stata to R. I don't need to extensive Statistical methods, but the main reason I am exploring the switch is the coding flexibility in R (e.g. Stata does not support linear/quadratic programming). I have been going over the R syntax and I had a quick question: In St

Re: [R] Running different Regressions using for loops

2012-09-27 Thread Rui Barradas
Hello, Inline. Em 27-09-2012 13:52, Krunal Nanavati escreveu: Hi, Thanks for all your help. I am stuck again, but with a new problem, on similar lines. I have taken the problem to the next step now...i have now added 2 "for" loops... 1 for the Price variable...and another for the Media variabl

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Bert Gunter
Curt: Well, if you want to peer a bit more, you might wish to have a look at http://inlinedocs.r-forge.r-project.org/ . Same philosophy as Roxygen_x (keep docs together with code, generate Rd files automatically therefrom) but takes a different approach. Perhaps worth noting for both cases is tha

Re: [R] Drawing asymmetric error bars

2012-09-27 Thread marc_schwartz
On Sep 27, 2012, at 5:59 AM, Alexandra Howe wrote: > Hello, > > I have data which I have arcsin transformed to analyse. > I want to plot my data with error bars however as my data is > back-transformed my standard errors are uneven. > Is there a simple way to draw these asymmetric error bars in

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Curt Seeliger > Sent: Wednesday, September 26, 2012 5:51 PM > To: r-help@r-project.org > Subject: Re: [R] Is there a way to source from a specific Git repository > without hardcodi

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Curt Seeliger
> > I would usually do more than that: I find the R documentation system > > helpful even when I'm the only user of a package ... > > Me too - but I'd never write Rd by hand ;) instead relying on roxygen2 > ... > > But my point main was that it's very easy to start a package - and you > don't ne

Re: [R] Mac Text editors

2012-09-27 Thread Emilio López
Hello, I am not a Mac user, but I use Eclipse+StatET in both Windows and Linux, and it is the best IDE (not just text editor) for me. It supports code syntax, R and Sweave editors, object explorer, document outline, debugging, ... Besides, Eclipse has other plugins that may be useful for some tasks

Re: [R] Start and End day of a month

2012-09-27 Thread R. Michael Weylandt
On Thu, Sep 27, 2012 at 1:21 PM, Rantony wrote: > Hi, > > Can anyone please help to get "StartDay" and "End-day of a particular month" > with time ? > > For eg:- Input wil be "2012-09-27" > > i need to get output as given below > > StartDt <- "2012-09-01 00:00:01" > EndDt <- "2012-09-30 23:59:59"

Re: [R] Colsplit, removing parts of a string

2012-09-27 Thread arun
Hi, You can also try this: df2 <- data.frame(df1, colsplit(df1$x, pattern = "_", names=c("str","name"))) df2list<-list(df2$str,df2$name) df2[,2:3]<-sapply(df2list,function(x) gsub(".*(\\d)","\\1",x)) df2  # x str name #1 str1_name2   1    2 #2 str3_name5   3    5 A.K. - Original Mes

Re: [R] Running different Regressions using for loops

2012-09-27 Thread Krunal Nanavati
Hi, Thanks for all your help. I am stuck again, but with a new problem, on similar lines. I have taken the problem to the next step now...i have now added 2 "for" loops... 1 for the Price variable...and another for the Media variable I have taken 5 price variables...and 2 media variables with th

[R] Start and End day of a month

2012-09-27 Thread Rantony
Hi, Can anyone please help to get "StartDay" and "End-day of a particular month" with time ? For eg:- Input wil be "2012-09-27" i need to get output as given below StartDt <- "2012-09-01 00:00:01" EndDt <- "2012-09-30 23:59:59" - Thanks in advance -- View this message in context: http://r.

[R] Drawing asymmetric error bars

2012-09-27 Thread Alexandra Howe
Hello, I have data which I have arcsin transformed to analyse. I want to plot my data with error bars however as my data is back-transformed my standard errors are uneven. Is there a simple way to draw these asymmetric error bars in R? Thanks for your help. [[alternative HTML version del

[R] error while estimating spatial Durbin (mixed) model

2012-09-27 Thread wujunqian
Dear all, I am new here ,I attempted to use R to estimate the spatial Durbin (mixed) model,and mydata is a panel data form,and the matrix is generated by geoda software ,here is my Command and error,really hope your help ,thank you! #引入gal library(spdep) w<- read.gal("E:/splm/zj.GAL",override.id=TR

Re: [R] Calculating number of elapsed days from starting date

2012-09-27 Thread arun
Hi, You can also use either of these: data$date <- as.Date(data$date,format="%m/%d/%y") data$Days<-as.vector(sapply(lapply(split(data,data$Person),`[`,2),function(x) difftime(x[,1],x[1,],units="days"))) #or data$Days<-as.vector(sapply(lapply(split(data,data$Person),`[`,2),function(x) x[,1]-x[1

Re: [R] Error in plot.new() : figure margins too large

2012-09-27 Thread Sonny
Dear Karly, I don't know if you've resolved your problem but I just came across the same thing in RStudio and I think I've found out what the problem is. The problem seems to occur when the plot viewing panel (by default in the bottom right) is very small. The plot function tries to create a plo

Re: [R] Mac Text editors

2012-09-27 Thread marc_schwartz
On Sep 27, 2012, at 8:33 AM, Hasan Diwan wrote: > On 27 September 2012 09:26, peter dalgaard wrote: > >> (I gather that .emacs functionality ends up in >> ~/Library/Preferences/Aquamacs\ Emacs/* . You're not really expected to >> bypass the menus, though.) >> > > ~/.emacs, same place as on Li

Re: [R] erasing a polygon

2012-09-27 Thread PIKAL Petr
Hi It seems that it still works. x<-c(3,7,7,3) y<-c(4,4,6,6) par(bg="pink") plot(1:10,1:10) polygon(x, y, border=TRUE, col=0) > version _ platform i386-pc-mingw32 arch i386

Re: [R] Is there a function that runs AR model with Schwarz Bayesian Information Criteria (BIC)?

2012-09-27 Thread jpm miao
Thanks. Which function I can use for forecasting if I use the function "auto.arima()"? Should I use the function "forecast" or "predict" or anything else? Thanks, Miao 2012/9/27 Jose Iparraguirre > You'll find this in the forecast package, function auto.arima() > Regards, > José > > José Iparr

Re: [R] Colsplit, removing parts of a string

2012-09-27 Thread Johannes Radinger
Thank you, this works perfectly... best regards, Johannes On Thu, Sep 27, 2012 at 1:43 PM, Ista Zahn wrote: > Hi Johannes, > > On Thu, Sep 27, 2012 at 7:25 AM, Johannes Radinger > wrote: >> Hi, >> >> I am using colsplit (package = reshape) to split all strings >> in a column according to the s

Re: [R] Mac Text editors

2012-09-27 Thread Hasan Diwan
On 27 September 2012 09:26, peter dalgaard wrote: > (I gather that .emacs functionality ends up in > ~/Library/Preferences/Aquamacs\ Emacs/* . You're not really expected to > bypass the menus, though.) > ~/.emacs, same place as on Linux. -- Sent from my mobile device Envoyait de mon portable

Re: [R] Mac Text editors

2012-09-27 Thread peter dalgaard
On Sep 27, 2012, at 02:59 , Albyn Jones wrote: > Have you looked at aquamacs? (emacs for the mac). > its at aquamacs.org. Seconded, especially if you also want AUC-TeX features. For pure R purposes, as others have noted, the built-in editors in R.app and Rstudio are often good enough and less

[R] erasing a polygon

2012-09-27 Thread Terry Therneau
I'm updating some (very) old code, and one particular option of its plot method depends on a once-was-true trick polygon(x, y, border=TRUE, col=0) polygon(x, y, border=TRUE, density=0) would draw the polygon AND erase whatever was underneath it back to background color. Is there a reli

Re: [R] Mac Text editors

2012-09-27 Thread marc_schwartz
On Sep 26, 2012, at 8:09 PM, David Winsemius wrote: > > On Sep 26, 2012, at 6:06 PM, David Winsemius wrote: > >> >> On Sep 26, 2012, at 5:48 PM, Steven Wolf wrote: >> >>> Hi everyone, >>> >>> I've recently moved from using a windows machine to a Mac (some might call >>> it an upgrade, othe

Re: [R] Mac Text editors

2012-09-27 Thread Steven Wolf
Thanks everyone for all of your help. This has really helped me filter all of the noise about text editors on the internet. -Steve On Sep 27, 2012, at 5:41 AM, Berend Hasselman wrote: > > On 27-09-2012, at 02:48, Steven Wolf wrote: > >> Hi everyone, >> >> I've recently moved from using a

Re: [R] Colsplit, removing parts of a string

2012-09-27 Thread Rui Barradas
Hello, By looking at the output of pat <- "(str)|(_name)|( name)" strsplit(c("str1_name2", "str3_name5"), pat) [[1]] [1] "" "1" "2" [[2]] [1] "" "3" "5" I could understand why colsplit includes NAs as column 'str' values. So the hack is to fake we want three coluns and then set the first one

Re: [R] Colsplit, removing parts of a string

2012-09-27 Thread Ista Zahn
Hi Johannes, On Thu, Sep 27, 2012 at 7:25 AM, Johannes Radinger wrote: > Hi, > > I am using colsplit (package = reshape) to split all strings > in a column according to the same patterns. Here > an example: > > library(reshape2) > > > df1 <- data.frame(x=c("str1_name2", "str3_name5")) > df2 <- da

[R] Colsplit, removing parts of a string

2012-09-27 Thread Johannes Radinger
Hi, I am using colsplit (package = reshape) to split all strings in a column according to the same patterns. Here an example: library(reshape2) df1 <- data.frame(x=c("str1_name2", "str3_name5")) df2 <- data.frame(df1, colsplit(df1$x, pattern = "_", names=c("str","name"))) This is nearly what I

Re: [R] R and sell buy stock

2012-09-27 Thread Ista Zahn
On Thu, Sep 27, 2012 at 5:49 AM, Barry Rowlingson wrote: > On Wed, Sep 26, 2012 at 8:24 PM, baycan global wrote: >> Hi all, >> >> I have seen that R can be switched on to a Broker called IB. >> >> There is another one similar to IB that permits to make a "code" and send >> orders to broker to buy

Re: [R] factor expansion

2012-09-27 Thread Ista Zahn
Hi José, This sounds like a survey weight. Take a look at the survey package if you want to calculate statistics incorporating survey weights. Best, Ista On Wed, Sep 26, 2012 at 12:38 PM, Jose Bustos Melo wrote: > Thank you PIKAL Petr, > > This is used when you have a big data base of a nationa

Re: [R] Running different Regressions using for loops

2012-09-27 Thread Rui Barradas
Hello, Just to add that you can also lapply(lm.list, coef) with a different output. Rui Barradas Em 27-09-2012 09:24, David Winsemius escreveu: On Sep 26, 2012, at 10:31 PM, Krunal Nanavati wrote: Dear Rui, Thanks for your time. I have a question though, when I run the 5 regression, whose

[R] Conference: useR! 2013, 10-12 July 2013, Albacete, Spain

2012-09-27 Thread Virgilio Gómez-Rubio
We are pleased to announce that the R user conference useR! 2013 is scheduled for July 10-12, 2013, and will take place at the University of Castilla-La Mancha, Albacete, Spain. As for the predecessor conferences, the program will consist of two parts: invited lectures and user-contributed se

Re: [R] Retrieve regression summary results after rq

2012-09-27 Thread Camila Mendes
Hi all, I appreciate your help. Here are a sample of my script. I appreciate any help. David, I will go ahead and try your suggestion as well. Thanks. library(survey) clust<- svydesign(id=id, weights=wtper, strata=strat, data=data) summary(cl

Re: [R] specifying arguments in functions and calling functions, within functions

2012-09-27 Thread K. Brand
Cheers Sarah, Rui, David, Your effort clarifying my (several) confusions, especially with examples, most helpful for my understanding. Not least the value of a fresh global environment _without_ confounding objects like: > scl function(x) { median(x, na.rm=TRUE) } And proper punctuation termi

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Hadley Wickham
> I would usually do more than that: I find the R documentation system > helpful even when I'm the only user of a package (and there are the prompt* > functions for quickly creating it, as well as package.skeleton to set things > up at the beginning). Vignettes are a great way to organize and doc

Re: [R] R and sell buy stock

2012-09-27 Thread Barry Rowlingson
On Wed, Sep 26, 2012 at 8:24 PM, baycan global wrote: > Hi all, > > I have seen that R can be switched on to a Broker called IB. > > There is another one similar to IB that permits to make a "code" and send > orders to broker to buy or sell stocks? > > Can be done trough R, writte in excel and tro

Re: [R] Specifying a response variable in a Bayesian network

2012-09-27 Thread Marco Scutari
Hi Abraham, On Wed, Sep 26, 2012 at 6:06 PM, Abraham Mathew wrote: > I'm trying to teach myself about Bayesian Networks and am working with the > following data and the bnlearn package. > I understand the conceptual aspects of BNs, but I'm not sure how to specify > the response variables in R whe

Re: [R] Mac Text editors

2012-09-27 Thread Berend Hasselman
On 27-09-2012, at 02:48, Steven Wolf wrote: > Hi everyone, > > I've recently moved from using a windows machine to a Mac (some might call it > an upgrade, others not…I'll let you be the judge). Once I started using > Notepad ++ on my windows machine, I really began to like it. Unfortunately

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Duncan Murdoch
On 12-09-27 3:31 AM, Hadley Wickham wrote: I'd like to have the code source files from the 'local' git repository without modification, where 'local' could mean c:\yada\ for one person, m:\my documents\wetlands\ for another, and l:\foo\bar\sharedRemote\wet\ to another user. ... Yes. Use l

Re: [R] Mac Text editors

2012-09-27 Thread Duncan Murdoch
On 12-09-26 9:21 PM, Bhupendrasinh Thakre wrote: My vote for R-Studio. Very elegant design and great functionality. However if coming from languages like Java and others then eclipse is better. R-Studio have dedicated section for Mac user which you will find useful. One of the nice features o

Re: [R] Is there a function that runs AR model with Schwarz Bayesian Information Criteria (BIC)?

2012-09-27 Thread Pascal Oettli
Hello, RSiteSearch('ar BIC') Regards, Pascal Le 27/09/2012 17:43, jpm miao a écrit : Hello, Is there a function in R by which one can run AR model with Bayesian Information Criteria (BIC)? To my knowledge, functions ar and ar.ols could select the order only by AIC. Thanks, Miao

Re: [R] Calculating number of elapsed days from starting date

2012-09-27 Thread Berend Hasselman
On 27-09-2012, at 07:16, Marcel Curlin wrote: > Hi > I have data for events in rows, with columns for person and date. Each > person may have more than one event; > > tC <- textConnection(" > Persondate > bob 1/1/00 > bob 1/2/00 > bob 1/3/00 > dave 1/7/00 > dave 1/8/00 > dave

  1   2   >