[R] Changing list to variable

2009-09-14 Thread Arif Chandra
Hi, I have obstacles in changing list to variable, if I have name=names(x) name --> contain "Sales1", "Sales2" and then I want to call: model$stability$name The list name above will refer to Sales1 and Sales2 How can I do that? thanks __

Re: [R] linear regression, exclude a datum

2009-09-14 Thread e-letter
On 14/09/2009, Steve Lianoglou wrote: > Hi, > > On Sep 14, 2009, at 9:47 AM, e-letter wrote: > >> Readers, >> >> I have been reading the r book (Crawley) and tried to use the >> influence measures function for linear regression, as described. I >> have one datum that I wish to show in the graph bu

Re: [R] problems with reshape

2009-09-14 Thread Schalk Heunis
Some hints:The reshape works on the small set of data provided. The answer looks like this: > reshape(rl, idvar=c("sil_cf","sil_pi"), timevar="prog", direction="wide") sil_pi sil_cf id_rl.1 sil_dat_avv.1 id_rl.2 sil_dat_avv.2 1 04567XX NLMDRE64A5XX 6382000-08-03

Re: [R] X-axis range

2009-09-14 Thread Chris Li
Thanks Peter. I have tried your approach, and it does not work. I guess it is because the format of the x-axis (and its associated data) has the format of date while numbers like 1998, 2003 etc. are treated as numeric (i.e. not the date format). Thank you for your time anyway. :) Cheers, Chris

[R] trouble installing qvalue package

2009-09-14 Thread Sheena Townsend
Hello all, I'm trying to use the package qvalue. Upon trying to install it I'm running into trouble. I re-downloaded and installed the most recent CRAN distribution of R which announced itself to have tcltk included. Now when I try to load qvalue I'm getting errors that seem to indicate that I need

Re: [R] symbols(x,y, circles=sqrt(N)) with lattice xyplot

2009-09-14 Thread Deepayan Sarkar
On Mon, Sep 14, 2009 at 3:55 PM, Jacob Wegelin wrote: > How would I create the following plot using lattice? > > symbols( combPsummary$pastRate, combPsummary$finRate, > circles=sqrt(combPsummary$N) ) > > The idea is to plot finRate vs pastRate using circles whose areas are > proportional to the nu

Re: [R] R Memory Usage Concerns

2009-09-14 Thread Henrik Bengtsson
As already suggested, you're (much) better off if you specify colClasses, e.g. tab <- read.table("~/20090708.tab", colClasses=c("factor", "double", "double")); Otherwise, R has to load all the data, make a best guess of the column classes, and then coerce (which requires a copy). /Henrik On Mon

Re: [R] X-axis range

2009-09-14 Thread Peter Alspach
Tena koe Chris ?axis e.g., plot(yourX, yourY, xlim=c(1998,2008), xaxt='n') axis(1, c(1998,2003,2008)) HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Chris Li > Sent: Tuesday, 15 September 2009 3:22 p

Re: [R] R Memory Usage Concerns

