Re: [R] RGtk2 problems

2011-10-24 Thread Prof Brian Ripley
Please update your R (and probably your RGtk2: you did not tell us its version), as the posting guide asked you to do before posting. On Sun, 23 Oct 2011, Aref Nammari wrote: Hello, I hope this is the right place to ask for help with a problem I am having with RGtk2 installation with R on

[R] Date column in downloaded date

2011-10-24 Thread ajc
Hi All: If I download yahoo data by getSymbols() in R, the date column gets accompanied along with the downloaded data. There is no column header for the date column to access separately. What is the way to eliminate the date column? If I want to draw a xy scatter plot with the downloaded price

[R] zoo arithmetics

2011-10-24 Thread Hugo Mildenberger
Dear list members, what is the reason that one obviously can't do arithmetic operations on zoo members with different index positions? require(zoo) z - zoo(c(1,1,1),order.by=c(1,2,3)) z 1 2 3 1 1 1 z[1] + z[1] 1 2 z[1:2] + z[1:2] 1 2 2 2 z[1] + z[2]

[R] How to delete rows using conditions on all columns

2011-10-24 Thread Aher
n - 10 P1 - runif(n) P2 - runif(n) P3 - P1 + P2 + runif(n)/100 P4 - P1 + P2 + P3 + runif(n)/100 mydata - data.frame(cbind(P1,P2,P3,P4)) mydata[1,1] - 8 mydata[3,1] - -5 mydata[2,3] - -6 mydata[7,3] - 7 f=function(z){quantile(z, c(0.01, 0.99)) } temp1 - lapply(mydata, f) temp1 $P1 1%

[R] Problem with calling an user defined R function from Java

