Re: [R] column-wise z-scores by group

2008-10-07 Thread Peter Dalgaard
DISCCRS wrote: Hi, I have a dataset of historical monthly temperature data that is grouped by weather station. I want to create z-scores of the monthly data using a base period of a subset of years. I subset the dataset first to include only data from the years (V2) that make up the base period

Re: [R] Reading Data

2008-10-07 Thread Rahul-A.Agarwal
Hi I don't want to ignore the date row. See basically my first row is the date column and the 1st column is the stocks name. Now using the if loop I have to find prices of stocks corresponding to a date. I hope the problem is clear to you now For example Stocks 30-Jan-08 28-Feb-08

Re: [R] Reading Data

2008-10-07 Thread Rahul-A.Agarwal
Hi What if I need to take dates and stock names from these table...i mean I need to read in this table and then use if function and extratc the data from FOO Identifier weight Start_Date End_Date a 6.7631Jan06 31Jan07 g 2.8628Feb06 28Feb07 e 22.94 31Mar06

[R] Fitting weibull, exponential and lognormal distributions to left-truncated data.

2008-10-07 Thread Gough Lauren
Dear All, I have two questions regarding distribution fitting. I have several datasets, all left-truncated at x=1, that I am attempting to fit distributions to (lognormal, weibull and exponential). I had been using fitdistr in the MASS package as follows: fitdistr-(x,weibull) However, this

Re: [R] Automatic code diagramming for R?

2008-10-07 Thread Tobias Verbeke
Ben Bryant wrote: Greetings - Is anyone aware of an automatic code diagrammer/flow chart creator that works for the R language (either a contributed package, or external software)? I need to explain some code structure of a package I'm working on to non-R users, and would find it extremely

