Re: [R] avoiding loop

2009-11-02 Thread parkbomee
This is the Rprof() report by self time. Is it also possible that these routines, which take long self.time, are causing the optim() to be slow? $by.self self.time self.pct total.time total.pct FUN 94.16 16.5 94.16 16.5 unlist

[R] for parameter 'keep' in 'step'

2009-11-02 Thread Wenxin Liu
Hello Lady or Sir, I want to do model selection with 'step' function. But there is a trouble to me. For example, there are 5 independent variables, X0,X1,X2,X3 and X4; and 1 dependent variable y. I want to run stepwise regression y ~ X0 + X1 + X2 + X3 + X4, and I want to keep X0 always in the

Re: [R] Titles on lattice colorkey

2009-11-02 Thread RBlonk
Dear Mark and all, I am searching for a way to add a title to the colorkey in contourplot (lattice) too and happy to see I am not the only one with this problem. Did you already find out a solution, or is anyone else able to help us? (For others, see below for an example by Mark) regards,

[R] Lattice: Saving Plots with Legend

2009-11-02 Thread Koffler Daniel
Dear R Users! I've want to save a lattice parallel plot with legend as png: Plotting with legend works well, but when trying to save the plot there occurs a problem with the legend. ### require(lattice) #Some data: data-matrix(rnorm(100),ncol=5)

Re: [R] R strucchange question: recursive-based CUSUM

2009-11-02 Thread Julia Bondarenko
Achim Zeileis wrote: Julia: I'm trying now to apply the package strucchange to see whether there is a structural change in linear regression. I have noted the following problem that arises in my case with recursive-based CUSUM: generic function recresid() in efp() generates an error, since

Re: [R] wilcox.test construction in r

2009-11-02 Thread jomni
Thanks for all the help. I also checked Dalgaard's R book and the explanation of the wilcox.test is very clear compared to the example in R documentation. Thanks. :handshake: -- View this message in context: http://old.nabble.com/wilcox.test-construction-in-r-tp26148779p26156041.html Sent from

Re: [R] Plots with k-means

2009-11-02 Thread Javed Pathan
Hi, You can use Mulitidimensional Scaling techinque on the Cluster center data with 2 dimensions. And then you can plot the the dimensional coordinates to get the feel of clusters. Javed On Sun, Nov 1, 2009 at 3:48 AM, Albyn Jones jo...@reed.edu wrote: oops, I see the answer in your

[R] how can I convert .csv format to matrix???

2009-11-02 Thread bbslover
In my disk C:/ have a a.csv file, I want to read it to R, importantly, when I use x=read.csv(C:/a.csv) ,the x format is data.frame, I want to it to become matrix format, how can I do it ? thank you! -- View this message in context:

Re: [R] using exists with coef from an arima fit

2009-11-02 Thread Peter Ehlers
Erin Hodgess wrote: Dear R People: I have the output from an arima model fit in an object xxx. I want to verify that the ma1 coefficient is there, so I did the following: xxx$coef ar1ar2ma1 intercept 1.3841297 -0.4985667 -0.996 -0.1091657 str(xxx$coef) Named

Re: [R] how can I convert .csv format to matrix???

2009-11-02 Thread Steven Kang
can try matrix.x - as.matrix(x) On Mon, Nov 2, 2009 at 8:38 PM, bbslover dlu...@yeah.net wrote: In my disk C:/ have a a.csv file, I want to read it to R, importantly, when I use x=read.csv(C:/a.csv) ,the x format is data.frame, I want to it to become matrix format, how can I do it

Re: [R] Using processed objects as arguments of a function

2009-11-02 Thread Jim Lemon
On 11/02/2009 05:04 PM, Steven Kang wrote: Dear R users, I wish to utilise processed and saved objects as arguments of a function. Specifically, I have created objects using *assign* *paste* functions with an incremental index i, the names of the objects are: fund1, fund2, fund3,.,

[R] Avoiding for loops

2009-11-02 Thread Noah Silverman
Hi, I'm trying to normalize some data. My data is organized by groups. I want to normalize PER GROUP as opposed to over the entire data set. The current double loop that I'm using takes almost an hour to run on about 30,000 rows of data in 2,500 groups. I'm currently doing this:

Re: [R] for parameter 'keep' in 'step'

