Re: [R] Duplicated function with conditional statement

2013-07-27 Thread arun
Dear Vanessa, Glad to know that it works. Sorry, I misunderstood ur question initially because there were no duplicates for "product" from response=="buy" in your initial dataset (tt). Regarding the code: what i did in brief is: 1. Find the rows with response=="buy  indx<- which(dat[,colName]=="bu

Re: [R] tikzDevice

2013-07-27 Thread David Arnold
The following minimal example Sweave file compiled properly in RStudio. \documentclass{article} \begin{document} Example text outside R code here; we know the value of pi is \Sexpr{pi}. <>= set.seed(1213) # for reproducibility x = cumsum(rnorm(100)) mean(x) # mean of x plot(x, type = 'l') # B

Re: [R] tikzDevice

2013-07-27 Thread David Arnold
I am using a MacBook Pro, 10.6.8, R version 3.0.1. and RStudio 0.97.551. I entered your command in the Console Window in RStudio and got the following reply: > install.packages('tikzDevice', repos='http://r-forge.r-project.org', > type='source') Warning in install.packages : package ‘tikzDevice’

Re: [R] tikzDevice

2013-07-27 Thread Yihui Xie
It seems I can still install from source under Ubuntu: install.packages('tikzDevice', repos='http://r-forge.r-project.org', type='source') If you are under Windows, I think you have to install RTools. I'm cc'ing its author to see if there is still hope to get it back to CRAN, or if someone else

[R] tikzDevice

2013-07-27 Thread David Arnold
All, What is the current method for installing tikzDevice in R version 3.0.1? I'd like to use it with knitr and RStudio. Thanks. D. -- View this message in context: http://r.789695.n4.nabble.com/tikzDevice-tp4672523.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] Duplicated function with conditional statement

