Re: [R] attach

2009-10-18 Thread Bernardo Rangel Tura
On Wed, 2009-10-14 at 07:21 +0200, Christophe Dutang wrote: Hi all, I have a question regarding the memory usage for the attach function. Say I have a data.frame inputdat that I create with read.csv. I would like to know what happens on the memory side when I use attach(inputdata) Is

Re: [R] How do I access with the name of a (passed) function

2009-10-18 Thread Duncan Murdoch
On 17/10/2009 7:26 AM, Ajay Shah wrote: How would I do something like this: f - function(x, g) { s - as.character(g) # THIS DOES NOT WORK sprintf(The %s of x is %.0f\n, s, g(x)) } Gabor showed you how to do it if you pass an expression which evaluates to a function. If you

Re: [R] function to convert lm model to LaTeX equation

2009-10-18 Thread Frank E Harrell Jr
Ista Zahn wrote: Dear list, I've tried several times to wrap my head around the Design library, without much success. It does some really nice things, but I'm often uncomfortable because I don't understand exactly what it's doing. Anyway, one thing I really like is the latex.ols() function,

Re: [R] function to convert lm model to LaTeX equation

2009-10-18 Thread Ista Zahn
On Sun, Oct 18, 2009 at 9:09 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ista Zahn wrote: Dear list, I've tried several times to wrap my head around the Design library, without much success. It does some really nice things, but I'm often uncomfortable because I don't understand

Re: [R] QQ plot

2009-10-18 Thread Peter Dalgaard
Madan Sigdel wrote: Dear users I have applied following for my works: library(car) x-scan() 1: 0.92545 2: 0.89321 3: 0.9846 4: 2.9 5: 0.85968 6: 5.2 7: 4.66 8: 1.18788 9: 1.07683 10: 1.07683 11: 8.38 12: 7.423 13: 0.972 14: 3.73 15: 1.06474 16: 1.48 17: 0.92876 18: 2.26493 19: 0.85696 20:

[R] optimization problem with constraints..

2009-10-18 Thread Prof. John C Nash
Apologies if this shows up a second time with uninformative header (apparently it got filtered, but ...), as I forgot to replace the subject line. As a first try, use a bounds constrained method (L-BFGS-B or one from the r-forge Optimizer project http://r-forge.r-project.org/R/?group_id=395)

Re: [R] Putting names on a ggplot

2009-10-18 Thread John Kane
Thanks Stefan, the annotate approach works beautifully. I had not got that far in Hadley's book apparently :( I'm not convinced though that the explaination you shouldn't use aes in this case since nampost, temprange, ... are not part of the dataframe year. makes sense since it seems to

Re: [R] looking for reference that covers convergence in distribution

2009-10-18 Thread Ben Bolker
Peng Yu wrote: On Sat, Oct 17, 2009 at 3:28 PM, Peter Dalgaard p.dalga...@biostat.ku.dk wrote: Ben Bolker wrote: Peng Yu wrote: I am looking for a good probability book that describes convergence in distribution. I have looked through Introduction to Probability by Charles M.

Re: [R] R-help Digest, Vol 80, Issue 18

2009-10-18 Thread Prof. John C Nash
As a first try, use a bounds constrained method (L-BFGS-B or one from the r-forge Optimizer project http://r-forge.r-project.org/R/?group_id=395) and then add a penalty or barrier function to your objective function to take care of the x1+x2 1 (the other end is implicit in the lower bounds

Re: [R] Proper syntax for using varConstPower in nlme

2009-10-18 Thread Kingsford Jones
On Fri, Oct 16, 2009 at 3:56 PM, Michael A. Gilchrist mi...@utk.edu wrote: Hi Dieter, Thanks for the reply.  I had played with the initial conditions, but apparently not enough.  I finally found some that avoided the singularity issue.  Many thanks. More generally, I went over the

[R] Fit copulas to data

2009-10-18 Thread emkayenne
Hello! For those of you who have ever dealt with copulas in R, youcould maybe help me. : I have used R to fit a couple of bivariate Archimedean copulas to financial data. R gives a parameter and a z-value and a third number that is supposedly some kind of p-value. An example of what I get after

Re: [R] Invoking par(mfrow...) on an already subdivided plot

2009-10-18 Thread Uwe Ligges
Maxwell Reback wrote: I'd like to generate on a single device multiple plots, each of which contains two plots. Essentially, I've got sub-plots which consist of two tracks, the upper one displaying gene expression data, and the lower one mapping position. I'd like to display four of these

[R] How to plot multiple data sets with different colors (also with legend)?

2009-10-18 Thread Peng Yu
The following commands only show the data in 'y'. I'm wondering how to show the data in 'x' as well. I also want to add a legend to show that blue points corresponds to 'x' and yellow points correspond to 'y'. Could somebody let me know what the correct commands should be?

[R] How to create MULTILEVELS in a dataset??

2009-10-18 Thread saurav pathak
Dear R users I have a data set which has five variables. One depenedent variable y, and 4 Independent variables (education-level, householdincome, countrygdp and countrygdpsquare). The first two are data corresponding to the individual and the next two coorespond to the country to which the

Re: [R] Putting names on a ggplot

2009-10-18 Thread ml
hello, On Sun, Oct 18, 2009 at 08:29:19AM -0700, John Kane wrote: Thanks Stefan, the annotate approach works beautifully. I had not got that far in Hadley's book apparently :( I'm not convinced though that the explaination you shouldn't use aes in this case since nampost, temprange,

Re: [R] using a custom color sequence for image()

2009-10-18 Thread Jim Lemon
On 10/17/2009 01:25 AM, Rajarshi Guha wrote: Hi, I'd like to use a custom color sequence (black - low values, green - high values) in am image() plot. While I can specify colors (say a sequence of grays) to the col argument, the ordering is getting messed up. I have two questions: 1. How can I

Re: [R] How to plot multiple data sets with different colors (also with legend)?

2009-10-18 Thread Matthieu Dubois
Hi, the blue point is not shown simply because it is printed outside the current plot area. If you want to use the base graphics, you have to manually define the xlim and ylim of the plot. Legend is added with the command legend. E.g. x=rbind(c(10,11),c(10,11)) y=cbind(-1:0,-1:0)

Re: [R] Putting names on a ggplot

2009-10-18 Thread John Kane
--- On Sun, 10/18/09, m...@z107.de m...@z107.de wrote: From: m...@z107.de m...@z107.de Subject: Re: [R] Putting names on a ggplot To: John Kane jrkrid...@yahoo.ca Cc: R R-help r-h...@stat.math.ethz.ch Received: Sunday, October 18, 2009, 6:05 PM hello, On Sun, Oct 18, 2009 at 08:29:19AM

Re: [R] How to plot multiple data sets with different colors (also with legend)?

2009-10-18 Thread Jim Lemon
On 10/19/2009 07:37 AM, Peng Yu wrote: The following commands only show the data in 'y'. I'm wondering how to show the data in 'x' as well. I also want to add a legend to show that blue points corresponds to 'x' and yellow points correspond to 'y'. Could somebody let me know what the correct

[R] rbind to array members

2009-10-18 Thread Another Oneforyou
Hi, I would like to add rows to arbitrary tables within a 3dimensional array. I can directly add data to an existing row of a table: x - array(0,c(1,3,2)) x[,,1] - c(1,2,3) And I can even add a row to the table and assign to another object. y - rbind(x[,,1], c(4,5,6)) and 'y' is what I want it

[R] CRAN (and crantastic) updates this week

2009-10-18 Thread Crantastic
CRAN (and crantastic) updates this week New packages * adaptTest (1.0) Marc Vandemeulebroecke http://crantastic.org/packages/adaptTest The functions defined in this program serve for implementing adaptive two-stage tests. Currently, four tests are included: Bauer and

Re: [R] How to plot multiple data sets with different colors (also with legend)?

2009-10-18 Thread Peng Yu
On Sun, Oct 18, 2009 at 5:42 PM, Matthieu Dubois matth...@gmail.com wrote: Hi, the blue point is not shown simply because it is printed outside the current plot area. If you want to use the base graphics, you have to manually define the xlim and ylim of the plot. Legend is added with the

[R] Error: object 'cloud' not found

2009-10-18 Thread PerfectTiling
Hi, I installed the lattice package so I can plot 3D cloud scatterplots: install.packages(lattice) But (after successfully installing from the Berkeley mirror), R insists it cannot find the cloud function, part of the lattice package: cloud Error: object 'cloud' not found What did I

Re: [R] Error: object 'cloud' not found

2009-10-18 Thread Rolf Turner
On 19/10/2009, at 2:16 PM, PerfectTiling wrote: Hi, I installed the lattice package so I can plot 3D cloud scatterplots: install.packages(lattice) But (after successfully installing from the Berkeley mirror), R insists it cannot find the cloud function, part of the lattice package:

Re: [R] Error: object 'cloud' not found

2009-10-18 Thread Roy Mendelssohn
library(lattice) Roy M. On Oct 18, 2009, at 6:16 PM, PerfectTiling wrote: Hi, I installed the lattice package so I can plot 3D cloud scatterplots: install.packages(lattice) But (after successfully installing from the Berkeley mirror), R insists it cannot find the cloud function, part

Re: [R] Error: object 'cloud' not found

2009-10-18 Thread Jorge Ivan Velez
Hi PT, Try loading the lattice package first: # install.packages('lattice') require(lattice) ?cloud HTH, Jorge On Sun, Oct 18, 2009 at 9:16 PM, PerfectTiling wrote: Hi, I installed the lattice package so I can plot 3D cloud scatterplots: install.packages(lattice) But (after

Re: [R] rbind to array members

2009-10-18 Thread Richard M. Heiberger
library(abind) ## array binding __ 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

[R] Why points() is defined specially for a 1 by 2 matrix?

2009-10-18 Thread Peng Yu
x=cbind(1:4,3:6) png('one_point.png') plot(x[1:3,],xlim=c(-1,11),ylim=c(-1,11),pch=1) points(x[4,],pch=2)# this is plotted as two points #although I meant only one point legend(topleft, c(x,y),pch=c(1,2)) dev.off() The above code will produce 5 points instead of 4 points. If I want to have 4

[R] Identifying similar but not identical rows in a dataframe

2009-10-18 Thread Jeffrey Salinger
I would like to identify _almost_ duplicated rows in a data frame.  For example, I might declare as duplicates pairs of rows that are alike at about 80% of their columns.  When working with tens of thousands of rows and upwards of 20 columns an iterative approach, testing all permutations, can

[R] Filtering on a dataframe- newbie question

2009-10-18 Thread ANJAN PURKAYASTHA
Hi, newbie question. I have a data-frame with 3 named columns: Name, Obs1, Obs2. The Name column members are made of alphanumeric characters: T1, T2, T3 etc. I would like to acess only that subset of the data-frame with Name == T44. X - dataframe[dataframe$Name=='T44'] does not work. Any ideas on

Re: [R] Filtering on a dataframe- newbie question

2009-10-18 Thread milton ruser
Hi there, Try ?subset ?str may also be useful.. bests milton On Sun, Oct 18, 2009 at 11:10 PM, ANJAN PURKAYASTHA anjan.purkayas...@gmail.com wrote: Hi, newbie question. I have a data-frame with 3 named columns: Name, Obs1, Obs2. The Name column members are made of alphanumeric

Re: [R] How to plot multiple data sets with different colors (also with legend)?

2009-10-18 Thread Ista Zahn
Hi Peng, Comments below. On Sun, Oct 18, 2009 at 9:22 PM, Peng Yu pengyu...@gmail.com wrote: On Sun, Oct 18, 2009 at 5:42 PM, Matthieu Dubois matth...@gmail.com wrote: Hi, the blue point is not shown simply because it is printed outside the current plot area. If you want to use the base

Re: [R] Why points() is defined specially for a 1 by 2 matrix?

2009-10-18 Thread Richard M. Heiberger
points(x[4,],pch=2)# this is plotted as two points drops what it sees as an unnecessary dimension. Use points(x[4,, drop=FALSE], pch=2) See FAQ 7.5 tmp - matrix(1:2) tmp tmp[,1] tmp[,1,drop=FALSE] __ R-help@r-project.org mailing list

[R] modifying model coefficients

2009-10-18 Thread tdm
I have build a model but want to then manipulate the coefficients in some way. I can extract the coefficients and do the changes I need, but how do I then put these new coefficients back in the model so I can use the predict function? my_model - lm(x ~ . , data=my_data) my_scores -

Re: [R] Filtering on a dataframe- newbie question

2009-10-18 Thread Rolf Turner
On 19/10/2009, at 4:23 PM, milton ruser wrote: Hi there, Try ?subset No. Don't. Just do: X - dataframe[dataframe$Name=='T44',] Note the comma in the penultimate position. Read up on array indexing; see ?[ and An Introduction to R, section

[R] What is the difference between prcomp and princomp?

2009-10-18 Thread Peng Yu
Some webpage has described prcomp and princomp, but I am still not quite sure what the major difference between them is. Can they be used interchangeably? In help, it says 'princomp' only handles so-called R-mode PCA, that is feature extraction of variables. If a data matrix is

[R] order of interaction coeff in lm

2009-10-18 Thread slurpy
Hi. I haven't found this question asked elsewhere, so I hope I am not missing something trivial. y-rnorm(1:10) x1-rnorm(1:10) x2-rnorm(1:10) x3-rnorm(1:10) x4-rnorm(1:10) reg-lm(y~x1*x2+x3+x4) summary(reg) The output of this puts x1:x2 after x3 and x4. In my case this is very cumbersome

Re: [R] What is the difference between prcomp and princomp?

2009-10-18 Thread Peng Yu
On Sun, Oct 18, 2009 at 10:42 PM, Peng Yu pengyu...@gmail.com wrote: Some webpage has described prcomp and princomp, but I am still not quite sure what the major difference between them is. Can they be used interchangeably? In help, it says     'princomp' only handles so-called R-mode PCA,

Re: [R] How to create MULTILEVELS in a dataset??

2009-10-18 Thread Ista Zahn
Hi Saurav, I was waiting for someone else to answer you, because I'm not sure I'll be able to explain clearly. But since no one is jumping on it, I'll take a stab. On Sun, Oct 18, 2009 at 5:52 PM, saurav pathak pathak.sau...@gmail.com wrote: Dear R users I have a data set which has five

Re: [R] Why points() is defined specially for a 1 by 2 matrix?

2009-10-18 Thread Ben Bolker
Peng Yu wrote: On Sun, Oct 18, 2009 at 10:26 PM, Richard M. Heiberger r...@temple.edu wrote: points(x[4,],pch=2)# this is plotted as two points drops what it sees as an unnecessary dimension. Use points(x[4,, drop=FALSE], pch=2) See FAQ 7.5 tmp - matrix(1:2) tmp tmp[,1]