[R] zoo, time() index()

2010-08-02 Thread Costas
Hi, I have to zoo real valued time series a and b same length. is index(a)-index(b) same as time(a)-time(b)? Which one is better? Best, Costas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] bonjour

2010-08-02 Thread Ivan Calandra
Hi! Well, I actually have no idea how to do it. But here a few more tips to get answers: - write a specific subject to your email - explain what you want to do, what you already did, what did not work, etc. - provide a reproducible example, that's really important so that people can know what

[R] removing spatial auto correlation

2010-08-02 Thread nuncio m
Hi list, I am trying to fit arima model for a grid of 360x161x338 points, where 360x161 is the spatial dimension and 338 is the number of time steps I have, which is seasonal. For this purpose I used the auto.arima function in forecast package. After fitting residuals at each grid in

[R] georR package users

2010-08-02 Thread Alaios
Greeting to everyone. I am looking for geoR users In geoR package there is a function called grf() According to the geoR short manual grf() takes the following arguments * n number of points (spatial locations) in each simulations. * grid optional. An n × 2 matrix with coordinates of

[R] about the trend comparison by R

2010-08-02 Thread 孟欣
Hi all: I've 2 groups of data,which are measured at: 1990,1991,1992,...2000. I wanna know whether the trend of 2 groups are same or not. Maybe time series analysis is suitable,but I don't know which index is fit for my purpose,and how to get the index from function of time series analysis

[R] QQ-plot – Axes

2010-08-02 Thread Tonja Krueger
I would like to change the position of the major tick marks in my qq-plot? Right now the ticks are set at 5.5, 6.0, 6.5 and 7.0. I would like them to be at 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.8 and 7.0. So I would have to remove some of the present ticks. So far I can only add ticks

[R] Confidence intervals (Weibull, LogNormal, Gumbel)

2010-08-02 Thread Tonja Krueger
Is there a way to calculate confidence intervals for other distributions than the GEV distribution (like Weibull, LogNormal, Gumbel). I used the maximum likelihood method to estimate the parameters. (For the GEV distribution I used the extReme package)

[R] Odp: Date and Time Formatting

2010-08-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.08.2010 10:21:25: Hi , I have a huge data set (192840 x 5) and would like to convert the date and time format. The data looks something like below : 0 03/01/1983 01:00 -0.10 359.0 0 03/01/1983 02:00 -0.10 359.0 0

[R] Odp: QQ-plot – Axes

2010-08-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.08.2010 09:40:51: I would like to change the position of the major tick marks in my qq-plot? Right now the ticks are set at 5.5, 6.0, 6.5 and 7.0. I would like them to be at 5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.8 and 7.0. So I

Re: [R] newton.method

2010-08-02 Thread sammyny
I have this function: function(x) -0.3*x*exp(-(((log(x)+(0.03+0.3*0.3/2)*0.5)/(0.3*sqrt(0.5)))^2)/2)/(2*sqrt(2*pi*0.5)) + 0.03*exp(-0.03*0.5)*pnorm(-(log(x)+(0.03-0.3*0.3/2)*0.5)/(0.3*sqrt(0.5))) uniroot is giving the correct results. uniroot(f,c(0,10)) $root [1] 0.7347249 $f.root [1]

Re: [R] zoo, time() index()

2010-08-02 Thread Achim Zeileis
On Mon, 2 Aug 2010, Costas wrote: Hi, I have to zoo real valued time series a and b same length. is index(a)-index(b) same as time(a)-time(b)? Yes. Which one is better? Neither. index() has been introduced because zoo series do not necessarily have to be indexed by time. In such

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Ted Harding
It may throw light on the confusion to get right down to basics: str(c(1,2,3)) # num [1:3] 1 2 3 str(1:3) # int [1:3] 1 2 3 typeof(c(1,2,3)) # [1] double typeof(1:3) # [1] integer so, to start with, they are simply not variables of the same type (real versus integer). However,

Re: [R] about the trend comparison by R

2010-08-02 Thread John Sorkin
Is this home work? Please remember that the R listserver Is not designed to answer home work problems. Hint: Assume you are interested in an outcome variable y. Regress y on year include a group term and a group by year interaction. The interaction term tells you what you want. John John Sorkin