2009-11-02 Thread Peter Ehlers
Wenxin Liu wrote: Hello Lady or Sir, I want to do model selection with 'step' function. But there is a trouble to me. For example, there are 5 independent variables, X0,X1,X2,X3 and X4; and 1 dependent variable y. I want to run stepwise regression y ~ X0 + X1 + X2 + X3 + X4, and I want to keep

Re: [R] Avoiding for loops

2009-11-02 Thread Dimitris Rizopoulos
you could try something along these lines: data - data.frame(y = rnorm(100), group = rep(1:10, each = 10)) data$sum - ave(data$y, data$group, FUN = sum) data$norm.y - data$y / data$sum data I hope it helps. Best, Dimitris Noah Silverman wrote: Hi, I'm trying to normalize some data. My

[R] kernel density estimation and classification

2009-11-02 Thread wk y
Hi, I am interested to use Kernel Density Estimation on bivariate data for multi-class classification. So far, I have managed to use the 'ks' package to plot the contours of the kernel density estimates based on 8-class training dataset with only 2 variables. However, I do not know

[R] Quarterly data in PLM package

2009-11-02 Thread Millo Giovanni
Dear Jose, I can't see why it shouldn't, as long as the quarterly index has a natural and recognizable ordering: this could be the only issue. Do not expect 'plm' to cope with things like mar-09, apr-09, ..., at least not out of the box (maybe there is room for improvement here). All the rest

Re: [R] Lattice: Saving Plots with Legend

2009-11-02 Thread Peter Ehlers
Koffler Daniel wrote: Dear R Users! I've want to save a lattice parallel plot with legend as png: Plotting with legend works well, but when trying to save the plot there occurs a problem with the legend. ### require(lattice) #Some data:

[R] question about difference in date objects

2009-11-02 Thread Phil Smith
Hi R Community: I want to take the difference in two dates: dt2 - dt1. But, I want the answer in months between those 2 dates. Can you advise me? Please respond to: p...@cdc.gov Thank you! Phil Smith Centers for Disease Control and Prevention __

Re: [R] Avoiding for loops