2011-10-24 Thread Surajit
Dear All, I am facing a problem in calling an user defined R function from Java through JRI. The user defined R function does a loess normalization on micro array data ( find in the limma package of BioConductor) and the last 2 lines of the R Code is : MA - normalizeWithinArrays(RG,

[R] How to get intecerpt standard error in PLS

2011-10-24 Thread arunkumar1111
Hi how do we get intercepts standard error. I'm using the package pls. i got the coefficient but not able to get the stabdard error -- View this message in context: http://r.789695.n4.nabble.com/How-to-get-intecerpt-standard-error-in-PLS-tp3932104p3932104.html Sent from the R help mailing

Re: [R] zoo arithmetics

2011-10-24 Thread David Winsemius
On Oct 23, 2011, at 9:35 PM, Hugo Mildenberger wrote: Dear list members, what is the reason that one obviously can't do arithmetic operations on zoo members with different index positions? zoo-objects are designed to merged by their indices before applying arithmetic operations. You

Re: [R] Date column in downloaded date

2011-10-24 Thread Jeff Newmiller
The date column is very unlikely to interfere with your plots if you don't specify it. I suggest you follow the instructions at the bottom of this and every other message on this mailing list. (Hint: reproducible code and identify your software platform.)

Re: [R] zoo arithmetics

2011-10-24 Thread Achim Zeileis
On Mon, 24 Oct 2011, Hugo Mildenberger wrote: Dear list members, what is the reason that one obviously can't do arithmetic operations on zoo members with different index positions? It's a _feature_ that zoo first matches the index positions, uses only their intersection, and then performs

Re: [R] How to get intecerpt standard error in PLS

2011-10-24 Thread Jeff Newmiller
Insufficient problem specification. Read the posting guide and try again with reproducible code and platform identification. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live

[R] Legend on Pie Chart

2011-10-24 Thread Jurgens de Bruin
I would like to add a legend to my Pie chart but I don't seem to get this working: Below is my code, this is done on Rpy2. grdevices = importr('grDevices') grdevices.png(file=FileNameLocation, width=1400, height=1000) Robjects.r.par(mar=[1, 0, 2, 12], cex=1.0)

Re: [R] How to get intecerpt standard error in PLS

2011-10-24 Thread Claudia Beleites
Am 24.10.2011 09:07, schrieb Jeff Newmiller: Insufficient problem specification. Read the posting guide and try again with reproducible code and platform identification. --- Jeff Newmiller The . . Go Live...

Re: [R] How to get intecerpt standard error in PLS

2011-10-24 Thread arunkumar1111
Hi This is my data present in a file Year Y X2 X3 X4 X5 X6 1960 27.8 397.5 42.2 50.7 78.3 65.8 1960 29.9 413.3 38.1 52 79.2 66.9 1961 29.8 439.2 40.3 54 79.2 67.8 1961 30.8 459.7 39.5 55.3 79.2 69.6 1962 31.2 492.9 37.3 54.7 77.4 68.7 my formula for using PLS fit1 - mvr(formula=Y~X1+X2+X3+X4,

[R] binning runtimes

2011-10-24 Thread Giovanni Azua
Hello, Suppose I have the dataset shown below. The amount of observations is too massive to get a nice geom_point and smoother on top. What I would like to do is to bin the data first. The data is indexed by Time (minutes from 1 to 120 i.e. two hours of System benchmarking). Option 1) group

Re: [R] new R debugging tool

2011-10-24 Thread Rainer M Krug
On Thu, Oct 20, 2011 at 12:22 AM, Norm Matloff matl...@cs.ucdavis.eduwrote: I've developed a new R debugging tool, debugR, available at http://heather.cs.ucdavis.edu/debugR.html This basically replaces my edtdbg, which I will no longer be supporting. The new tool is now decoupled from one's

[R] Position of Chart in Windows

2011-10-24 Thread Jurgens de Bruin
Hi, IS is possible to align a chart to the left of the plot area as to make space for a legend? -- Regards/Groete/Mit freundlichen Grüßen/recuerdos/meilleures salutations/ distinti saluti/siong/duì yú/привет Jurgens de Bruin [[alternative HTML version deleted]]

Re: [R] How to create a new variable based on parts of another character variable.

2011-10-24 Thread Jim Lemon
On 10/24/2011 12:35 AM, Philipp Fischer wrote: Hello, I am just starting with R and I am having a (most probably) stupid problem by creating a new variable in a data.frame based on a part of another character variable. I have a data frame like this one: A B

Re: [R] Position of Chart in Windows

2011-10-24 Thread Uwe Ligges
See ?par and its mar argument. Uwe Ligges On 24.10.2011 11:15, Jurgens de Bruin wrote: Hi, IS is possible to align a chart to the left of the plot area as to make space for a legend? __ R-help@r-project.org mailing list

Re: [R] Position of Chart in Windows

2011-10-24 Thread peter dalgaard
On Oct 24, 2011, at 11:15 , Jurgens de Bruin wrote: Hi, IS is possible to align a chart to the left of the plot area as to make space for a legend? Various possibilities, depending on what you mean precisely: You can create a larger right hand margin. See the mar= argument under

Re: [R] Position of Chart in Windows

2011-10-24 Thread Jeff Newmiller
Yes. If you want a more detailed answer, follow the posting guide instructions and provide a reproducible example. There are three plot systems in R, each with their own approaches to solving this problem. --- Jeff

[R] Problem about plotting the correlation coefficients

2011-10-24 Thread Maggie Wong
Hi, I am writing a program to plot the correlation coefficients of 45 elements using the commend plot. Error message Error in plot.new() : figure margins too large appeared. I think it may because there are too many elements. But I really need to find their correlation coefficients. What can I

Re: [R] cex multiplier not exact

2011-10-24 Thread Uwe Ligges
On 23.10.2011 22:33, Ali Tofigh wrote: Hi, When I plot text and use cex to change the text size, I notice that the cex multiplier is not exact. It looks as if the real size of text can take only certain discrete values. Is there a workaround to get text to follow the cex value more closely,

Re: [R] Problem about plotting the correlation coefficients

2011-10-24 Thread Uwe Ligges
On 24.10.2011 11:35, Maggie Wong wrote: Hi, I am writing a program to plot the correlation coefficients of 45 elements using the commend plot. Error message Error in plot.new() : figure margins too large appeared. I think it may because there are too many elements. But I really need to find

Re: [R] cex multiplier not exact

2011-10-24 Thread Prof Brian Ripley
On Mon, 24 Oct 2011, Uwe Ligges wrote: On 23.10.2011 22:33, Ali Tofigh wrote: Hi, When I plot text and use cex to change the text size, I notice that the cex multiplier is not exact. It looks as if the real size of text can take only certain discrete values. Is there a workaround to get

[R] CDS (Connecting Dominating Set )

2011-10-24 Thread amir
Hi, Is there any way or function in R that can find the Connecting Dominating Set? Regards, Amir -- ___ Amir Darehshoorzadeh |Comp. Architecture Dept. PhD Student |UPC-Campus Nord, C6-221 Email: a...@ac.upc.edu

[R] Plot Legend

2011-10-24 Thread RMSOPS
Good Afternoon, I am inexperienced in data visualization R. so I wonder if someone can help me. I am using the generic database mtcars. I would like to change the chart plot, instead of appearing the name of the medicine, I wanted a symbol in the chart drugX arise for example in a yellow

[R] Output from BRugs Doesn't Match That from OpenBUGS

2011-10-24 Thread ethanarenson
Hi. I am trying to analyze with BRugs the Box-Tiao variance components example in WinBUGS. The output from BRugs, mean sd MC_error val2.5pc median val97.5pc start sample sigma2.btw 681.9 116110.890.7016 253.8 4232 25001 10 sigma2.with 4266.0 1246 4.92

Re: [R] glm-poisson fitting 400.000 records

2011-10-24 Thread D_Tomas
Many thanks for your replies. I appreciate that. I tried what you suggested and it did work for the Poisson model (glm, poisson familly). Unfortunately, the negative binomial (glm.nb) did not work as I work the following message: Warning messages: 1: In ifelse(y mu, d.res, -d.res) : Reached

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-24 Thread apeer
I'm not implying they should be discarded; however, at the same time I'm not certain I fully understand why we should check the ordinality assumption if in the end we're going to include predictors with which the response variable behaves in a non-ordinal fashion. -- View this message in context:

[R] Problem with svyvar in survey package

2011-10-24 Thread amitava
I am facing a problem with a function in survey package. The function svyvar gives the estimated population variance from a given sampling scheme. I am working with a data having more than four continuous variables. In order to have have population total for all those cont. variables I have

[R] merging two dataframes

2011-10-24 Thread dividend
Hello I am a new user of R and I need help to merge two large datasets about stocks with different number of rows and columns. Both have 2 variable(column) that are have same values (name and date1), but they are not in same order and data3 contains much more observations. In the data have

Re: [R] merging two dataframes

2011-10-24 Thread dividend
here is some more info: http://r.789695.n4.nabble.com/file/n3932898/help.jpg this is what`s happend when I run the function in R I appreciate if someone can give me some inputs here Thanks in advance -- View this message in context:

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-24 Thread Frank Harrell
A few issues - Don't let the overall unimportance of a predictor make you worry about non-ordinality (e.g., when scale of plot.xmean.ordinaly has a low range on the y-axis). We frequently have to face the issue of using an imperfect model by fitting a few variables that don't exactly meet our

Re: [R] binning runtimes

2011-10-24 Thread Dennis Murphy
Hi: On Mon, Oct 24, 2011 at 2:01 AM, Giovanni Azua brave...@gmail.com wrote: Hello, Suppose I have the dataset shown below. The amount of observations is too massive to get a nice geom_point and smoother on top. What I would like to do is to bin the data first. The data is indexed by Time

Re: [R] Plotting text?

2011-10-24 Thread Kevin Burton
Thank you. This works pretty well. I am having some trouble with the text on the left-hand side getting cut off. I have tried haling=center with not luck. How can I make the text seem wider than it really is to avoid the truncation. It is only a few characters but still it is annoying. Thank you.

Re: [R] Plotting text?

2011-10-24 Thread Kevin Burton
I get the following error trying to install the package: install.packages(grid) --- Please select a CRAN mirror for use in this session --- Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘grid’ is not available (for R version 2.13.2) -Original

Re: [R] Plotting text?

2011-10-24 Thread Uwe Ligges
grid is an R base package that always ships with R and is not distributed in the repository of contributed packages. Uwe Ligges On 24.10.2011 14:50, Kevin Burton wrote: I get the following error trying to install the package: install.packages(grid) --- Please select a CRAN mirror for use

Re: [R] How to create a new variable based on parts of another character variable.

2011-10-24 Thread Petr PIKAL
Hi If you want to get rid of regular expressions at all and your A values start AWI for Arctic and UFT for boreal you can DF$D - ifelse(substr(DF$A, 1,1) == A, Arctic, Boreal) Regards Petr Hello, I am just starting with R and I am having a (most probably) stupid problem by creating a

Re: [R] merging two dataframes

2011-10-24 Thread Petr PIKAL
Hi Hello I am a new user of R and I need help to merge two large datasets about stocks with different number of rows and columns. Both have 2 variable(column) that are have same values (name and date1), but they are not in same order and data3 contains much more observations. In the

Re: [R] Plotting text?

2011-10-24 Thread Eik Vettorazzi
Hi Kevin, this should be read as halign=center - so is it a typo just in your mail or in your program as well? apart from that, the rules at the bottom lines of every post on this list also apply here: what have you tried and what went wrong? Cheers Am 24.10.2011 14:48, schrieb Kevin Burton:

[R] splitting a string into words preserving blanks (using regex)

2011-10-24 Thread Mark Heckmann
I would like to split a string into words at its blanks but also to preserve all blanks. Example: c( somewords to split ) should become c( , some,, words, , to , , split, ) I was not able to achieve this via strsplit() . But I am not familiar with regular

Re: [R] splitting a string into words preserving blanks (using regex)

2011-10-24 Thread Gabor Grothendieck
On Mon, Oct 24, 2011 at 9:46 AM, Mark Heckmann mark.heckm...@gmx.de wrote: I would like to split a string into words at its blanks but also to preserve all blanks. Example:        c( some    words to split ) should become        c( , some,   , words, , to , , split, ) I was not able

Re: [R] splitting a string into words preserving blanks (using regex)

2011-10-24 Thread Eik Vettorazzi
Hi Mark, here is a way using gsub to insert a split marker and strsplit. strsplit(gsub(([[:alnum:]]+),|\\1|,c( somewords to split ))[[1]] cheers Am 24.10.2011 15:46, schrieb Mark Heckmann: I would like to split a string into words at its blanks but also to preserve all blanks.

Re: [R] How to delete rows using conditions on all columns

2011-10-24 Thread markheckmann
If you don't mind using a loop, e.g. like this: x - mydata qs - sapply(x, function(x) quantile(x, c(0.01, 0.99))) for (i in 1:ncol(x)) x - subset(x, x[ ,i] = qs[1,i] x[ ,i] = qs[2,i]) -- View this message in context:

Re: [R] Survival analysis

2011-10-24 Thread Terry Therneau
On Sun, 2011-10-23 at 12:00 +0200, r-help-requ...@r-project.org wrote: The results by the survfit routine do not agree with the results of these formulae as obtained by SAS. The next question should be is SAS correct. The answer in this case is no. For survival data the mean

[R] Dominating set

2011-10-24 Thread amir
Hi, Is there any way to find the Connected Dominating Set (CDS) of a graph in R? Regards, Amir __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] merging two dataframes

2011-10-24 Thread dividend
Thank you Petr! I have read on the merge help page, but I cant figure out how to write this function. When I use your function it includes all data from data3, but all columns in data has NA(without name and date. I hoped to keep these values to. I try to explain it more precise: In data with

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-24 Thread apeer
One last thing. At the outset of this discussion I provided the results of a validation procedure on a model (see below). As discussed previously, the model overall seems to fair well, with the exception of the slope. With that in mind, is there a way to correct the coefficients of the model to

[R] Creating data frame with residuals of a data frame

2011-10-24 Thread francesca casalino
Dear experts, I am trying to create a data frame from the residuals I get after having applied a linear regression to each column of a data frame, but I don't know how to create this data frame from the resulting list since the list has differing numbers of rows. So for example: age-

Re: [R] Date column in downloaded date

2011-10-24 Thread R. Michael Weylandt michael.weyla...@gmail.com
Comments inline. On Oct 24, 2011, at 1:43 AM, ajc arkos...@gmail.com wrote: Hi All: If I download yahoo data by getSymbols() in R, from the quantmod package the date column gets accompanied along with the downloaded data. There is no column header for the date column to access

Re: [R] Survival analysis

2011-10-24 Thread Cem Girit
Hello Terri, Thank you very much. This is the answer I needed. Could you also tell me how I can calculate 25 and 50% quantiles in R? I can only get median as far as I know. Cem Cem Girit   -Original Message- From: Terry Therneau [mailto:thern...@mayo.edu] Sent: Monday,

[R] nonlinear model

2011-10-24 Thread mitra Rahmati
Hello, I am trying to do a nonlinear model using the nls command in R software. The data I am using is as follows: A-c(7.132000,8.668667,9.880667,8.168000,10.86,10.381333,11.059333,7.589333,4.716667,4.268667,7.265333,10.309333,8.456667,13.359333,8.624000,13.571333,12.52,4.084667 ,NaN,NaN)

[R] Length of string?

2011-10-24 Thread Kevin Burton
This is very basic but I have not been able to find an answer. Basically I want to find the length of a string. length(Text) returns 1 so I know that is not right. Thank you. Kevin __ R-help@r-project.org mailing list

Re: [R] Plotting text?

2011-10-24 Thread Kevin Burton
I was able to solve it by supplying the 'mar' argument. Even when I spell it right this argument did not solve it. Thanks again. Kevin -Original Message- From: Eik Vettorazzi [mailto:e.vettora...@uke.de] Sent: Monday, October 24, 2011 8:46 AM To: Kevin Burton Cc: r-help@r-project.org

Re: [R] Problem with svyvar in survey package

2011-10-24 Thread Thomas Lumley
On Mon, Oct 24, 2011 at 4:21 AM, amitava amtv.statpr...@gmail.com wrote: I am facing a problem with a function in survey package. The function svyvar gives the estimated population variance from a given sampling scheme.  I am working with a data having more than four continuous variables. In

[R] R.oo package: do setMethodS3 work upon construction

2011-10-24 Thread Ben quant
Hello (Heinrich), I did not know I could do this. It doesn't seem to be documented anywhere. Thought this would be helpful to the fraction of the community using package R.oo. Note the call of a setMethodS3 method, xOne, in the setConstructorS3. This is extremely useful if xOne (in this case) is

Re: [R] Length of string?

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 11:14 AM, Kevin Burton wrote: This is very basic but I have not been able to find an answer. Basically I want to find the length of a string. length(Text) ?nchar returns 1 so I know that is not right. Thank you. Kevin

[R] Lm function: Error in model.frame.default

2011-10-24 Thread Julie
Hello, I am trying to get a linear model of y ~ log(x). * lm (y~log(x))* However, I always get an error report: /Error in model.frame.default(formula = y ~ log(x), drop.unused.levels = TRUE) : variable lengths differ (found for 'log(x)')/ *Here was my y:* y [1]0.4500.050

[R] How to selectively sum rows [Beginner question]

2011-10-24 Thread asindc
Hi, I am new to R so I would appreciate any help. I have some data that has passenger flight data between city pairs. The way I got the data, there are multiple rows of data for each city pair; the number of passengers needs to be summed to get a TOTAL annual passenger count for each city pair.

Re: [R] Length of string?

2011-10-24 Thread Timothy Bates
Dear Kevin, # this works nchar(read the help for length”) [1] 24 On 24 Oct 2011, at 4:14 PM, Kevin Burton wrote: This is very basic but I have not been able to find an answer. Basically I want to find the length of a string. length(Text) returns 1 so I know that is not right. Thank

[R] PCA and Regression with complex categorical variables

2011-10-24 Thread seanstclair
__ 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 and provide commented, minimal, self-contained, reproducible code.

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread Rich Shepard
On Fri, 21 Oct 2011, David Winsemius wrote: The first thing I would try would be with(subset(chemdata, param %in% c('TDS', 'Cond', 'Mg', 'SO4', 'Cl', 'Na', and 'Ca') , 1:4) , xtabs(quant ~ site + sampdate + param) ) David, Need to remove the 'and' from the above. The results

Re: [R] nonlinear model

2011-10-24 Thread David Stevens
Mitra You have a couple of problems. First, if you plot the data (plot(A~Pot)) you'll see there's little chance that an asymptotic, exponential equation describes your data because they don't rise from zero to Amax as your model assumes. If Pot is your only independent variable, the best

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 11:34 AM, Rich Shepard wrote: On Fri, 21 Oct 2011, David Winsemius wrote: The first thing I would try would be with(subset(chemdata, param %in% c('TDS', 'Cond', 'Mg', 'SO4', 'Cl', 'Na', and 'Ca') , 1:4) , xtabs(quant ~ site + sampdate + param) ) David, Need to

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread R. Michael Weylandt
You are trying to regress ~372 observations of the dependent against ~4 observations of the independent variable. Ask yourself again if this makes sense. A further hint might be given by this y = rnorm(5); x = y[1:4] lm(y~x) Michael On Mon, Oct 24, 2011 at 11:13 AM, Julie

[R] bestglm function and output in R

2011-10-24 Thread Candice
Hi all, I have been trying to run a bestglm in R for a while now and am struggling to get it to run. When I thought I had succeeded, the output it gave me was NULL and that's it. Below is my code: bestglmtest-read.table(C:\\Documents and

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread jim holtman
It would be good to follow the posting guide and at least supply a sample of the data. Most likely 'tapply' is one way of doing it: tapply(df$passenger, list(df$orig, df$dest), sum) On Mon, Oct 24, 2011 at 11:27 AM, asindc siiri...@eastwestcenter.org wrote: Hi, I am new to R so I would

[R] using lme and 'by' function to extract the co-efficients by individuals

2011-10-24 Thread tom_pienkowski
Hi all I'm trying to use the 'by' function to extract the co-efficients from a mixed model which is performed on multiple individuals. I basically have a group of individuals and for each individual I want the co-efficient for there change in 'pots_hauled' in response to a change in 'vpue' with

[R] new to R coding.

2011-10-24 Thread tynashy
how do I code the following in R. I want to produce a vector where dx=log( (d(x))/(d(x-1)) ). I can do it for dx=diff(log(x)). I am learning/trying to model log returns of a stock market index. But instead of using the difference of the closing values of two consecutive days, i want to use the log

Re: [R] How to create a new variable based on parts of another character variable: A generalization

2011-10-24 Thread Bert Gunter
... Well, this works in this simple case, but is too clumsy for a general formulation of this problem: given a dictionary consisting of two character vectors of unique names (or two columns in a data frame), x and y, how does one convert a factor z with levels in x into the corresponding

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Dennis Murphy
See the count() function in the plyr package; it does fast summation. Something like library('plyr') count(passengerData, c('ORIGIN_WAC', 'DEST_WAC'), 'npassengers') HTH, Dennis On Mon, Oct 24, 2011 at 8:27 AM, asindc siiri...@eastwestcenter.org wrote: Hi, I am new to R so I would appreciate

Re: [R] cycling through a long list of files and names

2011-10-24 Thread Wet Bell Diver
Thanks so much, this is very very helpful. I do have one remaining question here. I definitely see the value of making a list of the datasets, an advise I will definitely follow. However, for educational purposes, I would still like to know how to automate the following without using a list:

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, David Winsemius wrote: The appearance of levels with all zeroes is probably because I didn't include drop.unused.levels = FALSE in the xtabs specification. OK. Adding 'drop.unused.levels' does make a huge difference. Thanks, Rich

Re: [R] new to R coding.

2011-10-24 Thread R. Michael Weylandt
Assuming that d(x) is equal to x, (I don't know a d() function in R) these should be the same. log(a/b) = log(a) - log(b) = diff(log(c(a,b)) If you mean simple returns instead of continuous/log returns, perhaps try this: x[-1]/x[-length(x)] - 1 Michael On Mon, Oct 24, 2011 at 11:44 AM,

Re: [R] merging two dataframes

2011-10-24 Thread Jeff Newmiller
The merge function seems perfect for your problem. If you can't get it to work, the problem may be in the data you are working with, which you have not supplied (read the posting guide, and use the head and dput functions to make your example small and reproducible). One common mistake by

Re: [R] cycling through a long list of files and names

2011-10-24 Thread jim holtman
Write a function that encapsulates the following three lines: city1997- dataCleaning(read.csv2(C:\\city\\year1997.txt)) city1997- wasteCalculations(city1997, year = 1997) if (city1997[1,1] == Time) {city1997- timeCalculations(city1997)} and then pass in the appropriate parameters. On Mon, Oct

Re: [R] bestglm function and output in R

2011-10-24 Thread Dennis Murphy
Hi: bestglmtest is your input data frame, is it not? From the names() line, you can see that it has no variable named BestModel that corresponds to a list containing a component named coefficients. Were you perhaps looking for output$BestModel$coefficients ?? Dennis On Mon, Oct 24, 2011 at

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread Jeff Newmiller
X and y must have the same number of elements, and NA values must be removed (?na.omit) --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing

Re: [R] cex multiplier not exact

2011-10-24 Thread Ali Tofigh
On Mon, Oct 24, 2011 at 06:10, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On Mon, 24 Oct 2011, Uwe Ligges wrote: On 23.10.2011 22:33, Ali Tofigh wrote: Hi, When I plot text and use cex to change the text size, I notice that the cex multiplier is not exact. It looks as if the real

Re: [R] cycling through a long list of files and names

2011-10-24 Thread R. Michael Weylandt
You might also need the assign() function which is sort of the opposite of get() Michael On Mon, Oct 24, 2011 at 12:15 PM, jim holtman jholt...@gmail.com wrote: Write a function that encapsulates the following three lines: city1997- dataCleaning(read.csv2(C:\\city\\year1997.txt)) city1997-

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread David Winsemius
On Oct 24, 2011, at 12:10 PM, Rich Shepard wrote: On Mon, 24 Oct 2011, David Winsemius wrote: The appearance of levels with all zeroes is probably because I didn't include drop.unused.levels = FALSE in the xtabs specification. OK. Adding 'drop.unused.levels' does make a huge difference.

Re: [R] using lme and 'by' function to extract the co-efficients by individuals

2011-10-24 Thread Ben Bolker
tom_pienkowski tom.pienkowski at blueyonder.co.uk writes: I'm trying to use the 'by' function to extract the co-efficients from a mixed model which is performed on multiple individuals. I basically have a group of individuals and for each individual I want the co-efficient for there change in

Re: [R] Working With Variables Having Different Lengths

2011-10-24 Thread Rich Shepard
On Mon, 24 Oct 2011, David Winsemius wrote: You could also have saved the subsetted data, applied `factor` to the subsetted column and then used `xtabs`. temp - subset(chemdata, your subset criteria, your column selection) temp$param - factor(temp$param) (Now only levels that exist are in the

Re: [R] new to R coding.

2011-10-24 Thread R. Michael Weylandt
Try it yourself: x = seq(1, 11, by = 2) diff(log(x)) log(x[-1]/x[-length(x)]) all.equal(diff(log(x)), log(x[-1]/x[-length(x)])) It seems like you don't really understand logs / log returns and why they are used by some in quant finance: might I suggest you read this:

[R] Adding rows to a table with a loop

2011-10-24 Thread MJS
Hi All, Its a bit of a beginners question I'm afraid. I have a looped stepwise regression (using MASS and StepAIC) to take random predictors out of the total number. For this example a random sample of 5 out of a total of 20. The loop will continue until all combinations of variables have been

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Aaron Siirila
Sorry, I attempted to paste the sample data but it must have been stripped out when I posted. It is hopefully now listed below. tapply looks useful. I will check it out further. Here's the sample data: flights[1:10,] PASSENGERS DISTANCE ORIGIN ORIGIN_CITY_NAME ORIGIN_WAC DEST

Re: [R] Lm function: Error in model.frame.default

2011-10-24 Thread Julie
The variable y is made of four columns, each paired to 20, 200, 2000 or 20 000. y - c(rdiktator20, rDiktator200, rDikt2000, rDikt2) So I guess the problem is in the fact that I did not specify it correctly, is it so? How can I tell R properly that one part of y matches to one part of x? The

Re: [R] new to R coding.

2011-10-24 Thread tynashy
I am new to R coding and I am trying to model the returns on the ftse100 since 1990. I have got a vector with all the closing values on each trading day. however, instead of using the difference in the closing values of two consecutive days, (ie dx=diff(x) where x is the vector containing the

Re: [R] How to selectively sum rows [Beginner question]

2011-10-24 Thread Aaron Siirila
The count() function in the plyr package works beautifully. Thanks to Jim, Rainer and Dennis for your help. Best. -Original Message- From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Monday, October 24, 2011 12:05 PM To: asindc Cc: r-help@r-project.org Subject: Re: [R] How to

[R] Creating a histogram properly

2011-10-24 Thread Joe Carl
Hello all, I'm trying to make a histogram of the data contained in my dataframe. The summary of the data gives me exactly what I want summary (Data) V1 V2 first001: 3 last001: 9 first002: 3 last002: 7 first003: 2 last003: 6 (Other) :52(Other): 27 But how do I capture the names and

Re: [R] 2 x 3 Tables

2011-10-24 Thread Jim Silverton
Hello all, I have the following. Two sets of p x 3 matrices where p is say relatively large. My data looks like : mat1 2 3 4 2 3 4 1 2 3 mat2 2 3 4 12 12 4 10 12 3 when p = 3. I form a 2 x 3 contingency table using the i^th row from each matrix. Its Fisher's exact

Re: [R] Creating a histogram properly

2011-10-24 Thread Joshua Wiley
What about? hist(Data$V1) hist(Data$V2) Cheers, Josh On Mon, Oct 24, 2011 at 9:38 AM, Joe Carl joseph.w.carl...@gmail.com wrote: Hello all, I'm trying to make a histogram of the data contained in my dataframe. The summary of the data gives me exactly what I want summary (Data) V1    

Re: [R] Adding rows to a table with a loop

2011-10-24 Thread Weidong Gu
It surely can be done. One way is to keep track of selected variables in a set. If a new variable is selected, you expand the selected set and set the frequency to be one, otherwise just increase the freqency of the selected variable (if... else). Also, you might want to have a look at glmulti

[R] Adding points to a wireframe: 'x and units must have length 0' error

2011-10-24 Thread Megan Bartlett
Hi, I'm trying to follow the suggestions given by Deepayan Sarkar in this message: http://tolstoy.newcastle.edu.au/R/help/05/11/16135.html to plot 3-D points on a wireframe plot. The problem is that I keep getting a partly formed plot- with the colored lattice visible but no axis labels or

[R] extract the p value

2011-10-24 Thread Jim Bouldin
OK, what is the trick to extracting the overall p value from an lm object? It shows up in the summary(lm(model)) output but I can't seem to extract it: test2 = apply(aa, 1, function(x) summary(lm(x[,1] ~ 0 + x[,3] + x[,6]))) test2[[1]] Call: lm(formula = x[, 1] ~ 0 + x[, 3] + x[, 6]) [omitted

Re: [R] extract the p value

2011-10-24 Thread Joshua Wiley
Hi Jim, Its a bit of a trick question. There isn't actually any overall p value stored in the lm object, or even in the summary.lm object. It is calculated from the f statistic by the print methods for summary.lm. Of course, none of that helps, per se. Try this: summary(lm(mpg ~ hp, data =

Re: [R] extract the p value

2011-10-24 Thread R. Michael Weylandt
It's not directly extractable since it's calculated on the fly in the printing method. If you type stats:::print.summary.lm, you can see the code the leads to the calculation: It's basically (I'm leaving out some formatting stuff): pf(x$fstatistic[1L], x$fstatistic[2L], x$fstatistic[3L],

Re: [R] extract the p value

2011-10-24 Thread Duncan Murdoch
On 24/10/2011 1:47 PM, Jim Bouldin wrote: OK, what is the trick to extracting the overall p value from an lm object? It shows up in the summary(lm(model)) output but I can't seem to extract it: It's not part of the object, it is computed when the object is printed. To see the print method,

Re: [R] Creating a histogram properly

2011-10-24 Thread Dennis Murphy
Hi: Aren't V1 and V2 factors in this data frame? If so, you should be plotting bar charts rather than histograms (they're not the same). Do you want separate graphs for V1 and V2, do you want them stacked, or do you want them dodged (side-by side for each level 001, 002, 003)? In the absence of

Re: [R] subplot strange behavoir

2011-10-24 Thread Greg Snow
I see the problem, I fixed this bug for version 2.8 of TeachingDemos, but have not submitted the new version to CRAN yet (I thought that I had fixed this earlier, but apparently it is still only in the development version). An easy fix is to install version 2.8 from R-forge

  1   2   >