[R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
He everybody, Well I have a biplot CCA-like origined from plot.cca (vegan package). I need to rotate on y axis the lines and symbols of constrained and sites representation. If I do that on an image editor, I rotate everything, including titles, axes labels and positions. I just need to rotate

Re: [R] Reading Data

2008-10-07 Thread Philipp Pagel
For example Stocks 30-Jan-08 28-Feb-08 31-Mar-08 30-Apr-08 a 1.003.007.003.00 b 2.004.004.007.00 c 3.008.00655.00 3.00 d 4.0023.00 4.005.00 e 5.0078.00 6.005.00 OK

Re: [R] Fitting weibull, exponential and lognormal distributions to left-truncated data.

2008-10-07 Thread Richard . Cotton
I have several datasets, all left-truncated at x=1, that I am attempting to fit distributions to (lognormal, weibull and exponential). I had been using fitdistr in the MASS package as follows: A possible solution is to use the survreg() in the survival package without specifying the

Re: [R] Reading Data

2008-10-07 Thread Nutter, Benjamin
Perhaps it would be easier to try something like this: df1 - read.table(filename, ... ) # All columns read as characters df1 - t(df1) # Transpose df1 write.table - (df1, newfile, ...) # Write the transposed data # to a new file df2 -

Re: [R] lmer: random factor nested in a fixed factor

2008-10-07 Thread Hank Stevens
hi folks, I believe that the construction y ~ A + (A|B) (where A is a categorical variable for a fixed effect and B is a categorical variable for a random effect) will generate random effects for all of the fixed effect coefficients. That is, in addition fitted a systematic fixed effect

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, I need to rotate on y axis the lines and symbols of constrained and sites representation. Easiest is to multiply the axis you want to invert by -1. Something like the following, where my.cca is the orginal object and yax = obj[, 2] (xax being obj[, 1]). Obviously, copying isn't

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, Sorry, that will not return a result (I use several different ordination packages, in most of which this is possible). What you need to do with vegan is the following: scores(mynew.cca)$species[, 2] - scores(mynew.cca)$species[, 2] * -1 You will be able to do the rest. Regards,

Re: [R] R on the Freakonomics Blog

2008-10-07 Thread John Kane
Quotes I probably have an unhealthy attraction to the powers of Excel. I taught my daughter how to use it when she was 7. When I teach corporate finance, I try to make sure that my law students come away from the course knowing how to crunch in Excel. And R is probably not kept up to speed on

[R] R and computer heat

2008-10-07 Thread Alexandre Aguiar
Hi, I noticed the temperature of my laptop rises sharply during execution of a long R script that generates several hundred plots, all of them saved to files. No screen output. Temps reached above 90 Celsius degrees in the box and above 80 C deg in the processor. The machine turns on cooler at

[R] How to validate model?

2008-10-07 Thread Maithili Shiva
Hi! I am working on scorecard model and I have arrived at the regression equation. I have used logistic regression using R. My question is how do I validate this model? I do have hold out sample of 5000 customers. Please guide me. Problem is I had never used Logistic regression earlier

Re: [R] Reading Data

2008-10-07 Thread Philipp Pagel
What if I need to take dates and stock names from these table...i mean I need to read in this table and then use if function and extratc the data from FOO Not sure what exactly the problem is. Can you give an example? Of course the first thing would be to make sure that dates are in the same

Re: [R] Stacked area chart and legends

2008-10-07 Thread Jim Lemon
mbr wrote: I have found lots of good advice on this forum about stacked area charts but I’ve run into problems with the 2 recommended options: stackploy in plotrix or qplot in ggplot2. I have a many page report that will be in a 2x2 page format “par(mfrow=c(2,2))”” and need one of the page

Re: [R] Reading Data

2008-10-07 Thread Gustaf Rydevik
On Tue, Oct 7, 2008 at 10:36 AM, [EMAIL PROTECTED] wrote: Hi, I have a data in which the first row is in date format and the first column is in text format and rest all the entries are numeric. Whenever I am trying to read the data using read.table, the whole of my data is converted in to

Re: [R] R and computer heat

2008-10-07 Thread Dr Eberhard Lisse
Why don't you hack a little script that looks at system load, temperature and date/time and writes it somewhere. Then you can load it into R and plot it nicely :-))-O Even compare it witht he desktop :-)-O el on 10/7/08 12:21 PM Alexandre Aguiar said the following: Hi, I noticed the

[R] How to store the results of multiple iterations of 'aov' in a data.frame?

2008-10-07 Thread Michal Figurski
A follow-up to Need to calculate within- and between-run CV I have a dataset of 210 Samples, of which each was run several times in several consecutive days. A dataset for one sample is below: qu.s - structure(list(Sample = c(44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L, 44L), Run = c(1L, 1L,

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
Thanks a lot for your help (again) Mark. I adapted your suggestion to my analysis. But I'm getting and error when trying to apply the new values. The error is: Erro em scores(CAPpotiFTI)$species[, 2] - scores(CAPpotiFTI)$species[, : não foi posssível encontrar a função scores- Translating:

[R] Selecting numeric data from a data frame

2008-10-07 Thread Meir Preiszler
Hi I have a data frame containing numeric and factor data. I want to extract the numeric data only. How can this be done? Thanks Meir Meir Preiszler - Research Engineer I t a m a r M e d i c a l Ltd. Caesarea, Israel: Tel: +(972) 4 617 7000 ext

Re: [R] How to validate model?

2008-10-07 Thread Frank E Harrell Jr
Maithili Shiva wrote: Hi! I am working on scorecard model and I have arrived at the regression equation. I have used logistic regression using R. My question is how do I validate this model? I do have hold out sample of 5000 customers. Please guide me. Problem is I had never used Logistic

Re: [R] Selecting numeric data from a data frame

2008-10-07 Thread Peter Dalgaard
Meir Preiszler wrote: Hi I have a data frame containing numeric and factor data. I want to extract the numeric data only. How can this be done? Thanks Meir d[sapply(d,is.numeric)] -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of

Re: [R] R and computer heat

2008-10-07 Thread Tom Backer Johnsen
Alexandre Aguiar wrote: Hi, I noticed the temperature of my laptop rises sharply during execution of a long R script that generates several hundred plots, all of them saved to files. No screen output. Temps reached above 90 Celsius degrees in the box and above 80 C deg in the processor. The

Re: [R] fitting a curve to data points

2008-10-07 Thread Dieter Menne
carlos.grohmann at gmail.com writes: Hello all. This is likely to be a silly question, but I have a set of data points and I want to fit a curve to it, like this: http://www.igc.usp.br/pessoais/guano/temp/curve.png While you could use a loess-curve, interpreting the rising branch a the end

[R] S3 vs S4 class

2008-10-07 Thread Terry Therneau
A simple example: temp - as.Date('2001-10-5') class(temp) Date How do I tell if Date is implemented as an S3 or an S4 class type? I tried ?class, but didn't see anything obvious. Functions like inherit() work equally well with both types (which is a good thing).

Re: [R] plyr package: passing further arguments fail

2008-10-07 Thread baptiste auguie
Thanks Hadley, for some reason I didn't see your email until now. It works fine with the development version, library(plyr) df - data.frame(a=1:10 , b=1:10) foo1 - function(a, b, cc=0, d=0){ a + b + cc + d } mdply(data. = df, foo1, cc=1, d=2) I think using . prefixes is a safer option

Re: [R] S3 vs S4 class

2008-10-07 Thread Duncan Murdoch
On 07/10/2008 10:41 AM, Terry Therneau wrote: A simple example: temp - as.Date('2001-10-5') class(temp) Date How do I tell if Date is implemented as an S3 or an S4 class type? I tried ?class, but didn't see anything obvious. Functions like inherit() work

Re: [R] Reading Data

2008-10-07 Thread Rahul-A.Agarwal
Bang on!! Thanks for the help Rahul Agarwal Analyst Equities Quantitative Research UBS_ISC, Hyderabad On Net: 19 533 6363 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philipp Pagel Sent: Tuesday, October 07, 2008 2:52 PM To:

[R] using assign with lists

2008-10-07 Thread Mark Kimpel
I am performing many permutations on a data-set with each permutation producing a variable number of results. I thought that the best way to keep track of all this in one object would be with a list ('res.lst'). To address these variable results for each permutation I attempted to construct this

Re: [R] lme and lmer df's and F-statistics again

2008-10-07 Thread Dieter Menne
Julia S. julia.schroeder at gmail.com writes: Now, I did that in my article and I got a response from a reviewer that I additionally should give the degrees of freedom, and the F-statistics. From what I read here, that would be incorrect to do, and I sort of intuitively also understand why

[R] read.spss: variable.labels

2008-10-07 Thread soeren . vogel
Hi, how can I attach variable labels originally read by read.spss() to the resulting variables? pre X - read.spss('data.sav', use.value.labels = TRUE, to.data.frame = TRUE, trim.factor.names = TRUE, trim_values = TRUE, reencode = UTF-8) names(X) - tolower(names(X)) attach(X) /pre Thank

Re: [R] R and computer heat

2008-10-07 Thread Dieter Menne
Alexandre Aguiar asaguiar at spsconsultoria.com writes: I noticed the temperature of my laptop rises sharply during execution of a long R script that generates several hundred plots, all of them saved to files. No screen output. Temps reached above 90 Celsius degrees in the box and above

Re: [R] How to validate model?

2008-10-07 Thread Pedro.Rodriguez
Hi Frank, Thanks for your feedback! But I think we are talking about two different things. 1) Validation: The generalization performance of the classifier. See, for example, Studies on the Validation of Internal Rating Systems by BIS. 2) Calibration: Correct calibration of a PD rating system

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, Sorry again: the structure vegan uses is quite complex. Technically you should use the extractor function scores() to extract what you want from the object, e.g. scores(my.cca, display=species) or scores(my.cca, display=cn) [centroids]. I did work out a quicker way of reversing axes,

Re: [R] Reading Data

2008-10-07 Thread Rahul-A.Agarwal
Why m I getting this message data=read.table(H:/Rahul/london/david/rexcel/price1.txt,header=T,check.names=F,row.names=1) Error in read.table(H:/Rahul/london/david/rexcel/price1.txt, header = T, : duplicate 'row.names' are not allowed Rahul Agarwal Analyst Equities Quantitative Research

Re: [R] Fitting weibull, exponential and lognormal distributions to left-truncated data.

2008-10-07 Thread Prof Brian Ripley
On Tue, 7 Oct 2008, [EMAIL PROTECTED] wrote: I have several datasets, all left-truncated at x=1, that I am attempting to fit distributions to (lognormal, weibull and exponential). I had been using fitdistr in the MASS package as follows: A possible solution is to use the survreg() in the

[R] Mac crash- Probably memory problem

2008-10-07 Thread dimitris kapetanakis
Dear all, I am running a code using bootstraps for estimating standard errors but the mac crashes. When I use small number of bootstraps (100) it works fine but if I increase that number it crashes. Thanks in advance dimitris The code, the error and my mac characteristics are the following:

[R] panel.groups: use group.number to define colors

2008-10-07 Thread baptiste auguie
Dear list, I've been trying this for a few hours and I just don't understand how lattice works with groups and subscripts. Consider the following example, xx - seq(1, 10, length=100) x - rep(xx, 4) y - c(cos(xx), sin(xx), xx, xx^2/10) fact - factor(rep(c(cos, sin, id, square),

Re: [R] horizontal boxplot + xlim

2008-10-07 Thread Ben Bolker
Antje niederlein-rstat at yahoo.de writes: I get a strange behaviour of a boxplot with the following code. There seems to be a problem with the xlim-parameter. Did I do anything wrong? What else can I do to force the boxplot to have a defined x-range? x - rnorm(100) boxplot(x,

Re: [R] using assign with lists

2008-10-07 Thread jim holtman
Here is something to try: result - list() for (i in 1:2){ + for (j in 1:2){ + result[[paste(i, j, sep=|)]] - rep(i,j) + } + } result $`1|1` [1] 1 $`1|2` [1] 1 1 $`2|1` [1] 2 $`2|2` [1] 2 2 On Tue, Oct 7, 2008 at 11:01 AM, Mark Kimpel [EMAIL PROTECTED] wrote: I am

Re: [R] Extracting text from html code using the RCurl package.

2008-10-07 Thread Martin Morgan
Hi Tony -- Tony Breyal [EMAIL PROTECTED] writes: Dear R-help, I want to download the text from a web page, however what i end up with is the html code. Is there some option that i am missing in the RCurl package? Or is there another way to achieve this? This is the code i am using:

Re: [R] Load a program at the front end

2008-10-07 Thread Gang Chen
Thanks a lot for the suggestion! Unfortunately R --no-save prog.R does not work well with my situation because prog.R contain lines such as readline() and () that require user response in the middle of the execution. I also tried other options such as R -f prog.R and R --interactive prog.R,

[R] sort a list?

2008-10-07 Thread rkevinburton
I am trying to sort a list and the data is obiously not in the right format. I am trying: x - list() x[[A]] - 1 x[[B]] - 2 order(x) But am getting: Error in order(x) : unimplemented type 'list' in 'orderVector1' How should I change the list so that it can be sorted? What kinds of objects

[R] R squared value for a line on a plot

2008-10-07 Thread Georgina Sarah Humphreys
Does anyone know how to retrieve the R squared value for a line on a graph? Thanks Georgina __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

[R] vectorization of a loop for mahalanobis distance calculation

2008-10-07 Thread Frank Hedler
Dear all, We have a data frame x with n people as rows and k variables as columns. Now, for each person (i.e., each row) we want to calculate a distance between him/her and EACH other person in x. In other words, we want to create a n x n matrix with distances (with zeros in the diagonal).

[R] Algorithm = port convergence codes

2008-10-07 Thread Nakamura
Hello all, I am fitting a Gamma distribution to some data I have using nls(). The function obviously runs into issues when using a 0 as a parameter value. I understand the line alg = port can be used to set the lower bounds to prevent this from happening. When I run the code I get the following:

[R] R and Multi threading

2008-10-07 Thread pejpm
I will preface this message by saying that I am not an R developer and no very little about R...but here is my situation: One of my users has developed a model for analysing commodity prices. At the moment when he runs this model on his daily data set it takes roughly 5 hours to complete. He is

Re: [R] Load a program at the front end

2008-10-07 Thread Luke Tierney
Something like env R_PROFILE=prog.R R may work for you. You may need to call .First.sys at the beginning of prog.R to get default packages loaded. luke On Tue, 7 Oct 2008, Gang Chen wrote: Thanks a lot for the suggestion! Unfortunately R --no-save prog.R does not work well with my

Re: [R] vectorization of a loop for mahalanobis distance calculation

2008-10-07 Thread Sarah Goslee
distance() from the ecodist package will calculate Mahalanobis distances. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Extracting text from html code using the RCurl package.

2008-10-07 Thread Gabor Grothendieck
I gather you are using Windows and in that case you could use RDCOMClient or rcom to get it via Internet Explorer, e.g. library(RDCOMClient) ie - COMCreate(InternetExplorer.Application) URL - https://stat.ethz.ch/mailman/listinfo/r-help; ie$Navigate(URL) while(ie[[Busy]]) Sys.sleep(1) txt -

Re: [R] sort a list?

2008-10-07 Thread Henrique Dallazuanna
Try this: x[order(unlist(x), decreasing = TRUE)] On Tue, Oct 7, 2008 at 1:28 PM, [EMAIL PROTECTED] wrote: I am trying to sort a list and the data is obiously not in the right format. I am trying: x - list() x[[A]] - 1 x[[B]] - 2 order(x) But am getting: Error in order(x) :

Re: [R] sort a list?

2008-10-07 Thread jim holtman
Exactly what were your expections from sorting the list? What did you expect the answer to look like? You can 'unlist' the list and then sort the elements: x[[A]] - 1:10 x[[B]] - 4:12 sort(unlist(x)) A1 A2 A3 A4 B1 A5 B2 A6 B3 A7 B4 A8 B5 A9 B6 A10 B7 B8 B9 1 2 3 4

[R] Creating GUIs for R

2008-10-07 Thread Wade Wall
Hi all, I have looked around for help on creating GUIs for R, but haven't found anything. I would be interested in any advice or webpages that have information on the best language, tutorials etc. for creating simple GUIs. Mainly I want to do this as a heuristic exercise. Thanks for any help.

Re: [R] sort a list?

2008-10-07 Thread Erik Iverson
Since objects of class list in R can be made up of heterogeneous objects, sorting them does not make much sense. For example, does A, come before or after 1000, does a linear model summary come before or after pi? If your data are all numeric, store them as a numeric vector, where sort

Re: [R] R squared value for a line on a plot

2008-10-07 Thread Ben Bolker
Georgina Sarah Humphreys g.humphreys.1 at research.gla.ac.uk writes: Does anyone know how to retrieve the R squared value for a line on a graph? Thanks Georgina We need a LOT more information to answer your question ... please read the posting guide and tell us in a bit more detail

Re: [R] vectorization of a loop for mahalanobis distance calculation

2008-10-07 Thread Sarah Goslee
Hi Frank, If the way distance() calculates the Mahalanobis distance meets your needs other than the covariance specification, you can tweak that _very_ easily. If you use fix(distance) at the command line, you can edit the source. change the first line to: function (x, method = euclidean, icov)

Re: [R] Creating GUIs for R

2008-10-07 Thread Greg Snow
Wade, What type of GUI do you want? Do you want a full GUI that the user runs to do everything (that uses R as the computational engine)? Look at R commander, JGR, and the R plugin for Excel as possible examples. Are you more interested in a simple GUI for one specific plot or function to

Re: [R] R squared value for a line on a plot

2008-10-07 Thread Dieter Menne
Georgina Sarah Humphreys g.humphreys.1 at research.gla.ac.uk writes: Does anyone know how to retrieve the R squared value for a line on a graph? The balloon rule http://www.jstor.org/pss/2683562 Dieter __ R-help@r-project.org mailing list

Re: [R] Creating GUIs for R

2008-10-07 Thread Bert Gunter
Seek and ye shall find ... Check the RGUI's link on the other web page on CRAN. If you are on Windows, there is some simple built-in GUI functionality. ?winMenuAdd, ?select.list and the links therein will get you started there. Cheers, Bert Gunter -Original Message- From: [EMAIL

Re: [R] panel.groups: use group.number to define colors

2008-10-07 Thread Bert Gunter
Not exactly sure what you want to do, but ... In your example, you do not need groups, since the color doesn't change within the levels of the conditioning variable (fact). Hence you can use the panel.number() function to choose the plotting color of each panel, like this: ## .. continuing with

Re: [R] Creating GUIs for R

2008-10-07 Thread Wade Wall
Sorry that my post wasn't very clear. What I am wanting to do is learn to build some simple GUIs for a limited number of functions. Basically, I am envisioning a screen with check boxes, a drop down menu etc. that users could select to run analyses on imported data. I have worked with VB before,

Re: [R] vectorization of a loop for mahalanobis distance calculation

2008-10-07 Thread Frank Hedler
Dear all,we just realized something. Sarah's distance function - indeed - calculates mahalanobis distance very well. However, it uses the observed variance-covariance matrix by default. What we actually need (sorry for not stating it clearly in to be able to specify which variance-covariance

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
Ok Mark, it worked for the species. I still get an error if I try with biplot (cn,sp), but it's not a problem, repositioning the species is enough. Thanks once again. Just for future consults the error that still remains: CAPpotiFTI-scores(CAPpotiFT, display=c('bp','species','cn','sites')

[R] Statistically significant in linear and non-linear model

2008-10-07 Thread Hsiao-nan Cheung
Hi, I have a question to ask. if in a linear regression model, the independent variables are not statistically significant, is it necessary to test these variables in a non-linear model? Since most of non-linear form of a variable can be represented to a linear combination using Taylor's

Re: [R] sort a list?

2008-10-07 Thread rkevinburton
THank you. I just didn't know the rules. In other languages it is possible to pass in a 'compare' function so the sort is defined by the function. I guess I was a) wondering why it failed, and b) if there was a similar work around to sort generic lists. Also I was specifically addressing the

[R] Programing and writing function help

2008-10-07 Thread Stephen Cole
Hello R users My goal is to use R to write functions for and automate a series of analyses i would like to do on a large data set. The calculations are not very difficult in themselves, however they will be very time consuming (Plus I think R will be extremely useful and this is another excuse

Re: [R] Load a program at the front end

2008-10-07 Thread Gang Chen
Thanks for the suggestion, Luke! Your approach would load prog.R whenever invoking R, but that is not exactly what I want. Basically I can run prog.R through source(~/someDir/prog.R) inside R. Also since prog.R involves many lines of readline() and tclvalue() in tcltk package, the program

Re: [R] Statistically significant in linear and non-linear model

2008-10-07 Thread Greg Snow
Well here is one example where x is not significant in a linear regression: x - seq( -1,1, 0.1 ) y - x^2 + rnorm(21,0,.1) summary(lm(y~x)) Would you really want to dismiss any relationship (non-linear) between x and y based on the above p-value? -- Gregory (Greg) L. Snow Ph.D. Statistical

Re: [R] Creating GUIs for R

2008-10-07 Thread Gabor Grothendieck
I think prior posters addressed that or maybe what you really want is a command that accepts your function and automatically constructs a GUI front end for it. In that case see ggenericwidget in the gWidgets package and the fgui package. You don't need VB at all for this. On Tue, Oct 7, 2008 at

Re: [R] Statistically significant in linear and non-linear model

2008-10-07 Thread Ted Harding
On 07-Oct-08 17:46:52, Hsiao-nan Cheung wrote: Hi, I have a question to ask. if in a linear regression model, the independent variables are not statistically significant, is it necessary to test these variables in a non-linear model? Since most of non-linear form of a variable can be

Re: [R] panel.groups: use group.number to define colors

2008-10-07 Thread baptiste auguie
Hi, and thanks for your email, I realise my example was not very good. The actual dataset I'm trying to plot is rather big and this oversimplified example did not make much sense. I actually do need to color different subsets of the data differently in each panel, that's why I thought of

[R] weighted quantiles

2008-10-07 Thread sj
I have a set of values and their corresponding weights. I can use the function weighted.mean to calculate the weighted mean, I would like to be able to similarly calculate the weighted median and quantiles? Is there a function in R that can do this? thanks, Spencer [[alternative HTML

Re: [R] Programing and writing function help

2008-10-07 Thread jim holtman
Here is one way that might work for you: x - c(20,18, 45, 16, 47, 47, 15, 26, 14,14,12,16,35,27,18,94,16,26,26,30) # create a matrix of pairs matrix(sample(x), ncol=2) [,1] [,2] [1,] 14 16 [2,] 27 20 [3,] 26 16 [4,] 47 15 [5,] 35 47 [6,] 16 18 [7,] 14

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, I looked through my scripts and found my old hack. __WARNING__: Be very careful to check that the mirror isn't broken and that all is in order! Make sure that you are reversing the axes you want. In your original post you mention axis 2, i.e. y-axis. Below you have used axis 1. ##

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, Again an error, as that doesn't touch one of the data structures. You need to extend the range to include #15, as below: ## This does axis 2 mynew.cca - my.cca for (i in c(2:8,15)) mynew.cca$CCA[[i]][, 2] - mynew,cca$CCA[[i]][, 2] * -1 Cheers, Mark. Mark Difford wrote: Hi

Re: [R] weighted quantiles

2008-10-07 Thread Frank E Harrell Jr
sj wrote: I have a set of values and their corresponding weights. I can use the function weighted.mean to calculate the weighted mean, I would like to be able to similarly calculate the weighted median and quantiles? Is there a function in R that can do this? thanks, Spencer library(Hmisc)

Re: [R] read.spss: variable.labels

2008-10-07 Thread Frank E Harrell Jr
[EMAIL PROTECTED] wrote: Hi, how can I attach variable labels originally read by read.spss() to the resulting variables? pre X - read.spss('data.sav', use.value.labels = TRUE, to.data.frame = TRUE, trim.factor.names = TRUE, trim_values = TRUE, reencode = UTF-8) names(X) - tolower(names(X))

Re: [R] weighted quantiles

2008-10-07 Thread Brian S Cade
Try the linear quantile regression function rq() in the quantreg package. For 1 sample estimates, your model would have just an intercept term. There is a weight argument. quantiles.out - rq(y ~ 1, data=mydata, tau=1:9/10, weight=myweights) would yield the 0.10, 0.20, ..., 0.80, 0.90 weighted

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
Sorry for the mistake, I'm trying to rotate the CAP 1 axis not 2! Ah well, I tried the this other way, but it gave me an error. Something in the syntax, I tried to change something but didn't fix the error. CAPpotiFTI-CAPpotiFT for(i in c(2:8,15))

[R] RBloomberg - Converting international stock prices into $US

2008-10-07 Thread Lapushin, Dan
To all: I'm using RBloomberg to pull historical equity prices across a range of international markets. Bloomberg defaults to returning stock prices to R in local currency, for example, blpGetData(conn, ALUA AR Equity, PX_LAST,start=09/30/08, end=09/30/08) returns a stock price in Argentine

Re: [R] How to validate model?

2008-10-07 Thread Frank E Harrell Jr
[EMAIL PROTECTED] wrote: Hi Frank, Thanks for your feedback! But I think we are talking about two different things. 1) Validation: The generalization performance of the classifier. See, for example, Studies on the Validation of Internal Rating Systems by BIS. I didn't think the desire was

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, Yes it does, but this will work. You have erroneously used a , in your call, it should be a ., if anything. You have also inserted cca... And the axes being switched must be conformant: CAPpotiFTI-CAPpotiFT for(i in c(2:8,15))

Re: [R] Ecological Niche Modelling on R

2008-10-07 Thread stephen sefick
that is a pretty big question. And I am not qualified to answer it, but my suggestion- from figuring out how to use other things- is to find out how other people have modeled ecological niches- not necessarily with R, and then try and find out functions that preform the pieces or the whole

Re: [R] panel.groups: use group.number to define colors

2008-10-07 Thread Deepayan Sarkar
On Tue, Oct 7, 2008 at 8:54 AM, baptiste auguie [EMAIL PROTECTED] wrote: Dear list, I've been trying this for a few hours and I just don't understand how lattice works with groups and subscripts. Consider the following example, xx - seq(1, 10, length=100) x - rep(xx, 4) y - c(cos(xx),

Re: [R] Mac crash- Probably memory problem

2008-10-07 Thread stephen sefick
not reproducible. On Tue, Oct 7, 2008 at 11:35 AM, dimitris kapetanakis [EMAIL PROTECTED] wrote: Dear all, I am running a code using bootstraps for estimating standard errors but the mac crashes. When I use small number of bootstraps (100) it works fine but if I increase that number it

Re: [R] panel.groups: use group.number to define colors

2008-10-07 Thread baptiste auguie
Many thanks, I think I got the spirit of 'capturing and overriding' the arguments which was the bit i was missing. It's much clearer now with a working example. Thanks again, baptiste On 7 Oct 2008, at 21:19, Deepayan Sarkar wrote: On Tue, Oct 7, 2008 at 8:54 AM, baptiste auguie [EMAIL

Re: [R] lme and lmer df's and F-statistics again

2008-10-07 Thread Kingsford Jones
You may find this site useful: http://lme4.r-forge.r-project.org/bib/lme4bib.html On Tue, Oct 7, 2008 at 9:08 AM, Dieter Menne [EMAIL PROTECTED] wrote: Julia S. julia.schroeder at gmail.com writes: Now, I did that in my article and I got a response from a reviewer that I additionally should

[R] vectorized sub, gsub, grep, etc.

2008-10-07 Thread Thaden, John J
R pattern-matching and replacement functions are vectorized: they can operate on vectors of targets. However, they can only use one pattern and replacement. Here is code to apply a different pattern and replacement for every target. My question: can it be done better? sub2 - function(pattern,

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
Well this time I have to assume, I'm not understanding what is wrong now. And I have to say: 'Thank You for your patience', cause I'm going crazy here! :-) Mark, I tried this: CAPpotiFTI-CAPpotiFT for(i in c(2:8,15)) CAPpotiFTI$CCA[[i]][, 1]-CAPpotiFTI$CCA[[i]][, 1] * -1 and got this: Erro

Re: [R] vectorized sub, gsub, grep, etc.

2008-10-07 Thread N. Lapidus
Hi John, Wouldn't you get the same with just mapply(sub, patt, repl, X) ? Nael On Tue, Oct 7, 2008 at 9:58 PM, Thaden, John J [EMAIL PROTECTED] wrote: R pattern-matching and replacement functions are vectorized: they can operate on vectors of targets. However, they can only use one pattern

Re: [R] vectorized sub, gsub, grep, etc.

2008-10-07 Thread Christos Hatzis
John, Try the following: mapply(function(p, r, x) sub(p, r, x, fixed = TRUE), p=patt, r=repl, x=X) b cda aB CD ef -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thaden, John J Sent: Tuesday, October 07, 2008 3:59 PM To:

Re: [R] Multiple hist(ograms) - One plot

2008-10-07 Thread Michael Just
Deepayan, Thanks for the advice. -Micahel On Fri, Oct 3, 2008 at 1:24 AM, Deepayan Sarkar [EMAIL PROTECTED]wrote: On 10/2/08, Michael Just [EMAIL PROTECTED] wrote: Dieter and Thierry: Per you suggestions I have tried: ggplot2 from Thierry: p - ggplot(dat, aes(x=bbContag,

Re: [R] Multiple hist(ograms) - One plot

2008-10-07 Thread Michael Just
Thierry, Thanks. This worked. Cheers, Michael On Fri, Oct 3, 2008 at 2:46 AM, ONKELINX, Thierry [EMAIL PROTECTED]wrote: Michael, You get this error because you make the subset at the wrong place. Try p - ggplot(dat[dat$sc_recov %in% c(21,31,41), ], aes(x=bbContag, y=..density..)) +

[R] Factor tutorial?

2008-10-07 Thread rkevinburton
This is probably a very basic question. I want to understand factors but I am not sure where to turn. Looking up factor in the Chambers book doesn't even show up in the index. Maybe I am just slow but ?factor doesn't help either. Would someone please point me to a very basic tutorial where I

Re: [R] Ecological Niche Modelling on R

2008-10-07 Thread Ben Bolker
stephen sefick ssefick at gmail.com writes: that is a pretty big question. And I am not qualified to answer it, but my suggestion- from figuring out how to use other things- is to find out how other people have modeled ecological niches- not necessarily with R, and then try and find out

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Mark Difford
Hi Rodrigo, This is because [I now see] you are working on a capscale object, not a cca object, which is what I thought you were using. It still works, though, even with c(2:8,15), though DF #15 doesn't exist in capscale objects. To show you that this is so, run the example below, which uses a

Re: [R] lme and lmer df's and F-statistics again

2008-10-07 Thread Bert Gunter
Well, writing on my rebuttal, I find myself being unable to explain in a few, easy to understand (and, at the same time, correct) sentences stating that it is not a good idea to report (most likely wrong) dfs and F statistics. Without pretending to be able to discuss the details, may I

Re: [R] Mirror Image on Biplot Graphic

2008-10-07 Thread Rodrigo Aluizio
Exactly. It's solved. Just remove #15. CAPpotiFTI-CAPpotiFT for(i in c(2:8))CAPpotiFTI$CCA[[i]][,1]-CAPpotiFTI$CCA[[i]][,1]*-1 It seems that I've to pay more attention and study more about R language. Thanks a lot once more. Rodrigo. -- From:

  1   2   >