2009-11-02 Thread Peter Dalgaard
Dimitris Rizopoulos wrote: you could try something along these lines: data - data.frame(y = rnorm(100), group = rep(1:10, each = 10)) data$sum - ave(data$y, data$group, FUN = sum) data$norm.y - data$y / data$sum data .. or even transform(data, norm=ave(y, group, FUN = function(x)

[R] Regular expression substitution ...

2009-11-02 Thread Roberto Brunelli
I would like to replace all occurences of /pc with \% using something like sub(/pc, \%, x) but I am unable to make the '\' pass through. Any hint? Thanks, Roberto __ R-help@r-project.org mailing list

Re: [R] question about difference in date objects

2009-11-02 Thread Karl Ove Hufthammer
On Mon, 02 Nov 2009 06:29:54 -0500 Phil Smith philipsm...@alumni.albany.edu wrote: I want to take the difference in two dates: dt2 - dt1. But, I want the answer in months between those 2 dates. What do you mean by 'months'? The number of days in a month vary, so the number of months

Re: [R] question about difference in date objects

2009-11-02 Thread Gabor Grothendieck
Since months have different lengths the difference in months is not well defined but lets define it as the difference between the first of the month of two dates. In that case we can use as.yearmon of the zoo package. It converts to year/months, dropping days, using an internal representation of

Re: [R] question about difference in date objects

2009-11-02 Thread Prof Brian Ripley
On Mon, 2 Nov 2009, Phil Smith wrote: Hi R Community: I want to take the difference in two dates: dt2 - dt1. But, I want the answer in months between those 2 dates. Can you advise me? How long is a month? difftime() can give you an answer in days, which might suffice if you define a

Re: [R] Regular expression substitution ...

2009-11-02 Thread Sander Timmer
It's a bit strange: sub(/pc, '\\%', x) [1] % sub(/pc, '%', x) [1] \\% Also with fixed I'm not able to get a single \ as return value. Sander On 2 nov 2009, at 12:36, Roberto Brunelli wrote: I would like to replace all occurences of /pc with \% using something like sub(/pc,

Re: [R] Regex matching that gives byte offset?

2009-11-02 Thread Johannes Graumann
Hmmm ... that should do it, thanks. But how would one use this on a file without reading it into memory completely? Joh On Wednesday 28 October 2009 16:29:00 Prof Brian Ripley wrote: Do you mean like regexpr() (on the same help page)? Depending on your locale, you might actually prefer the

Re: [R] Regex matching that gives byte offset?

2009-11-02 Thread Prof Brian Ripley
On Mon, 2 Nov 2009, Johannes Graumann wrote: Hmmm ... that should do it, thanks. But how would one use this on a file without reading it into memory completely? ?file, ?readLines, ?readBin will tell you about connections. Joh On Wednesday 28 October 2009 16:29:00 Prof Brian Ripley wrote:

Re: [R] Error installing RSPerl.

2009-11-02 Thread Grainne Kerr
Hi List, Just to close this thread. It seems my problem was of a more haste less speed nature, i.e. a typo, which Duncan helpfully pointed out. I was installing RSPerl with the command: R CMD INSTALL -c --configure-args=--with-modules='IO Fcntl Socket Storable XML::Parser::Expat DB_File::Glob

Re: [R] Plots with k-means

2009-11-02 Thread eduardo san miguel
Hello all, I have almost finished the development of a new package where ideas from Tamara Munzner, George Furnas and Costa and Venturini are implemented. 1.- Da Costa, David Venturini, Gilles (2006). An Interactive Visualization Environment for Data Exploration Using Points of Interest. adma

[R] Additive decomposition method

2009-11-02 Thread FMH
Dear All, I'm doing an  imputation on few missing data and is looking for an additive decomposition method in R. Could someone please advice me the way to do this? Thank you Fir __ R-help@r-project.org mailing list

[R] Interaction contrasts or posthoc test for glm (MASS) with ANOVA design

2009-11-02 Thread Maya Pfaff
Dear R experts I am running a negative-binomial GLM (glm.nb) to test the null hypotheses that species 1 and 2 are equally abundant between site 1 and site2, and between each other. So, I have a 2x2 factorial design with factors Site (1,2) and Taxon (1,2). Since the Site:Taxon interaction is

Re: [R] Titles on lattice colorkey

2009-11-02 Thread Walmes Zeviani
r-help.20.trevva wrote: Dear R-ers, I'm not sure if this is a missing feature, a support request, or stupidity on my part, but nevertheless, its a question. Is it possible to add titles to colorkey legends? As far as I can tell, there is a command to do it for normal key legends, but

Re: [R] convert list to numeric

2009-11-02 Thread dadrivr
Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again for your help! Benilton Carvalho wrote: it appears that what you really want is to use:

Re: [R] convert list to numeric

2009-11-02 Thread Adaikalavan Ramasamy
It's a way of extracting from a list. See help([) or help(Extract) Regards, Adai dadrivr wrote: Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again for

Re: [R] convert list to numeric

2009-11-02 Thread Adaikalavan Ramasamy
It's a way of extracting from a list. See help([) or help(Extract). dadrivr wrote: Great, that works very well. What is the purpose of double brackets vs single ones? I will remember next time to include a subset of the data, so that readers can run the script. Thanks again for your help!

[R] partial matching with grep()

2009-11-02 Thread Vito Muggeo (UniPa)
dear all, This is a probably a silly question. If I type grep(x,c(a.x ,b.x,a.xx),value=TRUE) [1] a.x b.x a.xx Instead, I would like to obtain only a.x b.x How is it possible to get this result with grep()? many thanks for your attention, best, vito --

Re: [R] Using processed objects as arguments of a function

2009-11-02 Thread David Winsemius
This would return a vector the names of objects whose names begin with fund: ls()[grep(^fund, ls())] I'm such a grep-noob that I don't know off the top of my head what the pattern should be to restrict it to only those objects with digits in the next position. Perhaps: do.call( rbind,

[R] how to print the full name of the factors in summary?

2009-11-02 Thread Jen-Chien Chang
Hi, I am wondering if there is a simple way to fix the problem I am having. For unknown reason, I could not get the full name of the factors to be printed in the summary. I have tried to used summary.lm as well but the problem still persists. SJ$Weekday -

[R] superscript troubles

2009-11-02 Thread Jacob Kasper
I know that this has been revisited over and over, yet I cannot figure out how to solve this case of superscript troubles... I would like the 2 in r2 to be superscript, yet I am pasting text before and after it. I have tried several variations but have not solved this yet, any suggestions? legend

Re: [R] Interaction contrasts or posthoc test for glm (MASS) with ANOVA design

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 8:40 AM, Maya Pfaff wrote: Dear R experts I am running a negative-binomial GLM (glm.nb) to test the null hypotheses that species 1 and 2 are equally abundant between site 1 and site2, and between each other. So, I have a 2x2 factorial design with factors Site (1,2)

Re: [R] superscript troubles

2009-11-02 Thread Peter Dalgaard
Jacob Kasper wrote: I know that this has been revisited over and over, yet I cannot figure out how to solve this case of superscript troubles... I would like the 2 in r2 to be superscript, yet I am pasting text before and after it. I have tried several variations but have not solved this yet,

Re: [R] superscript troubles

2009-11-02 Thread baptiste auguie
Hi, Try this, x = rnorm(1) y = rnorm(1) leg = bquote(r^2*=*.(round(x,digits=3))*, P=*.(round(y, digits=3))) plot.new() legend (bty =n,topright,legend=leg) HTH, baptiste 2009/11/2 Jacob Kasper jacobkas...@gmail.com: I know that this has been revisited over and over, yet I cannot figure out

Re: [R] package lme4

2009-11-02 Thread Douglas Bates
On Sun, Nov 1, 2009 at 9:01 AM, wenjun zheng wjzhen...@gmail.com wrote: Hi R Users,     When I use package lme4 for mixed model analysis, I can't distinguish the significant and insignificant variables from all random independent variables.     Here is my data and result: Data:  

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread Adaikalavan Ramasamy
It would be useful to say which package the object SJ comes from or provide a more reproducible example. Assuming that Demand variable is continuous and you are fitting a standard lm() model, then your results looks suspicious. Where are the coefficients for Month, Holiday, Season?

Re: [R] convert list to numeric

2009-11-02 Thread Don MacQueen
An example will help show the difference between single vs. double brackets. ## xl is a list with three elements xl - list( a=1:3, b=2:7, c=c('X','Y')) xl $a [1] 1 2 3 $b [1] 2 3 4 5 6 7 $c [1] X Y ## with single brackets, we get a subset. A subset of a list is still a list xl[1]

Re: [R] partial matching with grep()

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 9:57 AM, Vito Muggeo (UniPa) wrote: dear all, This is a probably a silly question. If I type grep(x,c(a.x ,b.x,a.xx),value=TRUE) [1] a.x b.x a.xx grep(\\.x\\b,c(a.x ,b.x,a.xx),value=TRUE) [1] a.x b.x Or: grep(\\.x$,c(a.x ,b.x,a.xx),value=TRUE) [1] a.x b.x Why you

[R] Problem building R 2.10.0 - Matrix package

2009-11-02 Thread Thomas Adams
All: Attached is the output file from building R 2.10.0 on RedHat Linux. I have never previously experienced any problems when building R from source with new releases. But, now I get a compile error with the Matrix package: CHOLMOD/Include/cholmod.h:87:22: error: UFconfig.h: No such file

[R] qqplot

2009-11-02 Thread carol white
Hi, We could use qqplot to see how two distributions are different from each other. To show better how they are different (departs from the straight line), how is it possible to plot the straight line that goes through them? I am looking for some thing like qqline for qqnorm. I thought of

Re: [R] partial matching with grep()

2009-11-02 Thread jim holtman
Is this what you want: depends on it occurring at the endo of the string: grep(\\.x[^x]*$,c(a.x ,b.x,a.xx),value=TRUE) [1] a.x b.x On Mon, Nov 2, 2009 at 9:57 AM, Vito Muggeo (UniPa) vito.mug...@unipa.it wrote: dear all, This is a probably a silly question. If I type grep(x,c(a.x

Re: [R] qqplot

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 10:40 AM, carol white wrote: Hi, We could use qqplot to see how two distributions are different from each other. To show better how they are different (departs from the straight line), how is it possible to plot the straight line that goes through them? I am looking

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread John Fox
Jen-Chien and Adaikalavan, Weekday is specified as an ordered factor, for which the default contrast type is contr.poly, i.e., orthogonal-polynomial contrasts. I would have expected a 6th-degree polynomial for the 7 days of the week, and there's a message that suggests that 3 coefficients are

Re: [R] qqplot

2009-11-02 Thread John Fox
Carol, You could run a line through the pairs of first and third quartiles of the two distributions, i.e., c(quantile(x, .25), quantile(y, .25)) and c(quantile(x, .75), quantile(y, .75)). (Of course, you'd want the line to extend across the whole graph.) I hope this helps, John -Original

Re: [R] qqplot

2009-11-02 Thread carol white
if I have the two following matrices, abline(0,1) doesn't go through. QQplot is attached. [,1] [,2] [,3] [,4] [,5] 2.149644 1.992864 3.346375 2.793511 3.428230 1.100762 2.152981 2.735401 2.175185 3.323058 1.212406 2.131813 2.672598 2.389996 3.242490 1.183770

[R] R and Python

2009-11-02 Thread Ryan Sheftel
I am a long time user of R for financial time series analysis (xts, zoo, etc) and for my next project I am thinking of adding the Python language to the mix. The reason for adding Python is primarily its non-statistical capabilities. So my questions are what have people's experiences been with

Re: [R] how can I convert .csv format to matrix???

2009-11-02 Thread Dieter Menne
bbslover wrote: In my disk C:/ have a a.csv file, I want to read it to R, importantly, when I use x=read.csv(C:/a.csv) ,the x format is data.frame, I want to it to become matrix format, how can I do it ? as.matrix should do the job; if it does not (second example), you probably

Re: [R] qqplot

2009-11-02 Thread Yihui Xie
abline(0,1) is somewhere in the upper-left corner which you are unable to see. At least the first distribution seems to have a larger mean than the second one (i.e. they are not the same distribution). Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-6609 Web: http://yihui.name

Re: [R] qqplot

2009-11-02 Thread carol white
So the conclusion is that abline(0,1) should always be used and if it doesn't go through the qqplot, the two distributions are not similar? Thanks --- On Mon, 11/2/09, Yihui Xie xieyi...@gmail.com wrote: From: Yihui Xie xieyi...@gmail.com Subject: Re: [R] qqplot To: carol white

Re: [R] qqplot

2009-11-02 Thread Peter Flom
David Winsemius dwinsem...@comcast.net wrote I always assumed that the intercept was zero and the slope = unity. y - rt(200, df = 5) qqnorm(y); qqline(y, col = 2) qqplot(y, rt(300, df = 5)) abline(0, 1, col=red) Suppose you have the following x - rnorm(500) y - 500*(x + runif(500,

Re: [R] qqplot

2009-11-02 Thread Peter Flom
carol white wht_...@yahoo.com wrote So the conclusion is that abline(0,1) should always be used and if it doesn't go through the qqplot, the two distributions are not similar? I think it depends what you mean by similar. E.g., if you mean are both of these distributions (e.g.) normal? then

Re: [R] save an object by dynamicly created name

2009-11-02 Thread Dieter Menne
jeffc wrote: Hi, I would like to save a few dynamically created objects to disk. The following is the basic flow of the code segment for(i = 1:10) { m = i:5 save(m, file = ...) ## ??? } To distinguish different objects to be saved, I would like to save m as m1, m2, m3 ...,

Re: [R] qqplot

2009-11-02 Thread Peter Ehlers
Peter Flom wrote: David Winsemius dwinsem...@comcast.net wrote I always assumed that the intercept was zero and the slope = unity. y - rt(200, df = 5) qqnorm(y); qqline(y, col = 2) qqplot(y, rt(300, df = 5)) abline(0, 1, col=red) Suppose you have the following x - rnorm(500) y - 500*(x

Re: [R] qqplot

2009-11-02 Thread John Fox
Dear Peter, I assumed that Carol wanted to compare the shapes of the distributions and to adjust for differences in centre and spread. To put a line through the quartiles or to base a line on the medians and IQRs is more robust than using the means and sds. Best, John -Original

Re: [R] qqplot

2009-11-02 Thread Peter Flom
John Fox j...@mcmaster.ca wrote I assumed that Carol wanted to compare the shapes of the distributions and to adjust for differences in centre and spread. To put a line through the quartiles or to base a line on the medians and IQRs is more robust than using the means and sds. Hi John Indeed it

Re: [R] qqplot

2009-11-02 Thread Peter Flom
Peter Ehlers ehl...@ucalgary.ca wrote That's not what qqline() does and for good reason - it treats x and y asymmetrically. But qqline() is a very simple function, using the quartiles as also suggested by John. Here's a modified version that should work for Carol: qqline2 - function (x, y, ...)

Re: [R] Avoiding for loops

2009-11-02 Thread Noah Silverman
Wow, That's nice. Should work well, but I just realized that I missed something in explaining my code. I need to calculate the exp function on X so it should be exp(x) / sum(exp(x)) for each group I tried this with: foo - ave(rawdata$foo,rawdata$code,FUN=function(x) exp(x) / sum(exp(x)))

[R] Summing rows based on criteria

2009-11-02 Thread PDXRugger
I am attempting to clean up some land use building data and need to join some buildings together making sure not to double count GIS slivers. The first data.frame is the original, the 2nd adds all the acres for each identical bldgid. I now want to a) throw out all but one of the the cases

[R] a prolem with constrOptim

2009-11-02 Thread Davidov, Ori (NIH/NIEHS) [V]
Hi, I apologize for the long message but the problem I encountered can't be stated in a few lines. I am having some problems with the function constrOptim. My goal is to maximize the likelihood of product of K multinomials, each with four catagories under linear constraints on the parameter

[R] R and Python

2009-11-02 Thread Ryan Sheftel
I am a long time user of R for financial time series analysis (xts, zoo, etc) and for my next project I am thinking of adding the Python language to the mix. The reason for adding Python is primarily its non-statistical capabilities. So my questions are what have people's experiences been with

[R] object not found within function

2009-11-02 Thread Thushyanthan Baskaran
Hi, I am trying to write a function to compute many cross-tabulations with the -svytable- command. Here is a simplified example of the structure of my code (adapted from the -svytable- help file): data(api) func.example-function(variable){ dclus1-svydesign(id=~1, weights=~pw,data=apiclus1,

[R] Frequency

2009-11-02 Thread Val
BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS Hi All, I have a data set x with several variables. Sample of the data is shown below V1 v2 v3 v4 569 10 347 10 46 10 18 I want the frequency of each data point sorted by their

Re: [R] how to print the full name of the factors in summary?

2009-11-02 Thread Bert Gunter
Jack: You are confused! You have specified that the factor is ordered (ordered = TRUE), so you do _not get_ the (6, not 7 btw)single degree of freedom contrasts corresponding to weekday names. Instead you get the (default) contrasts for an ordered factor (.L = linear, .Q = quadratic, etc.). Also

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Val, Here is a suggestion: res - table(unlist(x)) res[order(res, decreasing = TRUE)] # 10 4 6 3 5 7 9 18 # 3 2 2 1 1 1 1 1 HTH, Jorge On Mon, Nov 2, 2009 at 1:35 PM, Val wrote: BAYESIAN INFERENCES FOR MILKING TEMPERAMENT IN CANADIAN HOLSTEINS Hi All, I have a data set

Re: [R] Frequency

2009-11-02 Thread Joe King
sorry, I forgot to send my reply to the list, I got to remember to hit reply all: So I set up a dummy matrix, v1,v2,v3,v4, an datamatrix v1 = c(5,3,4) v2 = c(6,4,6) v3 = c(9,7,10) v4 = c(10,10,18) datamatrix=c(v1,v2,v3,v4) then do sort(table(datamatrix)) Joe King 206-913-2912

[R] Safe way to automatically install required packages...

2009-11-02 Thread Jonathan Greenberg
R-helpers: I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes automatically installing required packages. I, myself, am a novice R-packager, so the solution I came up with was to embed: print(Loading required packages...) if

Re: [R] using exists with coef from an arima fit

2009-11-02 Thread Rolf Turner
On 2/11/2009, at 5:27 PM, Erin Hodgess wrote: Dear R People: I have the output from an arima model fit in an object xxx. I want to verify that the ma1 coefficient is there, so I did the following: xxx$coef ar1ar2ma1 intercept 1.3841297 -0.4985667 -0.996

Re: [R] Safe way to automatically install required packages...

2009-11-02 Thread hadley wickham
If you package depends on another package, it will be automatically installed. Hadley On Mon, Nov 2, 2009 at 12:56 PM, Jonathan Greenberg greenb...@ucdavis.edu wrote: R-helpers:   I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes

[R] Incremental ReadLines

2009-11-02 Thread Gene Leynes
I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121 records This function works well for

[R] Robust ANOVA or alternative test?

2009-11-02 Thread jinyan fan
Dear Colleagues,   I am running a three-way mixed-design ANOVA, with one manipulated IV, a group membership IV, and pre-/post- within subject factor. I am interested in the three-way interaction effect. The regular ANVOA is problematic, because (a) the sample sizes are very unbalanced, due to

[R] Sorting NA's and Graphing a histogram

2009-11-02 Thread Koraelus
Let's say I have a dataset Dataset-read.csv(Dataset.txt, header=T, row.names=1) Dataset Alpha Beta Gamma Delta A 1 23 4 B NA24 5 C NA3NA NA D 8 9 10 11 E5 NA 713 F NANA NA 4 I

Re: [R] Frequency

2009-11-02 Thread Ashta
Thank you Jorge and res - table(unlist(x)) res[order(res, decreasing = TRUE)] # 10 4 6 3 5 7 9 18 # 3 2 2 1 1 1 1 1 This one works fine for me. Is it possible to transpose it? I tried t(res[order(res, decreasing = TRUE)]), but it did not work! I want the result like this 10

Re: [R] Incremental ReadLines

2009-11-02 Thread Duncan Murdoch
On 11/2/2009 2:03 PM, Gene Leynes wrote: I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121

Re: [R] Incremental ReadLines

2009-11-02 Thread James W. MacDonald
Hi Gene, Rather than using R to parse this file, have you considered using either grep or sed to pre-process the file and then read it in? It looks like you just want lines starting with numbers, so something like grep '^[0-9]\+' thefile.csv otherfile.csv should be much faster, and then

Re: [R] Frequency

2009-11-02 Thread Jorge Ivan Velez
Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x - read.table(textConnection(v1 v2 v3 v4 569 10 347 10 46 10 18), header = TRUE) closeAllConnections() # Table res - table(data.matrix(x)) f - sort(res, decreasing = TRUE) data.frame(value =

Re: [R] Robust ANOVA or alternative test?

2009-11-02 Thread Liviu Andronic
Hello On 11/2/09, jinyan fan fanjin...@yahoo.com wrote: to address this issue, either by some sort of Robust ANOVA procedure, or by some alternative tests? Thanks a lot. I cannot address this specific question, but you may want to address robustness-related queries to r-sig-robust, and

Re: [R] Sorting NA's and Graphing a histogram

2009-11-02 Thread Jorge Ivan Velez
Hi Koraelus, Here is a suggestion for the first part: index - apply(Dataset, 1, function(x) sum( is.na( x ) ) 2 ) d2 - Dataset[index ,] d2 # Alpha Beta Gamma Delta # A 12 3 4 # BNA2 4 5 # D 891011 # E 5 NA 713 Could you please

Re: [R] Incremental ReadLines

2009-11-02 Thread Gene Leynes
James, I think those are Unix commands? I'm on Windows, so that's not an option (for now) Also the suggestions posed by Duncan and Phil seem to be working. Thank you so much, such a simple thing to add the r or rt to the file connection. I read about blocking, but I didn't imagine that it

Re: [R] Safe way to automatically install required packages...

2009-11-02 Thread Charlie Sharpsteen
On Mon, Nov 2, 2009 at 10:56 AM, Jonathan Greenberg greenb...@ucdavis.edu wrote: R-helpers:   I'm working on an r-package that I want to make as easy-to-use as possible for a novice R-user, which includes automatically installing required packages.   I, myself, am a novice R-packager, so the

Re: [R] Frequency

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 2:49 PM, Jorge Ivan Velez wrote: Hi Ashta, Yes, it is possible. Here is a suggestion: # Data set x - read.table(textConnection(v1 v2 v3 v4 569 10 347 10 46 10 18), header = TRUE) closeAllConnections() # Table res - table(data.matrix(x)) f -

[R] reference on p.adjust()

2009-11-02 Thread Peng Yu
I'm wondering if there is a textbook that summarize the methods on adjusting p-values for multiple comparisons. Most of the references on p.adjust() are over 10 years old. I feel it would be better if somebody could recommend me a textbook on multiple hypothesis correction, so that I can quickly

Re: [R] Plots with k-means

2009-11-02 Thread eduardo san miguel
I send r-code in an attached file. 2009/11/2 Iuri Gavronski i...@proxima.adm.br: Eduardo, Would you mind sending me the R code in an attached file. Your code didn't work here and I am not sure it is because of line breaks from the email program. Iuri. On Mon, Nov 2, 2009 at 10:53 AM,

Re: [R] qqplot

2009-11-02 Thread carol white
Thanks for all your replies. I just wanted to compare the distributions of two populations and see how different they are. I thought that QQplot would be a good idea. It's true that the mean and sd of the two distributions are not the same. I don't know if any other method or graphical

[R] problems with read.csv

2009-11-02 Thread Fang (Betty) Yang
Dear all, I'd like to ask help on R code to get the same results as the following Splus code: indata-importData(/home/data_new.csv) indata[1:5,4] [1] 0930 1601 1006 1032 1020 I tried the following R code: indata-read.csv(/home/data_new.csv) indata[1:5,4] [1] 930 1601

[R] need help in using Hessian matrix

2009-11-02 Thread Laila Alkhalfan
Hi I need to find the Hessian matrix for a complicated function from a certain kind of data but i keep getting this error Error in f1 - f2 : non-numeric argument to binary operator the data is given by U-runif(n) Us-sort(U) tau1- 2 F1tau-

Re: [R] Robust ANOVA or alternative test?

2009-11-02 Thread Kingsford Jones
See the nlme library and accompanying book by Pinheiro and Bates. The lme function is appropriate for linear mixed models with normal errors, and the 'weights' argument provides flexible methods for modeling error heterogeneity. hth, Kingsford On Mon, Nov 2, 2009 at 12:10 PM, jinyan fan

Re: [R] Plots with k-means

2009-11-02 Thread David Winsemius
The attached file did not come through to the list. I think you have some non-standard characters (or at least non-standard in my locale). I was able to get the code to run after using the Zap Gremlins function in TextWrangler. Prior to that treatment pretty much every line threw an error

Re: [R] problems with read.csv

2009-11-02 Thread Ista Zahn
Superficially, one answer is indata - read.csv(/home/data_new.csv, colClasses=character) but I'm not sure that's what you want... -Ista On Mon, Nov 2, 2009 at 4:09 PM, Fang (Betty) Yang fang.y...@ualberta.ca wrote: Dear all, I'd like to ask help on R code to get the same results as the

Re: [R] problems with read.csv

2009-11-02 Thread David Winsemius
On Nov 2, 2009, at 4:09 PM, Fang (Betty) Yang wrote: Dear all, I'd like to ask help on R code to get the same results as the following Splus code: indata-importData(/home/data_new.csv) indata[1:5,4] [1] 0930 1601 1006 1032 1020 I tried the following R code:

Re: [R] Plots with k-means

2009-11-02 Thread Iuri Gavronski
David, Eduardo, Thanks for the code. I have run it and I'm not sure what to do with the graph when it comes up. Can I interact with it, such as an RGL graph? I've tried clicking or dragging with the mouse and nothing happens. My system is a Windows Vista and R2.9. Best, Iuri. On Mon, Nov 2,

Re: [R] Regex matching that gives byte offset?

2009-11-02 Thread Johannes Graumann
On Monday 02 November 2009 13:41:45 Prof Brian Ripley wrote: On Mon, 2 Nov 2009, Johannes Graumann wrote: Hmmm ... that should do it, thanks. But how would one use this on a file without reading it into memory completely? ?file, ?readLines, ?readBin will tell you about connections. ...

Re: [R] problems with read.csv

2009-11-02 Thread Joe King
I use indata = read.csv(file.choose(),header=TRUE) of course you can specify your file. Joe King 206-913-2912 j...@joepking.com Never throughout history has a man who lived a life of ease left a name worth remembering. --Theodore Roosevelt -Original Message- From:

[R] AR Simulation with non-normal innovations

2009-11-02 Thread Ricardo Gonçalves Silva
Dear Users, I would like to simulate AR(1) (y_t=ct1+y_t-1+e_t) model in R where the innovations are supposed to follow a t-GARCH(1,1) proccess. By t-GARCH I want to mean that: e_t=n_t*sqrt(h_t) and h_t=ct2+a*(e_t)^2+b*h_t-1. If someone could give some guidelines, I can going developing the

  1   2   >