2009-09-14 Thread hadley wickham
> its 32-bit representation. This seems like it might be too > conservative for me, since it implies that R allocated exactly as much > memory for the lists as there were numbers in the list (e.g. typically > in an interpreter like this you'd be allocating on order-of-two > boundaries, i.e. sizeof(

Re: [R] R Memory Usage Concerns

2009-09-14 Thread hadley wickham
> I think this is just because you picked short strings. If the factor > is mapping the string to a native integer type, the strings would have > to be larger for you to notice: > >> object.size(sample(c("a pretty long string", "another pretty long string"), >> 1000, replace=TRUE)) > 8184 bytes >>

Re: [R] R Memory Usage Concerns

2009-09-14 Thread Evan Klitzke
On Mon, Sep 14, 2009 at 8:58 PM, Eduardo Leoni wrote: > And, by the way, factors take up _more_ memory than character vectors. > >> object.size(sample(c("a","b"), 1000, replace=TRUE)) > 4088 bytes >> object.size(factor(sample(c("a","b"), 1000, replace=TRUE))) > 4296 bytes I think this is just bec

Re: [R] R Memory Usage Concerns

2009-09-14 Thread Evan Klitzke
On Mon, Sep 14, 2009 at 8:35 PM, jim holtman wrote: > When you read your file into R, show the structure of the object: ... Here's the data I get: > tab <- read.table("~/20090708.tab") > str(tab) 'data.frame': 1797601 obs. of 3 variables: $ V1: Factor w/ 6 levels "biz_details",..: 4 4 4 4 4

Re: [R] R Memory Usage Concerns

2009-09-14 Thread Eduardo Leoni
And, by the way, factors take up _more_ memory than character vectors. > object.size(sample(c("a","b"), 1000, replace=TRUE)) 4088 bytes > object.size(factor(sample(c("a","b"), 1000, replace=TRUE))) 4296 bytes On Mon, Sep 14, 2009 at 11:35 PM, jim holtman wrote: > When you read your file into R,

[R] X-axis range

2009-09-14 Thread Chris Li
Hi all, I would like to change the x-axis of my graphs from year 1998 to 2008 with an interval of 5 (i.e. 1998, 2003, 2008). Any help would be greatly appreciated. http://www.nabble.com/file/p25447219/model_hydrographs.txt model_hydrographs.txt http://www.nabble.com/file/p25447219/bore_sample.t

Re: [R] R Memory Usage Concerns

2009-09-14 Thread jim holtman
When you read your file into R, show the structure of the object: str(tab) also the size of the object: object.size(tab) This will tell you what your data looks like and the size taken in R. Also in read.table, use colClasses to define what the format of the data is; may make it faster. You mi

[R] chinese character support issue of rcom

2009-09-14 Thread Michael
Dear Sir, rcom is a great package of R. Yet it seems that there is some problem of Chinese character supporting. comGetPropery() always get the part of the Chinese character. Any suggestion would be appreciated. Thanks. Michael > library(rcom) Loading required package: rscproxy > txe<-comCrea

[R] Multivariate Meta-analysis

2009-09-14 Thread Yan Li
Hi, all I happen to a question about multivariate meta-analysis. I found the function of mvmeta in gap package, but I don't know for sure how to construct a covariance matrix. Now, I have 20 studies, each having 6 coefficients for the basis functions from an additive model. I can extract the covar

[R] R Memory Usage Concerns

2009-09-14 Thread Evan Klitzke
Hello all, To start with, these measurements are on Linux with R 2.9.2 (64-bit build) and Python 2.6 (also 64-bit). I've been investigating R for some log file analysis that I've been doing. I'm coming at this from the angle of a programmer whose primarily worked in Python. As I've been playing a

Re: [R] syntax of formula

2009-09-14 Thread Greg Snow
Section 11.1 and 11.4 of "An Introduction to R" gives a pretty thorough start for aov models (does not get into mixed/survival and others). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r

Re: [R] syntax of formula

2009-09-14 Thread Bill.Venables
In a sense, the syntax is easy. Both left and right hand sides must be valid R expressions. What you are probably looking for is a complete description of the semantics. That's quite a different issue. The meaning of terms in a formula, and even the allowable forms, vary from function to func

[R] syntax of formula

2009-09-14 Thread Peng Yu
Hi, I am looking for a complete description of the syntax of the formula that shall be specified in, for example, aov. But I can't find a complete description. Can somebody point to me if there is such a resource? Regards, Peng __ R-help@r-project.org

Re: [R] Header names when importing csv/excel data sets

2009-09-14 Thread Gabor Grothendieck
See the check.names= argument to read.table. On Mon, Sep 14, 2009 at 9:40 PM, Steven Kang wrote: > Dear R users, > > > Suppose the csv file contains header names such as *"Nike, dunk"*, *"Converse, > All stars"* etc > > When imported to R (with header = T option), the column names are given by: >

[R] Header names when importing csv/excel data sets

2009-09-14 Thread Steven Kang
Dear R users, Suppose the csv file contains header names such as *"Nike, dunk"*, *"Converse, All stars"* etc When imported to R (with header = T option), the column names are given by: *"Nike..dunk"* *"Converse..All.stars"* I have tried the following command to convert these c

Re: [R] What are the return values of aov?

2009-09-14 Thread Peng Yu
You understand what I meant. I should say it more clearly in my original post. Regards, Peng On Mon, Sep 14, 2009 at 7:30 PM, Greg Snow wrote: > I think Penkyu is not asking for the statistical definitions, but rather some > help for what the different parts of the object are.  Elements like >

Re: [R] how to determine if a variable is already set?

2009-09-14 Thread Henrik Bengtsson
Not the most beautiful solution: start your message with carriage return, e.g. > stop("\rA long enough message"); A long enough message > stop("\rfoo"); fooor: /H On Mon, Sep 14, 2009 at 5:06 PM, Bert Gunter wrote: > I don't believe the solution proposed below works and anyway misses the > whol

Re: [R] symbols(x,y, circles=sqrt(N)) with lattice xyplot

2009-09-14 Thread Greg Snow
The symbols function is base graphics which does not play nicely with lattice graphics (without extra work). Here is one approximation that works with lattice: x <- runif(10) y <- rnorm(10) z <- runif(10, 1,5) library(lattice) library(TeachingDemos) # for panel.my.symbols and friends xyplot( y

Re: [R] What are the return values of aov?

2009-09-14 Thread Greg Snow
I think Penkyu is not asking for the statistical definitions, but rather some help for what the different parts of the object are. Elements like coefficients and residuals seem fairly obvious (but could still be somewhat ambiguous, are the residuals raw/standardized/studentized/etc.). Objects

Re: [R] how to determine if a variable is already set?

2009-09-14 Thread Bert Gunter
I don't believe the solution proposed below works and anyway misses the whole point of tryCatch(), which is **not** to test manually: f <- function(i){ val <- tryCatch(get("i"), error = function(e)"input error") val ## can test val and carry on if not an error } ## testit > f() [1] "input erro

Re: [R] R^2 for poisson and zero inflated regressions

2009-09-14 Thread Rolf Turner
On 15/09/2009, at 9:11 AM, Maria Sagot wrote: Dear all, I'm performing poisson regressions using the glm(family=poisson) and zero-inflated regressions using the zeroinfl from the package pscl. However any of those give an R^2 and I was wondering if there is a way to get it. R^2 is meaning

Re: [R] using filter while Reading files -

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 6:25 PM, Santosh wrote: Dear R'sians.. I apologize if this topic has been beaten to death and hope that hawks don't pounce on me! Could you please suggest an efficient way to filter rows from 500+ text files (some with 3+ rows with multiple section table headers)

[R] R^2 for poisson and zero inflated regressions

2009-09-14 Thread Maria Sagot
Dear all, I'm performing poisson regressions using the glm(family=poisson) and zero-inflated regressions using the zeroinfl from the package pscl. However any of those give an R^2 and I was wondering if there is a way to get it. Thanks -- Maria Sagot Graduate Student 107 Life Sciences Building

Re: [R] 64-bit binary for Windows

2009-09-14 Thread Duncan Murdoch
On 14/09/2009 6:53 PM, Henrique Dallazuanna wrote: From the instalation instructions in CRAN: " R 2.9.2 for Windows === This distribution contains a binary distribution of R-2.9.2 to run on Windows 2000 and later (including 64-bit versions of Windows) on ix86 and x86_64 chips.

[R] symbols(x,y, circles=sqrt(N)) with lattice xyplot

2009-09-14 Thread Jacob Wegelin
How would I create the following plot using lattice? symbols( combPsummary$pastRate, combPsummary$finRate, circles=sqrt(combPsummary$N) ) The idea is to plot finRate vs pastRate using circles whose areas are proportional to the number of people in each group. The following attempt does not reall

Re: [R] 64-bit binary for Windows

2009-09-14 Thread Henrique Dallazuanna
>From the instalation instructions in CRAN: " R 2.9.2 for Windows === This distribution contains a binary distribution of R-2.9.2 to run on Windows 2000 and later (including 64-bit versions of Windows) on ix86 and x86_64 chips. It is designed to be as close as possible to the im

[R] 64-bit binary for Windows

2009-09-14 Thread Debabrata Midya
Dear R Users, Thanks in advance. I am currently using R-2.9.1-win32.exe on Windows XP. Is there any 64 bit binary on Windows XP? Once again, thank you very much for the time you have given. Regards, Deb ** T

Re: [R] Plea: No long unbroken lines, please!

2009-09-14 Thread Ted Harding
On 14-Sep-09 22:30:12, Duncan Murdoch wrote: > On 14/09/2009 4:32 PM, Liviu Andronic wrote: >> Hello >> >> On 9/14/09, Ted Harding wrote: >>> This has been sent by software which inserted no line-breaks. >>> As a result, each paragraph is viewed (by my browser, Firefox) >>> as one very long li

Re: [R] How to refer to the last a few rows?

2009-09-14 Thread Giovanni Petris
> Date: Mon, 14 Sep 2009 10:32:09 -0500 > From: Peng Yu > > Hi, > > x=matrix(1:60,nr=6) > > I can refer the last 2 rows by > x[5:6,] > > If I don't know the total number of rows is 6, is there a way to refer But R does known the total number of rows: it's NROW(x) -- or nrow(x) if you are sur

Re: [R] Plea: No long unbroken lines, please!

2009-09-14 Thread Duncan Murdoch
On 14/09/2009 4:32 PM, Liviu Andronic wrote: Hello On 9/14/09, Ted Harding wrote: This has been sent by software which inserted no line-breaks. As a result, each paragraph is viewed (by my browser, Firefox) as one very long line, not wrapped. In particular, the third Slightly off-topic, b

[R] using filter while Reading files -

2009-09-14 Thread Santosh
Dear R'sians.. I apologize if this topic has been beaten to death and hope that hawks don't pounce on me! Could you please suggest an efficient way to filter rows from 500+ text files (some with 3+ rows with multiple section table headers) residing in several folders? I guess probably "scan"

Re: [R] What are the return values of aov?

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 5:29 PM, Peng Yu wrote: Hi, I get the following variables. Instead of guessing what they mean, is there a centralized location in R help() that describes their meaning and usage? names(afit) [1] "coefficients" "residuals" "effects" "rank" [5] "fitted.values" "

[R] Marginal effects after probit

2009-09-14 Thread Aleksandr Andreev
Does anyone know if there is a function in R that will compute marginal effects after a probit or logit model, much like STATA's command mfx? Thanks, Aleks Aleksandr Andreev Graduate Student - Department of Economics University of North Carolina at Chapel Hill Mobile: +1

Re: [R] problems with reshape

2009-09-14 Thread Kevin Wright
You might have a look at the reshape __package__, which I generally find easier to use than the reshape function. Kevin Wright On Mon, Sep 14, 2009 at 9:41 AM, Luca Braglia wrote: > Hello * > > I would like to reshape wide the following dataset: > > > > rl <- read.dta("intermedi/rapporti_lavor

Re: [R] Help with for loop

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 5:14 PM, wrote: thank you all for your help. I do know how to use which() but my problem is that I am writing a function in which this is just part of it. After seeing the (a-b)[bfor which is negative and which is positive. Can you explain what you mean? There are

Re: [R] What are the return values of aov?

2009-09-14 Thread Peng Yu
Hi, I get the following variables. Instead of guessing what they mean, is there a centralized location in R help() that describes their meaning and usage? > names(afit) [1] "coefficients" "residuals" "effects" "rank" [5] "fitted.values" "assign""qr""df.residual"

Re: [R] Help with for loop

2009-09-14 Thread Jorge Ivan Velez
Hi Edward, In your post, rather than asking for the indexes, you asked for the numbers, AFAICS. Now, whether you want the indexes in which (b-a) is either positive or negative, then do which(b-a>0) # Positives # [1] 2 3 6 7 which(b-a<0) # Negatives # [1] 1 4 5 (a-b)[b wrote: > than

Re: [R] Is there an equivalent of "echo"

2009-09-14 Thread Greg Snow
The cat() function has already been pointed out to you (and that may be enough), but for a little more elaborate alternative, see the txtStart and txtComment functions in the TeachingDemos package for a glorified wrapper to sink/cat/etc. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center

[R] fastest OLS w/ NA's and need for SE's

2009-09-14 Thread ivo welch
dear R wizards: apologies for two queries in one day. I have a long form data set, which identifies about 5,000 regressions, each with about 1,000 observations. unit date y x 120060101 120060102 ... 5000 20081230 5000 20081231 I need to run such regressions many many times

Re: [R] Help with for loop

2009-09-14 Thread edchen51
thank you all for your help. I do know how to use which() but my problem is that I am writing a function in which this is just part of it. After seeing the (a-b)[b wrote: On Sep 14, 2009, at 3:02 PM, Jorge Ivan Velez wrote: Hi Edward, Here is a suggestion: a = c(4,5,1,7,8,12,39) b =

Re: [R] Is there an equivalent of "echo"

2009-09-14 Thread Steve Lianoglou
Hi, On Sep 14, 2009, at 5:10 PM, Polwart Calum (County Durham and Darlington NHS Foundation Trust) wrote: Sorry I'm having one of those moments where I can't find the answer but I bet its obvious... I'm outputting my results to a file using sink() Is there a command simillar to php's ech

[R] Is there an equivalent of "echo"

2009-09-14 Thread Polwart Calum (County Durham and Darlington NHS Foundation Trust)
Sorry I'm having one of those moments where I can't find the answer but I bet its obvious... I'm outputting my results to a file using sink() Is there a command simillar to php's echo command that would allow me to add some text to that file ie: dataFr$a = 1:10 dataFr$b = 2*1:10 sink ("filepat

Re: [R] Mantel test

2009-09-14 Thread Tal Galili
Hi swertie , Could you please add more details ? What field are you at, some links maybe ? Thanks, Tal On Mon, Sep 14, 2009 at 8:30 PM, swertie wrote: > > Hello! It is not really linked to R, but can somebody explain me why we > sometimes make a mantel test directly for to distance matrices

Re: [R] What are the return values of aov?

2009-09-14 Thread Tal Galili
Hi Peng , I am not sure I understood your question. Are you asking what the "ss" and "p values" and so on mean ? Tal On Mon, Sep 14, 2009 at 11:58 PM, Peng Yu wrote: > Hi, > > I don't quite understand what are the return values of aov. I know > that it has 'coefficients'. But I need to k

[R] How can I use foreach with snow, to allow multicore on windows XP ?

2009-09-14 Thread Tal Galili
could you please give an example on how that might be done using the doSNOW ? (I asked the same question here: http://blog.revolution-computing.com/2009/08/parallel-programming-with-foreach-and-snow.html And got only a partial reply) Can any one share some experience in doing this ? Thanks! Ta

[R] What are the return values of aov?

2009-09-14 Thread Peng Yu
Hi, I don't quite understand what are the return values of aov. I know that it has 'coefficients'. But I need to know what all the other return values are. Can somebody let me know how to figure them? Value: An object of class 'c("aov", "lm")' or for multiple responses of class 'c("mao

Re: [R] How can I get "predict.lm" results with manual calculations ? (a floating point problem)

2009-09-14 Thread Tal Galili
Hi Tony, It appears you (and David) where right, and my own problem came from another issue which wasn't the floating point. (the problem was misspelling of the colname of the data.frame I used as the newdata in the predict.lm) Yet I am still happy with my posting, only to get your informed reply

Re: [R] Eliminate cases in a subset of a dataframe

2009-09-14 Thread Hollix
Hi Guys, thank you all for you comments. Actually, I had a typo and you'r right that it should be "subdata[-c(11,22,33) , ]" However, this does not work well either. I think, I know the reason: In the diagnostic diagramm (that you get with plot(linreg) ), the number which are assigned to the mo

Re: [R] Which "apply" function to use?

2009-09-14 Thread Masca, N.
Excellent - the "as.data.frame" trick was just what I needed! Many thanks, Nick From: baptiste auguie [baptiste.aug...@googlemail.com] Sent: 14 September 2009 17:48 To: Masca, N. Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Which "apply" function to use?

Re: [R] dates with lattice graphics

2009-09-14 Thread Gabor Grothendieck
See last line to every message on r-help which in particular asks for reproducible code and in this case means include date and count. Note ?dput This work for me: library(lattice) tt <- as.POSIXct(Sys.Date() + 1:10) y <- seq_along(tt) xyplot(y ~ tt) as does this: library(zoo) xyplot(zoo(cbind

Re: [R] loading a package .Rda file at package load time

2009-09-14 Thread Rajarshi Guha
Thanks for the pointer. I should have looked at variable values first! It appears that libname contains the path to the library and then loading the rda file is just a matter of constructing the path properly On Mon, Sep 14, 2009 at 3:28 PM, cls59 wrote: > > > > Hi, I have seen the answer to th

[R] Legends dissapearing from scatterplot (car package) when using logarithmic axis

2009-09-14 Thread Helmer Belbo
Dear R-people I am struggling with disappearing legend box when using logarithmic axis in scatterplot. Sample code: ### library(car) #constructing data set x=rep(1:50, 2); ClassDummy=rep(1:2, each=50) ; y=5+ClassDummy+(rnorm(100,mean=(50/x),sd=(10/x))) mydata <- data.frame (cbind('x'

[R] dates with lattice graphics

2009-09-14 Thread Larry White
Hi, I'm trying to do something simple (I think) with lattice graphics. I want to have three xyplots in a single column, where the x axis for the three is a date range and the y axes are numeric. I tried doing the first chart, and ran into a problem. When I enter: xyplot (date ~ count) I get a

Re: [R] Strange question/result about SVM

2009-09-14 Thread Steve Lianoglou
(Although I must admit that the current thread about SVMs leaves me --- personally --- cold. I think that SVMs are a load of dingos' kidneys. So, you're saying that you find them so essential that life w/o them is practically impossible ... unless we have dingo dialysi

Re: [R] Plea: No long unbroken lines, please!

2009-09-14 Thread Liviu Andronic
Hello On 9/14/09, Ted Harding wrote: > This has been sent by software which inserted no line-breaks. > As a result, each paragraph is viewed (by my browser, Firefox) > as one very long line, not wrapped. In particular, the third > Slightly off-topic, but in such cases one solution would be to

Re: [R] Plea: No long unbroken lines, please!

2009-09-14 Thread Rolf Turner
On 15/09/2009, at 7:42 AM, Ted Harding wrote: Hi Folks, I don't often grumble, Well Ted, that's just a flaw in your character! I guess you can't help it! :-) cheers, Rolf ## Attentio

Re: [R] average for files and graph

2009-09-14 Thread Steve Lianoglou
Hi, On Sep 14, 2009, at 2:34 PM, kylle345 wrote: Hi, I have 5 different files. Each file has about 1000 columns and about 3000 rows. Basically what I want to do is take the average of the 1000 columns and then graph it (line graph). How would I do this for 5 files at the same time a

Re: [R] Strange question/result about SVM

2009-09-14 Thread Rolf Turner
On 15/09/2009, at 6:14 AM, Noah Silverman wrote: Ravi, If you don't like my questions, simply don't answer them. My sediments exactly! :-) The R-help forum frequently digresses into issues that are not fundamentally R-related. Subscribers can participate in

Re: [R] Best way to extract values from an aov object ?

2009-09-14 Thread Henrique Dallazuanna
Try this: sapply(sapply(summary(bgaov), '[[', 1), '[[', 'Mean Sq') On Mon, Sep 14, 2009 at 4:45 PM, Paul wrote: > I'm trying to write a function to automate doing a variance analysis, part > of which involves doing some further calculations. The method I've been > using isn't very robust, if va

[R] Best way to extract values from an aov object ?

2009-09-14 Thread Paul
I'm trying to write a function to automate doing a variance analysis, part of which involves doing some further calculations. The method I've been using isn't very robust, if variable names change then it stops working. For this dummy data > dput(assayvar,"") structure(list(Run = structure(c(

Re: [R] how to determine if a variable is already set?

2009-09-14 Thread Henrique Dallazuanna
Try this: if (!exists("i")) tryCatch(stop(""), error = function(e)invisible(), finally=print("Please set the i variable")) On Mon, Sep 14, 2009 at 3:38 PM, carol white wrote: > Thanks to your replies. > > In fact, the problem doesn't come from "exists" but from "stop" t

[R] Plea: No long unbroken lines, please!

2009-09-14 Thread Ted Harding
Hi Folks, I don't often grumble, but this time I've found myself inconvenienced by a posting stored on R-help archives: https://stat.ethz.ch/pipermail/r-help/2009-September/211095.html This was Karin Groothuis-Oudshoorn & Stef van Buuren's message on 10 September about the new version of MICE. T

Re: [R] average for files and graph

2009-09-14 Thread Erik Iverson
It would be even greater if you could get us started with some commented, minimal, self-contained, reproducible code. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of kylle345 Sent: Monday, September 14, 2009 1:35 PM To: r-help@r-pr

Re: [R] Escaping . in regular expression

2009-09-14 Thread Prof. John C Nash
Thanks. That fixes things. I saw mention of \\. in ?Quotes, but the usage was not clear. I took it to mean the \ was to be printed. Maybe my little example would help, as ?Quotes doesn't have any. JN Henrique Dallazuanna wrote: You need double backslashes: grep('\\.f', cvec, value = TRUE)

Re: [R] Escaping . in regular expression

2009-09-14 Thread Duncan Murdoch
On 9/14/2009 3:25 PM, Prof. John C Nash wrote: If I run cvec<-c("test.f", "test.sf", "try.g","try.res", "try.f") print(cvec) indx<-grep('\.f',cvec,perl=TRUE) fset<-cvec[indx] print(fset) I get > cvec<-c("test.f", "test.sf", "try.g","try.res", "try.f") > print(cvec) [1] "test.f" "test.sf" "

Re: [R] Merge data frames but prefer values in on

2009-09-14 Thread Nandi
No you cannot. You may want to write a merge function with the special capability but there is no better way than the one suggested by Henrique. On Sep 14, 12:18 pm, JiHO wrote: > On 2009-September-11  , at 13:55 ,  wrote: > > > Maybe: > > > do.call(rbind, lapply(with(xy <- rbind(x, y), split(xy,

[R] ggplot, ribbon not showing up properly

2009-09-14 Thread Sock Cheng
Hi, I'm trying to plot a longitudinal data set, using ggplot and adding some summary info (eg. mean, 1 sd bounds) using geom=ribbon. The summary info is based on a subset of the original data (eg. less an outlier). But I'm having trouble getting the ribbons to show up correctly. It's probably s

Re: [R] Help with for loop

2009-09-14 Thread Henrique Dallazuanna
Or: (a - b)[b < a] On Mon, Sep 14, 2009 at 4:16 PM, David Winsemius wrote: > > On Sep 14, 2009, at 3:02 PM, Jorge Ivan Velez wrote: > > Hi Edward, >> Here is a suggestion: >> >> a = c(4,5,1,7,8,12,39) >> b = c(3,7,8,4,7,25,78) >> d <- a-b >> d[which(d>0)] >> # [1] 1 3 1 >> > > #Or even: > d <-

[R] average for files and graph

2009-09-14 Thread kylle345
Hi, I have 5 different files. Each file has about 1000 columns and about 3000 rows. Basically what I want to do is take the average of the 1000 columns and then graph it (line graph). How would I do this for 5 files at the same time and plot the average of the 5 files into one graph. it would

[R] Mantel test

2009-09-14 Thread swertie
Hello! It is not really linked to R, but can somebody explain me why we sometimes make a mantel test directly for to distance matrices and sometimes we first make a gradient analysis and then a mantel test between the axis? Thank you -- View this message in context: http://www.nabble.com/Mantel-

Re: [R] Escaping . in regular expression

2009-09-14 Thread Henrique Dallazuanna
You need double backslashes: grep('\\.f', cvec, value = TRUE) On Mon, Sep 14, 2009 at 4:25 PM, Prof. John C Nash wrote: > If I run > > > cvec<-c("test.f", "test.sf", "try.g","try.res", "try.f") > print(cvec) > indx<-grep('\.f',cvec,perl=TRUE) > fset<-cvec[indx] > print(fset) > > I get > > > cvec

Re: [R] loading a package .Rda file at package load time

2009-09-14 Thread cls59
Hi, I have seen the answer to this sometime before but I just can't find it again - pointers appreciated. I have a package that contains some data.frames saved as .Rda files in the data/ directory. When the package is loaded I would like to have them be available in the workspace (without the u

[R] Escaping . in regular expression

2009-09-14 Thread Prof. John C Nash
If I run cvec<-c("test.f", "test.sf", "try.g","try.res", "try.f") print(cvec) indx<-grep('\.f',cvec,perl=TRUE) fset<-cvec[indx] print(fset) I get > cvec<-c("test.f", "test.sf", "try.g","try.res", "try.f") > print(cvec) [1] "test.f" "test.sf" "try.g" "try.res" "try.f" > indx<-grep("\.f",cvec

Re: [R] Help with for loop

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 3:02 PM, Jorge Ivan Velez wrote: Hi Edward, Here is a suggestion: a = c(4,5,1,7,8,12,39) b = c(3,7,8,4,7,25,78) d <- a-b d[which(d>0)] # [1] 1 3 1 #Or even: d <- (a-b)[which((a-b)>0)] d #[1] 1 3 1 HTH, Jorge On Mon, Sep 14, 2009 at 2:50 PM, Edward Chen wrote:

Re: [R] How to convert numbers to words?

2009-09-14 Thread Ken Knoblauch
Derek Norton gmail.com> writes: > I am trying to convert numbers to English words, e.g. 123 -> One > hundred twenty three. After some searching, I have been unable to > find any info on this. I could certainly write code to do it, but my > question is this: Does anyone know of a function that

Re: [R] How to convert numbers to words?

2009-09-14 Thread johannes rara
See this post from the past (by John Fox): http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46843.html -Johannes 2009/9/14 Derek Norton > I am trying to convert numbers to English words, e.g. 123 -> One > hundred twenty three. After some searching, I have been unable to > find any info on this.

Re: [R] How to convert numbers to words?

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 2:11 PM, Derek Norton wrote: I am trying to convert numbers to English words, e.g. 123 -> One hundred twenty three. After some searching, I have been unable to find any info on this. I could certainly write code to do it, but my question is this: Does anyone know of a func

[R] invalid type (list) for variable

2009-09-14 Thread Jen Maresh
Hello - I am attempting to add interaction terms to a model using the gamm function in the mgcv package. I stripped it down to only two terms to simplify it. I have no trouble with individual terms, continuous or factors, nor with interacting factor terms; I cannot, however, figure out how to add

Re: [R] Help with for loop

2009-09-14 Thread Jorge Ivan Velez
Hi Edward, Here is a suggestion: a = c(4,5,1,7,8,12,39) b = c(3,7,8,4,7,25,78) d <- a-b d[which(d>0)] # [1] 1 3 1 HTH, Jorge On Mon, Sep 14, 2009 at 2:50 PM, Edward Chen wrote: > I have a code: > *a = c(4,5,1,7,8,12,39) > b = c(3,7,8,4,7,25,78) > d =a-b > for(i in 1:length(d)){ > if(d[i]>0){x

Re: [R] Location of Packages?

2009-09-14 Thread cls59
iaw4 wrote: > > Sorry, one more: on OSX, I deleted my old 2.9.2 R.app, and installed the > 64 > bit version of 2.9.0. I then did an "install.packages("car")" under my > new > 2.9.0. It seems to have worked, but alas, I still get an error that > package > 'car' was built under R version 2.9.2

Re: [R] Help with for loop

2009-09-14 Thread Erik Iverson
It is difficult to know what you're trying to do here, I think. Is this it? You almost surely don't need a for loop to accomplish your task, and should make use of the pre-existing vectorized functions provided to you. a <- c(4, 5, 1, 7, 8, 12, 39) b <- c(3, 7, 8, 4, 7, 25, 78) d <- a - b whi

Re: [R] How to refer to the last a few rows?

2009-09-14 Thread Bert Gunter
?nrow Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Federman, Douglas Sent: Monday, September 14, 2009 9:03 AM To: Peng Yu; r-h...@stat.math.ethz.ch Subject: Re: [R] How to refer to

[R] Help with for loop

2009-09-14 Thread Edward Chen
I have a code: *a = c(4,5,1,7,8,12,39) b = c(3,7,8,4,7,25,78) d =a-b for(i in 1:length(d)){ if(d[i]>0){x = list(d[i]) print(x)} else{y = list(d[i]) print(y)}} the results are: [[1]] [1] 1 [[1]] [1] -2 [[1]] [1] -7 [[1]] [1] 3 [[1]] [1] 1 [[1]] [1] -13 [[1]] [1] -39 which will tell me what

Re: [R] how to determine if a variable is already set?

2009-09-14 Thread carol white
Thanks to your replies. In fact, the problem doesn't come from "exists" but from "stop" that displays Error even if call. = FALSE. To answer to Dan, I quoted the pramater of exists. So when the variable is not defined, stop displays the expression message preceded by "Error". So the question w

[R] How to extract partial predictions, package mgcv

2009-09-14 Thread Staffan Roos
Dear package mgcv users, I am using package mgcv to describe presence of a migratory bird species as a function of several variables, including year, day number (i.e. day-of-the-year), duration of survey, latitude and longitude. Thus, the "global model" is: global_model<-gam(present ~ as

Re: [R] Location of Packages?

2009-09-14 Thread David Winsemius
On Sep 14, 2009, at 2:00 PM, ivo welch wrote: thanks, everyone. I was a bit confused. I now think that the "car" error was because the package on the cran website itself was built under 2.9.2, not because I had an old version lying around, which my package continued to use instead of a ne

[R] using lm with nested factor results in NA's

2009-09-14 Thread Timothy Clough
Dear All, I am attempting to perform an ANOVA with three factors: feature (3 levels), group (5 levels), and patient (246 levels), where patient is nested within group. I am using the following command: fit <- lm(intensity ~ feature + group + feature:group + group/patient, data = new)

Re: [R] ggplot2 legend text....a basic question

2009-09-14 Thread Charlotte Wickham
> a) How to change the text  in the legend (for example, "number" instead of > "n"). Use: scale_size("number") > b) How to avoid having a  legend for the polygon? Don't include the value for alpha inside aes (you want to set it as opposed to mapping it). So, ggplot(mydata, aes(x, y)) + geom_poi

Re: [R] Strange question/result about SVM

2009-09-14 Thread Noah Silverman
Ravi, If you don't like my questions, simply don't answer them. -- N On 9/14/09 10:12 AM, Ravi Varadhan wrote: Noah, It may be just me - but how does "any" of your questions on prediction modeling relate to R? It seems to me that you have been getting a lot of "free" consulting from this for

[R] highlighting constants

2009-09-14 Thread darkhorn
Hi, a developer asked me something (we were talking about a issue in R highlighting) Here it is: "P.S.: Shouldn't constants like TRUE, FALSE, Inf, NaN, NA ... be marked up too?" Like in: # iNA <- as.integer(NA) # !is.na(Inf) & !is.nan(Inf) & is.infinite(Inf) & !is.finite(Inf) # !is.na(-Inf)& !

[R] How to convert numbers to words?

2009-09-14 Thread Derek Norton
I am trying to convert numbers to English words, e.g. 123 -> One hundred twenty three. After some searching, I have been unable to find any info on this. I could certainly write code to do it, but my question is this: Does anyone know of a function that does this? Thanks, Derek McCrae Norton __

[R] Cann't assign NULL to a vector

2009-09-14 Thread snow
Due to over-sized matrix from combn(letters,13), I tried to only output one selection which is satisfied with the criteria in if clause. This is how my code looks like and the ERROR message shows:      > li<-combn(letters,13,function(x)(if(apply(( (as.matrix(t(letters%in% x))) %*% > as.matrix(z)

  1   2   3   >