2013-07-27 Thread arun
If you wanted to wrap it in a function: fun1<- function(dat,colName,newColumn){   indx<- which(dat[,colName]=="buy")   dat[,newColumn]<-0   dat[unique(unlist(lapply(seq_along(indx),function(i){             x1<- if(i==length(indx)){                 seq(indx[i],nrow(dat))              }

Re: [R] Duplicated function with conditional statement

2013-07-27 Thread arun
HI, May be this is what you wanted. #using tt1 indx<-which(tt1$response=="buy") tt1$newcolumn<-0 tt1[unique(unlist(lapply(seq_along(indx),function(i){x1<-if(i==length(indx)) seq(indx[i],nrow(tt1)) else if((indx[i+1]-indx[i])==1) indx[i] else seq(indx[i]+1,indx[i+1]-1);x2<- tt1[unique(c(indx[1:i]

Re: [R] Duplicated function with conditional statement

2013-07-27 Thread vanessa van der vaart
Dear all,, thank you all for your help..Its been such a help but its not really exactly what I am looking for. Apparently I havent explained the condition very clearly. I hope this can works. If the data on column product is duplicated from the previous row, (its applied for response==buy and ==sa

Re: [R] Alternative method for range-matching within 2 nested loops in R?

2013-07-27 Thread Bert Gunter
Perhaps: ?findInterval (you may need to do some type conversion first) -- Bert On Sat, Jul 27, 2013 at 3:28 PM, John Helly wrote: > Hi. > > I've been puzzling about how to replace the nested loops below. The idea is > that the B dataframe has rows with a posix datetime and the C dataframes has

Re: [R] smooth.spline gives different results from sreg ?

2013-07-27 Thread Duncan Murdoch
On 13-07-27 2:50 PM, Jean-Luc Dupouey wrote: Dear R-helpers, I compared various programs for cubic spline smoothing, and it appeared that smooth.spline ( stats version 3.0.1) seems to behave surprisingly. For enough long series and low values of lambda (or spar), the results of smooth.spline see

[R] smooth.spline gives different results from sreg ?

2013-07-27 Thread Jean-Luc Dupouey
Dear R-helpers, I compared various programs for cubic spline smoothing, and it appeared that smooth.spline ( stats version 3.0.1) seems to behave surprisingly. For enough long series and low values of lambda (or spar), the results of smooth.spline seem to be different from those of sreg ( packa

[R] Alternative method for range-matching within 2 nested loops in R?

2013-07-27 Thread John Helly
Hi. I've been puzzling about how to replace the nested loops below. The idea is that the B dataframe has rows with a posix datetime and the C dataframes has posix Start and End times. I want to assign a value to the observations in B based in intersecting the appropriate time-interval in C.

Re: [R] linear fit function with NA values

2013-07-27 Thread arun
HI, I couldn't get any error message with the data you provided. return<- read.table(text="   ATI    AMU -1  0.734    9.003 0    0.999    2.001 1    3.097    -1.003 2    NA    NA 3    NA    3.541 ",sep="",header=TRUE) median<- read.table(text="   ATI    AMU -1  3.224   

Re: [R] linear fit function with NA values

2013-07-27 Thread iza.ch1
Hi Thanks for your hints. I would like to describe my problem better and give an examle of the data that I use. I conduct the event study and I need to create abnormal returns for the daily stock prices. I have for each stock returns from time period of 8 years. For some days I don't have the

Re: [R] repeated measures logistic regression

2013-07-27 Thread Ben Bolker
Stanislav Aggerwal gmail.com> writes: > > I have searched the r-help archive and saw only one > unanswered post related > to mine. Take a look at the r-sig-mixed-models (@r-project.org) mailing list and archive ... > > My design is as follows. > >- y is Bernoulli response >- x1 is

[R] repeated measures logistic regression

2013-07-27 Thread Stanislav Aggerwal
I have searched the r-help archive and saw only one unanswered post related to mine. My design is as follows. - y is Bernoulli response - x1 is continuous variable - x2 is categorical (factor) variable with two levels The experiment is completely within subjects. That is, each subject r

Re: [R] add different regression lines for groups on ggplot

2013-07-27 Thread John Kane
I have not tried anything like that but have a look at www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CDkQFjAC&url=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F7476022%2Fgeom-point-and-geom-line-for-multiple-datasets-on-same-graph-in-ggplot2&ei=MfHzUej7FoSergG1_ICYAw&usg=AFQjCNH2b72a6

Re: [R] linear fit function with NA values

2013-07-27 Thread arun
HI, set.seed(28) dat1<- as.data.frame(matrix(sample(c(NA,1:20),100,replace=TRUE),ncol=10)) set.seed(49) dat2<- as.data.frame(matrix(sample(c(NA,40:80),100,replace=TRUE),ncol=10))  lapply(seq_len(ncol(dat1)),function(i) {lm(dat2[,i]~dat1[,i])}) #works bcz the default setting removes NA Regarding

Re: [R] problem with ldpaths and new R

2013-07-27 Thread Erin Hodgess
I did indeed install the r-base-dev. However, I did not send to the Debian mailing list. Thanks, Erin On Sat, Jul 27, 2013 at 12:27 AM, David Winsemius wrote: > > On Jul 26, 2013, at 9:45 PM, Erin Hodgess wrote: > > > Hello! > > > > I have just installed R on an Ubutnu machine (13.04) > > Did

Re: [R] Hmisc ctable rotate option obsolete?

2013-07-27 Thread Simon Zehnder
So, I downloaded the source files of Hmisc and changed in the file latex.s line 688 'rotate' to 'sideways'. This does the work for landscape ctables in Latex. I also wrote an email to the package maintainer. I consider this thread as solved. Best Simon On Jul 26, 2013, at 5:34 PM, Simon Ze

Re: [R] list of valid characters in object names

2013-07-27 Thread Liviu Andronic
On Sat, Jul 27, 2013 at 3:08 PM, Duncan Murdoch wrote: > Your question is a little ambiguous. All characters are allowed in object > names, but the parser will only recognize some of them if they are quoted in > backticks. > > The ones it recognizes without the backticks are ones that the C isaln

Re: [R] list of valid characters in object names

2013-07-27 Thread Duncan Murdoch
On 13-07-27 7:36 AM, Liviu Andronic wrote: Dear all, Could someone please point me to the definitive list of valid characters that are allowed in object names in R? I believe that the following list covers them: _.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 but I would like to

[R] linear fit function with NA values

2013-07-27 Thread iza.ch1
Hi Quick question. I am running a multiple regression function for each column of two data sets. That means as a result I get several coefficients. I have a problem because data that I use for regression contains NA. How can I ignore NA in lm function. I use the following code for regression:

[R] Fwd: modeest with non-numeric data?

2013-07-27 Thread Tom Hopper
Hello, (Apologies for the repost, but it appears that the original text was garbled.) I have recently discovered the modeest library, and am trying to understand how to use it with non-numeric data (e.g. determining the most common last name, or analysing customer demographics by zip code). I ha

[R] list of valid characters in object names

2013-07-27 Thread Liviu Andronic
Dear all, Could someone please point me to the definitive list of valid characters that are allowed in object names in R? I believe that the following list covers them: _.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 but I would like to make sure. Thank you, Liviu -- Do you kn

Re: [R] R base package grid does not output raster image

2013-07-27 Thread Terry
Prof Brian Ripley stats.ox.ac.uk> writes: > Basically Remote Desktop restricts the number of colours when connecting > to a Windows Server machine, and interpolating rasters needs a lot of > colours. Hi Brain, I looked into this further and have a solution. 1. On the server launch Remote Des