Re: [R] finding max value in a row and reporting colum name

2010-08-02 Thread lbertolo
pdb wrote: Hi, Hopefully someone can point me in the right direction on how I would go about solving the following. I have some data and need to find the column name of the maximum value in each row. This could be the data... a - data.frame(x = rnorm(4), y = rnorm(4), z =

[R] problem with indicators for switch

2010-08-02 Thread Roy Davy
Hi, I am having some problems setting up some indicators and would appreciate any help. I have some data called 'lights' with 3 variables called x, a and b. x - is the date a - equals 1 to indicate an 'on' button is activated b - equals 1 to indicate an 'off' button is activated

Re: [R] Why do the results of paste() depend on how the argument (data.frame) is constructed?

2010-08-02 Thread S Ellison
At the risk of repeating a post I haven't read, the two constructs are different because 1:3 returns a vector of integers (class integer) and c(1, 2, 3) is a bit more conservative about what '1' and the like mean and returns a vector of class numeric. lapply(df1, class) lapply(df2, class) On

[R] Is there paid support for R?

2010-08-02 Thread Chris Murphy
Hi, I am trying to get R installed at work and I was asked if there were any companies that offered support. After searching on Google (many ways) and not find anything, I turn to you. BTW, I did see Revolution R supports their flavor. Thanks, Chris [[alternative HTML version

Re: [R] newton.method

2010-08-02 Thread Ravi Varadhan
Try this: for( x in seq(0,2,length=10)) { z - nleqslv(x,f); print(c(z$x,z$fvec))} You'll see that it identifies 0.7347242 correctly as a root. Your function goes to zero asymptotically as x gets larger. From numerical algorithms's point of view, it is essentially 0 for x 3. Thus, you have

[R] problem with calling dyn.load twice in OSX

2010-08-02 Thread Michael Lachmann
In my latest version of R (2.11.1) on OSX, loading a dynamic library twice, or unloading a loaded library causes R to get stuck. Thus, if testR.c is: --- #include stdio.h #include math.h #include R.h #include Rinternals.h #include R_ext/Rdynload.h void R_init_testR(DllInfo *info) { fprintf(

[R] Specify contrasts in R

2010-08-02 Thread Rebecca Ross
Dear Listers, Could anyone advise if this is the 'correct' contrast matrix to use to make contrasts between one treatment and the mean of 2 other treatments (in this case, mid-parent values to the F1 and F2 from a line cross experiment)? Desired contrasts are 1) P1 versus P2 2) average of P1

Re: [R] Data Handling

2010-08-02 Thread Lily_stats
Hi, I have managed to convert my data frames into xts such as : str(z) An ‘xts’ object from 1983-01-03 19:00:00 to 2006-01-01 22:00:00 containing: Data: num [1:182959, 1:2] 12.6 11.3 12.7 12.8 10.9 ... - attr(*, dimnames)=List of 2 ..$ : NULL ..$ : chr [1:2] v DD Indexed by

[R] contours: lines and colors

2010-08-02 Thread Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
Is there a way to get both contour lines and filled colors on the same contour plot? My group here doesn't want me to use the lattice package (long story). I tried over-plotting with contour() on top of filled.contour(). This will work in principle, but the required manipulation of the plotting

Re: [R] Specify contrasts in R

2010-08-02 Thread peter dalgaard
On Aug 2, 2010, at 3:53 PM, Rebecca Ross wrote: Could anyone advise if this is the 'correct' contrast matrix to use to make contrasts between one treatment and the mean of 2 other treatments (in this case, mid-parent values to the F1 and F2 from a line cross experiment)? Desired contrasts

Re: [R] reading dates in Excel into R

2010-08-02 Thread Erich Neuwirth
RExcel (available as an Excel Addin in Windows only) tries very hard to transfer dates and times faithfully to R. The package RExcelInstaller on CRAN will install it. On Jul 29, 2010, at 7:32 PM, Hongying Li wrote: I am reading dates in Excel2007 into R. Here are the functions I used:

Re: [R] Is there paid support for R?

2010-08-02 Thread Allan Engelhardt
On 02/08/10 13:17, Chris Murphy wrote: Hi, I am trying to get R installed at work and I was asked if there were any companies that offered support. There are. What country are you looking to support? What do you mean by support? (It can be anything from installation through SLAs for

Re: [R] How to understand whether a class is a S3 class?

2010-08-02 Thread David Winsemius
On Aug 1, 2010, at 2:08 PM, Megh Dal wrote: Hi, is there any way to say: this class 'x' is a S3 class? For example what is the type of class data.frame? Is it a S3 class or S4? S3 and S4 refer to methods, i.e. functions; class is an attribute of objects. And I am not sure that the

[R] Dealing with a lot of parameters in a function

2010-08-02 Thread Shentu, Yue
Hi all, I'm trying to define and log-likelihood function to work with MLE. There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between 1 to 24. Instead of listing all the parameters, one by one in the function definition, is there a neat way to do it in R ? The example is as

Re: [R] removing spatial auto correlation

2010-08-02 Thread nikhil kaza
Try r-sig-geo Look at spdep, geoR, splancs and sp packages for spatial autocorrelation. Also look at http://cran.r-project.org/web/views/Spatial.html On Mon, Aug 2, 2010 at 3:40 AM, nuncio m nunci...@gmail.com wrote: Hi list, I am trying to fit arima model for a grid of 360x161x338

Re: [R] Is there paid support for R?

2010-08-02 Thread David Smith
On Mon, Aug 2, 2010 at 5:17 AM, Chris Murphy murphysbo...@gmail.com wrote: I am trying to get R installed at work and I was asked if there were any companies that offered support. After searching on Google (many ways) and not find anything, I turn to you. BTW, I did see Revolution R supports

Re: [R] Dealing with a lot of parameters in a function

2010-08-02 Thread nikhil kaza
use 24 length vectors as parameters instead of numbers e.g. mu=rep(0.5,24) On Mon, Aug 2, 2010 at 11:00 AM, Shentu, Yue yue_she...@merck.com wrote: Hi all, I'm trying to define and log-likelihood function to work with MLE. There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i

Re: [R] problem with indicators for switch

2010-08-02 Thread jim holtman
try this: x - read.table(textConnection(a b c d + 0 0 0 0 + 0 0 0 0 + 1 0 1 1 + 1 0 1 2 + 0 0 1 3 + 0 0 1 4 + 1 0 1 5 + 0 0 1 6 + 0 0 1 7 + 0 1 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 1 0 1 1 + 0 0 1 2 + 0 0 1 3 + 0 0 1 4 + 0 1 0 0 + 0 0 0 0), header=TRUE) closeAllConnections() #

Re: [R] problem with indicators for switch

2010-08-02 Thread Charles C. Berry
On Mon, 2 Aug 2010, Roy Davy wrote: Hi, I am having some problems setting up some indicators and would appreciate any help. I have some data called 'lights' with 3 variables called x, a and b. x - is the date a - equals 1 to indicate an 'on' button is activated b - equals 1 to indicate an

Re: [R] newton.method

2010-08-02 Thread Berend Hasselman
sammyny wrote: I have this function: function(x) -0.3*x*exp(-(((log(x)+(0.03+0.3*0.3/2)*0.5)/(0.3*sqrt(0.5)))^2)/2)/(2*sqrt(2*pi*0.5)) + 0.03*exp(-0.03*0.5)*pnorm(-(log(x)+(0.03-0.3*0.3/2)*0.5)/(0.3*sqrt(0.5))) .. The newton method is not generating good result. for( x in

Re: [R] newton.method

2010-08-02 Thread sammyny
Thanks everyone for their help. I am able to see things more clearly now. cheers, Samit -- View this message in context: http://r.789695.n4.nabble.com/newton-method-tp2306111p2310426.html Sent from the R help mailing list archive at Nabble.com. __

[R] Linux Editor

2010-08-02 Thread alphaace
Hi Everyone, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way to use R was through EMACS using something like ESS. I remember that being serviceable but not always the most convenient. Is there anything comparable to the

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Michael Lachmann
On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: Hi, The following two 'df's should be the same, although their constructions are different. But they aren't the same. df1 - data.frame(X=c(1, 2, 3), Y=c(4, 5, 6)) df2 - data.frame(X=1:3, Y=4:6) identical(df1, df2) yields FALSE

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Erik Iverson
Michael Lachmann wrote: On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: Hi, The following two 'df's should be the same, although their constructions are different. But they aren't the same. df1 - data.frame(X=c(1, 2, 3), Y=c(4, 5, 6)) df2 - data.frame(X=1:3, Y=4:6) identical(df1,

Re: [R] Linux Editor

2010-08-02 Thread Seeliger . Curt
Is there anything comparable to the mac version of R with its built in console, editor, etc?? Aside from ESS/EMACS, you might try JGR, Tinn-R and Eclipse with StatET. The later has the most features and is the best IDE, and we're in the process of migrating to it from Tinn-R. cur -- Curt

Re: [R] Dealing with a lot of parameters in a function

2010-08-02 Thread Wu Gong
Hi, Putting all parameters into a data frame would help. Code like: parameters - data.frame(mu=1:24,b=(1:24)*2,tau=(1:24)/2,sigma=(1:24)^2,ro=sqrt(1:24)) ll- function(parameters){ results - numeric(24) for (i in 1:24){ mu - parameters$mu[i] b - parameters$b[i]

[R] ff objects and ordinary analytical functions.

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, Can the plenty of analytical functions provided by base R and contributed packages be called with ff objects as parameters directly, or do we have to write special version of the functions for ff objects? If it is the latter case, is there a list of functions which support ff

Re: [R] Can saved R object .RData files be loaded by more than one R sessions for read only purpose?

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, Shared reading should be fine. Shared writing is also possible, but it is important to understand that .RData files do only contain the meta-data of ff objects, not the ff data itself. This means you cannot have multiple processes updating the same .RData metadata but you can have

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Michael Lachmann
Erik Iverson-3 wrote: Michael Lachmann wrote: On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: Hi, The following two 'df's should be the same, although their constructions are different. But they aren't the same. df1 - data.frame(X=c(1, 2, 3), Y=c(4, 5, 6)) df2 -

[R] Error msg in optim : (list) object cannot be coerced to type 'double'

2010-08-02 Thread Shentu, Yue
Hi all, Thanks to the suggestion from Nikhil to use vector parameters, I have made some progress with my MLE code. I have however encountered another problem with the optimization step. The code is as follows: est.x-as.vector(tapply(Diff_A1c_6_0,factor(Study_Compound_ID),mean)) ll-

[R] Multibyte characters in (row) names

2010-08-02 Thread Richard R. Liu
I have an array with names which contain multibyte characters.  When I try to write the array to a file using write.table and row.names = T I receive an error message when the first such name is encountered, saying that I have not specified the option to generate NA instead.  I really would be

[R] Apply function to two variables

2010-08-02 Thread Suphajak Ngamlak
Dear all, I would like to apply a function to two vectors For example, A-c(NA,1,2,3,NA) B-6:10 I would like C to be equal to A but if any A element is NA that corresponding c element is equal to B, i.e. C = c(6,1,2,3,10) Please note that this is a simplified example and the real vectors are

Re: [R] Apply function to two variables

2010-08-02 Thread Erik Iverson
I would like to apply a function to two vectors For example, A-c(NA,1,2,3,NA) B-6:10 I would like C to be equal to A but if any A element is NA that corresponding c element is equal to B, i.e. C = c(6,1,2,3,10) #untested... C - ifelse(is.na(A), B, A)

Re: [R] Linux Editor

2010-08-02 Thread Scionforbai
Hi, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way to use R was through EMACS using something like ESS. I remember that being serviceable but not always the most convenient. Is there anything comparable to the mac

Re: [R] Multibyte characters in (row) names

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 12:56 PM, Richard R. Liu wrote: I have an array with names which contain multibyte characters. When I try to write the array to a file using write.table and row.names = T I receive an error message when the first such name is encountered, saying that I have not

[R] Problems with normality req. for ANOVA

2010-08-02 Thread wwreith
I am conducting an experiment with four independent variables each of which has three or more factor levels. The sample size is quite large i.e. several thousand. The dependent variable data does not pass a normality test but visually looks close to normal so is there a way to compute the affect

Re: [R] Is there paid support for R?

2010-08-02 Thread raghu
I think Mango-solutions does it as well? On Mon, Aug 2, 2010 at 2:12 PM, Chris Murphy [via R] ml-node+2310258-1288637364-309...@n4.nabble.comml-node%2b2310258-1288637364-309...@n4.nabble.com wrote: Hi, I am trying to get R installed at work and I was asked if there were any companies that

[R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Conor Lawless
Hello, I can`t figure out how to include a text file for use in an example in the .Rd help files of an R package I am writing. I want the examples section of one help file to look like this: \examples{ # Load the JAGS model mod - jags.model(model.txt) } The function jags.model tries to read

Re: [R] Can saved R object .RData files be loaded by more than one R sessions for read only purpose?

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, Shared reading should be fine. Shared writing is also possible, but it is important to understand that .RData files do only contain the meta-data of ff objects, not the ff data itself. This means you cannot have multiple processes updating the same .RData metadata but you can have

Re: [R] Linux Editor

2010-08-02 Thread Michael Lachmann
[shameless plug] I use TeXmacs with R. You can have R in a session. And you can even insert graphs into your session. http://www.texmacs.org/tmweb/plugins/statistics.en.html#r (But then, I wrote the interface between R and TeXmacs) Michael -- View this message in context:

[R] (no subject)

2010-08-02 Thread Millo Giovanni
Dear Hao-pang, it is impossible to really tell the problem without a reproducible example. Just guessing: this looks like you have too many regressors. In GMM, lags of variables are used as instruments, so you might have more regressors than observations. Try reducing the 'lag' argument (which,

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 9:33 AM, wwreith wrote: I am conducting an experiment with four independent variables each of which has three or more factor levels. The sample size is quite large i.e. several thousand. The dependent variable data does not pass a normality test but visually looks

Re: [R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Prof Brian Ripley
Here is how I do it: write( model { for (year in 1:N) { D[year] ~ dpois(mu[year]) log(mu[year]) - b[1] + step(year - changeyear) * b[2] } for (j in 1:2) { b[j] ~ dnorm(0.0, 1.0E-6) } changeyear ~ dunif(1,N) } , coalmining.jags) which has the advantage that the model

Re: [R] Convert an expression to a function

2010-08-02 Thread William Dunlap
I prefer to treat expressions as language objects as much as possible instead of converting them to text strings, using gsub() on the text strings, and then parsing the modified text strings. The following uses text processing to convert variable names like b3 to calls like b[3] but otherwise

[R] Import data from dynamically changing spreadsheet

2010-08-02 Thread ShAkEs
Hello R List... I am seeking to continually make a call to an excel sheet and pull data from it. The data on the excel sheet keeps changing real time and I need to pull this data in R. Can someone please suggest me how to do the same. Thank you. -- View this message in context:

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Frank Harrell
To add to David's note, the Kruskal-Wallis test is the nonparametric counterpart to one-way ANOVA. You can get a series of K-W tests for several grouping or continuous independent variables (but note these are SEPARATE analyses) using the Hmisc package's spearman2 function. The generalization

Re: [R] Is there paid support for R?

2010-08-02 Thread Tal Galili
As others have mentioned, A simple place to start looking at would be to go through the list on the wiki page: http://en.wikipedia.org/wiki/R_(programming_language)#Commercialized_versions_of_R And contacting the companies one by one. The other alternative I would check is to contact the

Re: [R] Linux Editor

2010-08-02 Thread Bos, Roger
I use RKWard and find it to be pretty good. It show the consol built-in and has good editing features. You can add custom shortcuts so I can make it work just like I make Tinn-R work (i.e. hit F10 to run selected code, etc.). Please note that Tinn-R is not available on Linux (to my knowledge),

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Bert Gunter
David et. al: I take issue with this. It is the lack of independence that is the major issue. In particular, clustering, split-plotting, and so forth due to convenience order experimentation, lack of randomization, exogenous effects like the systematic effects due to measurement method/location

Re: [R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Ben Bolker
Prof Brian Ripley ripley at stats.ox.ac.uk writes: Here is how I do it: write( model { for (year in 1:N) { D[year] ~ dpois(mu[year]) log(mu[year]) - b[1] + step(year - changeyear) * b[2] } for (j in 1:2) { b[j] ~ dnorm(0.0, 1.0E-6) } changeyear ~

Re: [R] Linux Editor

2010-08-02 Thread Liviu Andronic
On Mon, 2 Aug 2010 08:48:54 -0700 seeliger.c...@epamail.epa.gov wrote: Is there anything comparable to the mac version of R with its built in console, editor, etc?? Aside from ESS/EMACS, you might try JGR, Tinn-R and Eclipse with StatET. The later has the most features and is the best IDE,

[R] read the middle of a file

2010-08-02 Thread R Heberto Ghezzo, Dr
Hello, The other day Justin Peter presented a mini program to plot a topographic map with an overlay of the worldHires. I seemed interesting so I checked the ETOPO5 site and find that there is a new file ETOPO1 with a 1 minute grid. I downloaded it and tried a similar procedure. Now the

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread David Winsemius
In a general situation of observational studies, your point is undoubtedly true, and apparently you believe it to be true even in the setting of designed experiments. Perhaps I should have confined myself to my first sentence. -- David. On Aug 2, 2010, at 2:05 PM, Bert Gunter wrote:

[R] repeated measures with a group factor

2010-08-02 Thread Jerome L. Myers
I have a between-subjects factor, A, with three levels, and a within-subjects factor with 4 levels. There are 6 subjects at each A level. I get the correct F tests using the aov function with the stack form of the data frame but I want the epsilon adjustment (Greenhouse-Geisser, Huynh-Feldt).

Re: [R] Linux Editor

2010-08-02 Thread Joseph Magagnoli
In addition, there is SciViews for Komodo edit http://www.sciviews.org/SciViews-K/ Joe On Mon, Aug 2, 2010 at 10:35 AM, alphaace rsa...@comcast.net wrote: Hi Everyone, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread wwreith
I am testing normality on the studetized residuals that are generated after performing ANOVA and yes I used Levene's test to see if the variances can be assumed equal. They infact are not, but I have found a formula for determining whether the p-value for ANOVA will become larger or smaller as

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Bert Gunter
My sympathies, but I don't think it's the business of list contributors to facilitate stupidity. Confidence interval for the p-value is nonsense. You could try sensitivity analyses via simulation, though. Cheers, Bert Gunter Genentech Nonclinical Biostatistics On Mon, Aug 2, 2010 at 11:31 AM,

[R] Using apply for logical conditions

2010-08-02 Thread Alastair
Hi, I've got some boolean data in a data.frame in the form: XYZA B C [1] T TFT F F [2] F TTF F F . . . What I want to do is create a new column which is the logical disjunction of several of the columns. Just like: new.column - data$X |

Re: [R] ggplot2 histograms... a subtle error found

2010-08-02 Thread Brian Diggs
On 7/28/2010 5:04 PM, Mike Williamson wrote: Hello all, I have a peculiar and particular bug that I stumbled across with ggplot2. I cannot seem to replicate it with anything other than my specific data set. Here is the problem: - when I try to plot a histogram, allowing for

Re: [R] Using apply for logical conditions

2010-08-02 Thread Allan Engelhardt
`|` is a binary operator which is why the apply will not work. See help(Reduce) For example, set.seed(1) data - data.frame(A = runif(10) 0.5, B = runif(10) 0.5, C = runif(10) 0.5) Reduce(`|`, data) # [1] TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE Hope this helps.

Re: [R] Using apply for logical conditions

2010-08-02 Thread Erik Iverson
Alastair wrote: Hi, I've got some boolean data in a data.frame in the form: XYZA B C [1] T TFT F F [2] F TTF F F . . . What I want to do is create a new column which is the logical disjunction of several of the columns. Just like:

Re: [R] Using apply for logical conditions

2010-08-02 Thread Joshua Wiley
In addition to Reduce(), you can take a look at ?any for '|' and ?all for ''. Josh On Mon, Aug 2, 2010 at 1:43 PM, Allan Engelhardt all...@cybaea.com wrote: `|` is a binary operator which is why the apply will not work.  See help(Reduce) For example, set.seed(1) data - data.frame(A =

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Stephan Kolassa
Hi, simulating would still require you to operationalize the lack of normality. Are the tails too heavy? Is the distribution skewed? Does it have multiple peaks? I suspect that the specific choices you would make here would *strongly* influence the result. My condolences on the client you

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Wu Gong
I have been struggling to make the sense of permutation test for weeks. It seems will work for you. - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Problems-with-normality-req-for-ANOVA-tp2310275p2310967.html Sent from the R help mailing list archive at

Re: [R] Using apply for logical conditions

2010-08-02 Thread Michael Lachmann
Reduce() is much nicer, but I usually use rowSums(A) 0 for 'or', and rowSums(A) == ncols for 'and'. Which works slightly faster. I noticed, though, that Reduce() doesn't work on matrices. Is there an alternative for matrices, or do you have to convert the matrix first to a data.frame, and

[R] lm length

2010-08-02 Thread Trying To learn again
Hi all, I wanto to run a plot about the levels of a variable parting on an ols regression. The regression in done on the rate of return of the variable. Imagine R_{t}=a+b*R_{t-1} So If P, the estimated price would be P_{t}=P_{t-1}*R_{t} Imagine that I obtain lm fitted values and the original

[R] read SAS dataset using read.ssd()

2010-08-02 Thread array chip
Hi, I am using read.ssd() from foreign package to read some SAS datasets. I have 2 types of SAS datasets, one with sas7bdat extension, the other with ssd01 extension. I have no problem with the first dataset type, but got the following error message with the 2nd dataset type (with ssd01

Re: [R] Using apply for logical conditions

2010-08-02 Thread Bert Gunter
Yes, you must do the conversion. The reason is that Reduce requires its argument x, to be a vector; and a matrix is seen a vector obtained by columnwise concatenation. e.g. Reduce(+,matrix(1:6,nr=3)) [1] 21 Reduce(+,1:6) [1] 21 The data frame is seen as a list with elements the columns of the

Re: [R] lm length

2010-08-02 Thread Erik Iverson
Trying To learn again wrote: Hi all, I wanto to run a plot about the levels of a variable parting on an ols regression. The regression in done on the rate of return of the variable. Imagine R_{t}=a+b*R_{t-1} So If P, the estimated price would be P_{t}=P_{t-1}*R_{t} Imagine that I obtain

Re: [R] Using apply for logical conditions

2010-08-02 Thread Joshua Wiley
On Mon, Aug 2, 2010 at 2:08 PM, Michael Lachmann lachm...@eva.mpg.de wrote: Reduce() is much nicer, but I usually use rowSums(A) 0 for 'or', and rowSums(A) == ncols for 'and'. Which works slightly faster. For the sake of my own curiosity, I compared several of these options, but in case

Re: [R] Using apply for logical conditions

2010-08-02 Thread Michael Lachmann
Reduce() is really amazingly fast! Even with a much larger number of columns, it is still in the same ballpark (and much more readable): boolean - c(TRUE, rep(FALSE,10^3)) a-matrix(sample(boolean, 10^7, replace = TRUE),10^4,10^3) b-data.frame(a) system.time({opt4 - rowSums(a, na.rm = TRUE)

Re: [R] Using apply for logical conditions

2010-08-02 Thread Bert Gunter
Just for fun, here are another couple of versions that work for data frames. For Reduce with | do.call(pmax,c(mydata,na.rm=TRUE)) 0 and for do.call(pmin,c(mydata,na.rm=TRUE)) 0  Cheers, Bert Gunter Genentech Nonclinical Biostatistics On Mon, Aug 2, 2010 at 2:28 PM, Joshua Wiley

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Cecilia Carmo
Thank you for your help but I don't understand how can I have a dataframe with the columns: firm, year, industry, X1 and X2. Could you help me (again)? Cecília Carmo Em Sat, 31 Jul 2010 22:10:38 -0400 jim holtman jholt...@gmail.com escreveu: This will split the data by industry year and

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Frank Harrell
In addition the poster did not tell us what is wrong with a nonparametric test. Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Mon, 2 Aug 2010, Bert Gunter wrote: My sympathies, but I don't

Re: [R] Using apply for logical conditions

2010-08-02 Thread Alastair
Wow, Thanks for all the excellent (and fast) responses. That's really helped. Sorry I didn't supply a cut and paste-able example (noted for future reference) but your examples caught the essence of my problem. I ended up opting for the apply any solution. But I'll bear the Reduce function in

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread jim holtman
This is just following up with the example data you sent. This will create a list 'result' that will have the subset of data between the 10% 90%-tiles of the data: #My reproducible example: firm-sort(rep(1:1000,10),decreasing=F) year-rep(1998:2007,1000)

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Cecilia Carmo
Thank you again, but I think I need to do some homework about the split function, because I'm not understanding it very well. Besides, I think I still have a problem. I also need X2 = X1 winsorized: X2 is equal to X1 between 10%-90%, and is equal to the 10% value when 10% and equal to the 90%

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread jim holtman
I had to look up winsorized; this should do it: #My reproducible example: firm-sort(rep(1:1000,10),decreasing=F) year-rep(1998:2007,1000) industry-rep(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10),rep(6,10),rep(7,10),rep(8,10),rep(9,10), + rep(10,10)),1000) X1-rnorm(1)

Re: [R] read SAS dataset using read.ssd()

2010-08-02 Thread array chip
Looks like the log file is not appropriately attached. Here it is again. Thanks for any suggestions. John - Original Message From: array chip arrayprof...@yahoo.com To: r-help@r-project.org Sent: Mon, August 2, 2010 2:18:32 PM Subject: [R] read SAS dataset using read.ssd() Hi, I am

[R] Confidence Bands in nonlinear regression using optim and maximum likelihood

2010-08-02 Thread Cristian Montes
Hello, I am trying to plot confidence bands on the mean and prediction bands for the following nonlinear regression, using maximum likelihood via optim. A toy example with data and code of what I am trying to accomplish is: VOL-c(0.01591475, 1.19147935 ,6.34102460, 53.68809287, 91.90143074,

Re: [R] Linux Editor

2010-08-02 Thread Shige Song
Michael, Does TexMacs works with the latest R? Shige On Tue, Aug 3, 2010 at 1:16 AM, Michael Lachmann lachm...@eva.mpg.de wrote: [shameless plug] I use TeXmacs with R. You can have R in a session. And you can even insert graphs into your session.

Re: [R] Linux Editor

2010-08-02 Thread Michael Bibo
alphaace rsaber at comcast.net writes: Hi Everyone, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way to use R was through EMACS using something like ESS. I remember that being serviceable but not always the most

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Glen Barnett
This might help some: RSiteSearch(winsorize) On Sun, Aug 1, 2010 at 11:39 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote: Hi everyone! #I need a loop or a function that creates a X2 variable that is X1 without the extreme values (or X1 winsorized) by industry and year. #My reproducible

[R] sorting by date

2010-08-02 Thread Leigh E. Lommen
I am unsure how to sort a column by date if it is currently in the form: MMDD For example the months: 20071031 20071130 20071231 Etc. Regards, Leigh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Linux Editor

2010-08-02 Thread Michael Lachmann
In general, yes. I work with it all the time, with the latest R (2.11.1) However, I am using an older version of TeXmacs - 1.0.7.2, working with the X11 interface. When I try a newer version, 1.0.7.3 compiled with the QT interface on OSX, and 1.0.7.4, I seem to have problems. I'm still not

Re: [R] Linux Editor

2010-08-02 Thread Shige Song
Dear Michael, Thanks for the effort. I am running 64-bit Ubuntu Linux. Shige On Tue, Aug 3, 2010 at 8:17 AM, Michael Lachmann lachm...@eva.mpg.de wrote: In general, yes. I work with it all the time, with the latest R (2.11.1) However, I am using an older version of TeXmacs - 1.0.7.2, working

Re: [R] sorting by date

2010-08-02 Thread Nikhil Kaza
a - c( 20071031,20071130, 20071231) b- sort(as.Date(as.character(a), format=%Y%M%d)) On Aug 2, 2010, at 8:03 PM, Leigh E. Lommen wrote: I am unsure how to sort a column by date if it is currently in the form: MMDD For example the months: 20071031 20071130 20071231 Etc.

  1   2   >