Re: [R] [Rcpp-devel] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Christian Gunning
On Thu, Apr 14, 2011 at 7:02 PM, wrote: > I was able to write a very short C++ function using the Rcpp package > that provided about a 1000-fold increase in speed relative to the best > I could do in R.  I don't have the script on this computer so I will > post it tomorrow when I am back on the c

Re: [R] simulations with very large number of iterations (1 billion)

2011-04-14 Thread Brian J Mingus
On Thu, Apr 14, 2011 at 7:41 PM, Marion Dumas wrote: > Hello R-help list > I'm trying to run 1 billion iterations of a code with calls to random > distributions to implement a data generating process and subsequent > computation of various estimators that are recorded for further comparison > of

[R] How to generate a correlation matrix with restrictions on its eigenvalues

2011-04-14 Thread Chee Chen
Dear All, I would like to generate m positive real numbers c_i, I=1,...,m, such that (1) c_1 + c_2 + ... + c_m=m, (1) after being ordered into c_1 >= c_2 >= >=c_m>0, we have that c_m is of the same order of m^(-1/8), when m is sufficiently large. Thanks, -Chee [[alternative HTML

Re: [R] mixed model random interaction term log likelihood ratio test

2011-04-14 Thread seatales
1. The three levels of the vector DrugPair actually represent three genotypes, which are some randomly chosen genotypes from a population of many genotypes. That's why I thought it was justified as random effect. Does estimating them as random make sense then? 2. Also could you please elaborate o

Re: [R] Categorical bubble plot

2011-04-14 Thread Michael bibo
Jurgens de Bruin gmail.com> writes: > > Hi, > > I do not have much R experience just the basics, so please excuse > any obvious questions. > > I would like to create bubble plot that have Categorical data on the x and y > axis and then the diameter if the bubble the value related to x and y. >

[R] simulations with very large number of iterations (1 billion)

2011-04-14 Thread Marion Dumas
Hello R-help list I'm trying to run 1 billion iterations of a code with calls to random distributions to implement a data generating process and subsequent computation of various estimators that are recorded for further comparison of performance. I have two question about how to achieve th

Re: [R] Sweave and Slides (Beamer)

2011-04-14 Thread Liviu Andronic
Hello I sympathise with you, since Beamer can quickly drive one mad. On Fri, Apr 15, 2011 at 3:11 AM, Brett Presnell wrote: > So, is this useful to anyone besides me?  What trick(s) am I missing > that would make it easier/better, or that would obviate altogether the > need for such manipulation

Re: [R] Categorical bubble plot

2011-04-14 Thread Jurgens de Bruin
Thanks for the reply... with reproducible I am believe you require a dataset? The size of the bubbles will be related to the fitvalues. On 14 April 2011 17:57, Ben Bolker wrote: > Jurgens de Bruin gmail.com> writes: > > > > > Hi, > > > > I do not have much R experience just the basics, so p

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Ray Brownrigg
Ravi: Well, that's a challenge! Here is a solution which is faster than Bill's as long as length(y) << length(x). f3 <- function(x, y) length(y)*ecdf(y)(x) Then using your test on my workstation, I get for f2(): > tt [1] 0.761 1.071 1.329 1.565 1.894 3.865 11.824 and for f3(): > tt [1]

[R] RODBC with MySQL sees tables, but queries return zero rows

2011-04-14 Thread Daniel Weitzenfeld
Hi All, I'm using RODBC to tap into MySQL on a remote server. It appears like the connection is successful: I can see all tables and columns in my database. However, queries return zero lines, including queries I've verified as functional and non-empty by entering them directly in MySQL. I gran

Re: [R] Is there a better way to parse strings than this?

2011-04-14 Thread Whit Armstrong
not everything has to be done in R. awk and sed are some of the best tools on a linux/unix box. quick refs: http://www.pement.org/awk/awk1line.txt http://sed.sourceforge.net/sed1line.txt -Whit On Wed, Apr 13, 2011 at 12:07 AM, Chris Howden wrote: > Hi Everyone, > > > I needed to parse some st

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Douglas Bates
On Thu, Apr 14, 2011 at 8:19 PM, Ravi Varadhan wrote: > Bill's code is insanely fast! > > f2 <- function(x, y) length(y) - findInterval(-x, rev(-sort(y))) > >  n1 <- 1e07 > n2 <- 10^c(1,2,3,4,5,6,7) > tt <- rep(NA, 7) > x <- rnorm(n1) > for (i in 1:length(n2)){ > y <- runif(n2[i]) > tt[i] <- syste

Re: [R] Is there a better way to parse strings than this?

2011-04-14 Thread Gabor Grothendieck
On Thu, Apr 14, 2011 at 8:28 PM, Chris Howden wrote: > Thanks for the suggestions, they were all exactly what I was looking for. > (I knew that had to be a more elegant way then my brute force method) > > One question though. > > I was playing around with strsplit but couldn't get it to work, I re

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Ravi Varadhan
Bill's code is insanely fast! f2 <- function(x, y) length(y) - findInterval(-x, rev(-sort(y))) n1 <- 1e07 n2 <- 10^c(1,2,3,4,5,6,7) tt <- rep(NA, 7) x <- rnorm(n1) for (i in 1:length(n2)){ y <- runif(n2[i]) tt[i] <- system.time(a1 <- f2(x, y))[3] } > tt [1] 0.70 0.86 1.03 1.28 1.54 4.99

[R] Sweave and Slides (Beamer)

2011-04-14 Thread Brett Presnell
I'm posting this for two reasons: one is to see if anyone has a better way of solving the problem or suggestions for improving my existing approach; and the other is to show what I'm currently doing in case anyone else might find it useful. The background is that I've been using Sweave for severa

Re: [R] mixed model random interaction term log likelihood ratio test

2011-04-14 Thread Ben Bolker
seatales uh.edu> writes: > > Hello, > I am using the following model > > model1=lmer(PairFrequency~MatingPair+(1|DrugPair)+(1|DrugPair:MatingPair), > data=MateChoice, REML=F) > > 1. After reading around through the R help, I have learned that the above > code is the right way to analyze a mi

Re: [R] Is there a better way to parse strings than this?

2011-04-14 Thread Hadley Wickham
> I was trying strsplit(string,"\.\.\.") as per the suggestion in Venables > and Ripleys book to "(use '\.' to match '.')", which is in the Regular > expressions section. > > I noticed that in the suggestions sent to me people used: > strsplit(test,"\\.\\.\\.") > > > Could anyone please explain why

Re: [R] Trojan in R 2.13.0?

2011-04-14 Thread Wincent
Also fine with Kaspersky. Ronggui On 15 April 2011 05:37, David Freedman wrote: > 2.13.0 looks fine with VIPRE > > david freedman > atlanta > > -- > View this message in context: > http://r.789695.n4.nabble.com/Trojan-in-R-2-13-0-tp3450084p3450784.html > Sent from the R help mailing list archiv

Re: [R] Is there a better way to parse strings than this?

2011-04-14 Thread Chris Howden
Thanks for the suggestions, they were all exactly what I was looking for. (I knew that had to be a more elegant way then my brute force method) One question though. I was playing around with strsplit but couldn't get it to work, I realised my problem was that I was using "." as the string. I was

[R] nesting multiple for loops

2011-04-14 Thread Ben Hunter
Hi everyone. I am quite frustrated that this doesn't work, as all the functions within work fine by themselves. I'd also like any pointers to how to avoid 'for' loops in my code. I understand it's less than desirable, but I'm still quite new and use them a lot. I have a few wide datasets (90 to 1

Re: [R] Statistical Tables Really Fast

2011-04-14 Thread Dirk Eddelbuettel
On 14 April 2011 at 19:02, Robert Wilkins wrote: | a new language that can produce complex statistical tables far faster, | with much less code and effort, than any previous statistical | programming language. | | a version that outsources ( gives work to do ) to vilno data | transformation and R

[R] Statistical Tables Really Fast

2011-04-14 Thread Robert Wilkins
a new language that can produce complex statistical tables far faster, with much less code and effort, than any previous statistical programming language. a version that outsources ( gives work to do ) to vilno data transformation and R is already in beta mode, a version that outsources to SAS/BAS

Re: [R] Creating a dataframe from a vector of character strings

2011-04-14 Thread Brian Diggs
On 4/14/2011 2:04 PM, Cliff Clive wrote: I have a vector of character strings that I would like to split in two, and place in columns of a dataframe. So for example, I start with this: beatles<- c("John Lennon", "Paul McCartney", "George Harrison", "Ringo Starr") and I want to end up with a da

Re: [R] trouble with \SweaveOpts{grdevice=...}

2011-04-14 Thread Duncan Murdoch
On 11-04-14 12:29 PM, Liviu Andronic wrote: Dear all I've just tried the brand new 'grdevice' option in Sweave but couldn't make it work. When I declare \SweaveOpts{grdevice=pdf} or \SweaveOpts{grdevice=cairo_pdf} trying to plot something simple <>= plot(1:10,1:10,main='Some title') @ would re

Re: [R] How to see a R code from a package?

2011-04-14 Thread Peter Ehlers
On 2011-04-14 12:15, Soyeon Kim wrote: Thank you all, but I still cannot see the whole code. Closest answer is Steve's answer R> glmnet:::predict.cv.glmnet but I only can see a part of the code. I am not sure whether it is protected by the programmer on purpose or I just cannot find where it is.

Re: [R] Creating a dataframe from a vector of character strings

2011-04-14 Thread Rolf Turner
On 15/04/11 09:04, Cliff Clive wrote: I have a vector of character strings that I would like to split in two, and place in columns of a dataframe. So for example, I start with this: beatles<- c("John Lennon", "Paul McCartney", "George Harrison", "Ringo Starr") and I want to end up with a data

Re: [R] Creating a dataframe from a vector of character strings

2011-04-14 Thread Tóth Dénes
You could use ?unlist: structure(data.frame( matrix(unlist(strsplit(beatles," ")),length(beatles),2,T)), names=c("FirstName","LastName")) Note that this compact code does not guard you against typos, that is names with >2 or <2 elements. Hope that helps, Denes > I have a vector of ch

[R] modify particular factor levels

2011-04-14 Thread baptiste auguie
Dear list, I wish to modify programmatically only a few factor levels, according to a named list. I came up with this function, modify.levels <- function(f, modify=list()){ ## levels that will not be changed names.old.levels <- setdiff(levels(f), unlist(modify)) ## as a named list old.le

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread Douglas Bates
My colleague Sunduz Keles once mentioned a similar problem to me. She had a large sample from a reference distribution and a test sample (both real-valued in her case) and she wanted, for each element of the test sample, the proportion of the reference sample that was less than the element. It's

Re: [R] Find number of elements less than some number: Elegant/fastsolution needed

2011-04-14 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin Ummel > Sent: Thursday, April 14, 2011 12:35 PM > To: r-help@r-project.org > Subject: [R] Find number of elements less than some number: > Elegant/fastsolution needed > >

Re: [R] Trojan in R 2.13.0?

2011-04-14 Thread David Freedman
2.13.0 looks fine with VIPRE david freedman atlanta -- View this message in context: http://r.789695.n4.nabble.com/Trojan-in-R-2-13-0-tp3450084p3450784.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Query to Run R on Groovy and Grails

2011-04-14 Thread Kumar Sonu
Hello All, I am using Groovy and Grails on Eclipse. I want to use R with this language but I am unable to configure it correctly on my mac with JRI. So can you help me out ? Thanks Sonu - Sonu kumar DKFZ, Heidelberg Germany __ R-help@r-project.org

Re: [R] zooreg and window

2011-04-14 Thread Katrina Bennett
Hi Achim, Yes, this worked. I added the two strings regts.start <- as.Date(regts.start) regts.end <- as.Date(regts.end) and changed the frequency to 1 in my zooreg call. The window call now works perfectly. I'm still wrapping my head around POSIXct and ISOdatetime and how they need to be appli

[R] Creating a dataframe from a vector of character strings

2011-04-14 Thread Cliff Clive
I have a vector of character strings that I would like to split in two, and place in columns of a dataframe. So for example, I start with this: beatles <- c("John Lennon", "Paul McCartney", "George Harrison", "Ringo Starr") and I want to end up with a data frame that looks like this: > Beatles

Re: [R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Gustavo Carvalho
This might be a bit quicker with larger vectors: f <- function(x, y) sum(x > y) vf <- Vectorize(f, "x") vf(x, y) On Thu, Apr 14, 2011 at 5:37 PM, Marc Schwartz wrote: > On Apr 14, 2011, at 2:34 PM, Kevin Ummel wrote: > >> Take vector x and a subset y: >> >> x=1:10 >> >> y=c(4,5,7,9) >> >> For ea

Re: [R] Plotting an Underbrace in R

2011-04-14 Thread Ben Bolker
Michael McAssey gmail.com> writes: > > I need to include some mathematical expressions in a plot I am creating in > R, one of which requires an underbrace, which in LaTeX would be written like > > \underbrace{T \cdots T}_{n times} > > There does not appear to be a provision for this in plotmat

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread Joshua Wiley
On Thu, Apr 14, 2011 at 7:47 AM, 1Rnwb wrote: > Thanks, I thought that removing the list would take care of it. the question > is I do not see a .Rhistory file in my current working directory, so where > it is stored. it is not visible in C:\Program files\R either. Serarching the > C;\ and D:\ dri

Re: [R] Incremental ReadLines

2011-04-14 Thread William Dunlap
[see below] From: Frederik Lang [mailto:frederikl...@gmail.com] Sent: Thursday, April 14, 2011 12:56 PM To: William Dunlap Cc: r-help@r-project.org Subject: Re: [R] Incremental ReadLines Hi Bill, Thank you so much for your suggestions. I will try and alter my code.

Re: [R] Conveting SAS Proc mixed to R code

2011-04-14 Thread Kevin Wright
> I am trying to teach myself R and replicate some previous SAS analysis. > Could someone please help me translate the following SAS code into R. > > Proc mixed method=ml > Class Group Treatment Stream Time Year; > Model Logrpk=Treatment Time Treatment*Time; > Random Group Stream (Group Treatment)

[R] predict

2011-04-14 Thread Serdar Akin
Hi I'm trying to forecast an zoo-object the following exempel of code:: "dynlm(y_t = 1+ L(y_t, 1:5}}" but I cannot use predict() nor forecast() to make an forecast of the object. Regard Serdar [[alternative HTML version deleted]] __ R-help@r

Re: [R] zooreg and window

2011-04-14 Thread Achim Zeileis
On Thu, 14 Apr 2011, Katrina Bennett wrote: Hi Achim, Yes, this worked. I added the two strings regts.start <- as.Date(regts.start) regts.end <- as.Date(regts.end) and changed the frequency to 1 in my zooreg call. The window call now works perfectly. I'm still wrapping my head around POSIXc

Re: [R] Categorical bubble plot

2011-04-14 Thread John Kane
I think using base graphics you would need to use numerical vectors to set the bubble positions. However there is not reason that you could not suppress the axis labeling and apply your own. This code does the first part using circles. There are probably better ways to do it but this should wo

Re: [R] Trojan in R 2.13.0?

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 18:17 , rbali wrote: > Dear list > > Avira said TR/ATRAPS.Gen trojan is in open.exe [C:\Program > Files\R\R-2.13.0\bin\i386\open.exe] installed yesterday with R 2.13.0 from > > http://streaming.stat.iastate.edu/CRAN/bin/windows/base/R-2.13.0-win.exe > http://cran.cnr.berkel

Re: [R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Marc Schwartz
On Apr 14, 2011, at 2:34 PM, Kevin Ummel wrote: > Take vector x and a subset y: > > x=1:10 > > y=c(4,5,7,9) > > For each value in 'x', I want to know how many elements in 'y' are less than > 'x'. > > An example would be: > > sapply(x,FUN=function(i) {length(which(y [1] 0 0 0 0 1 2 2 3 3 4 >

Re: [R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Richard M. Heiberger
This is faster for small vectors > system.time(for (i in 1:1000) + colSums(outer(y, x, `<`)) + ) user system elapsed 0.110.000.11 > system.time(for (i in 1:1000) + sapply(x,FUN=function(i) {length(which(y > colSums(outer(y, x, `<`)) [1] 0 0 0 0 1 2 2 3 3 4 > sapply(x,FUN=function(

[R] extract cells by columns/rows from matrix

2011-04-14 Thread Nicolas Gutierrez
hi All, I have a matrix Ufi (x by y) 1 2 3 4 5 1 0 0 0 0 3 2 0 0 0 9 0 3 0 2 0 0 3 4 0 0 1 0 0 5 0 1 0 0 0 And I need the x and y "coordinates" of those cells with maximum values: First: x=4; y=2 (Value=9) Second: x=5; y=3 (value=3) Any help? THANKS! Nic _

Re: [R] Rcpp segmentation faults on the simplest code

2011-04-14 Thread Dirk Eddelbuettel
On 14 April 2011 at 03:56, didu wrote: | Hi all, | | I'm new to R and Rcpp, and I'm trying to learn Rcpp with the simplest code | possible. My goal is to be able to call R functions from C++. Just to set the record straight here for purpose of the mailing list archive: the original poster had a s

[R] Conveting SAS Proc mixed to R code

2011-04-14 Thread RKinzer
Hello all, I am trying to teach myself R and replicate some previous SAS analysis. Could someone please help me translate the following SAS code into R. Proc mixed method=ml Class Group Treatment Stream Time Year; Model Logrpk=Treatment Time Treatment*Time; Random Group Stream (Group Treatment)

Re: [R] Problem with R 2.13.0 Task Views (on Mac)

2011-04-14 Thread rbali
Same problem with Vista -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-R-2-13-0-Task-Views-on-Mac-tp3449189p3450073.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://

Re: [R] frailtypack

2011-04-14 Thread Paul78
I have got the same problem. Can anybody help me why R just shuts down? -- View this message in context: http://r.789695.n4.nabble.com/frailtypack-tp2328606p3450039.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org m

Re: [R] Incremental ReadLines

2011-04-14 Thread Mike Marchywka
> Date: Thu, 14 Apr 2011 11:57:40 -0400 > Subject: Re: [R] Incremental ReadLines > From: frederikl...@gmail.com > To: marchy...@hotmail.com > CC: r-help@r-project.org > > Hi Mike, > > Thanks for your comment. > > I must admit that I am very new to R and alth

[R] Help converting SAS Proc mixed to R code

2011-04-14 Thread RKinzer
To anyone that may be able to help, First I applogize if this message ends up in your inbox twice. The first one seemed to get stuck in a pending status so I deleted and started over. I am relatively new to R, however I know the basics through some classes I have taken. Unfortunately the classe

[R] Trojan in R 2.13.0?

2011-04-14 Thread rbali
Dear list Avira said TR/ATRAPS.Gen trojan is in open.exe [C:\Program Files\R\R-2.13.0\bin\i386\open.exe] installed yesterday with R 2.13.0 from http://streaming.stat.iastate.edu/CRAN/bin/windows/base/R-2.13.0-win.exe http://cran.cnr.berkeley.edu/bin/windows/base/R-2.13.0-win.exe Robert -- View

Re: [R] Incremental ReadLines

2011-04-14 Thread Frederik Lang
Hi Bill, Thank you so much for your suggestions. I will try and alter my code. Regarding the even shorter solution outside the loop it looks good but my problem is that not all observations have the same variables so that three different observations might look like this: Id: 1 Var1: false Var

[R] extract cells by columns/rows from matrix

2011-04-14 Thread Nicolas Gutierrez
Hi All, I have the following matrix Ufi (x by y): Ufin 1 2 3 4 5 6 7 8 9 10 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 4 0 0 0 6 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 9 0 0 0 7 0 2 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0 0 0

[R] Plotting an Underbrace in R

2011-04-14 Thread Michael McAssey
I need to include some mathematical expressions in a plot I am creating in R, one of which requires an underbrace, which in LaTeX would be written like \underbrace{T \cdots T}_{n times} There does not appear to be a provision for this in plotmath, and I cannot find anything on the topic in the R

[R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Kevin Ummel
Take vector x and a subset y: x=1:10 y=c(4,5,7,9) For each value in 'x', I want to know how many elements in 'y' are less than 'x'. An example would be: sapply(x,FUN=function(i) {length(which(yhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.o

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread YAddo
Yep... Hitting the up arrow key upon the next initialization shows all the previous codes. I.e. after q() --- Y and re opening R console the next time. -- View this message in context: http://r.789695.n4.nabble.com/Clearing-Console-of-weeks-of-codes-tp3447506p3450541.html Sent from the R

Re: [R] Incremental ReadLines

2011-04-14 Thread Frederik Lang
Hi Mike, Thanks for your comment. I must admit that I am very new to R and although it sounds interesting what you write I have no idea of where to start. Can you give some functions or examples where I can see how it can be done. I was under the impression that I had to do a loop since my block

[R] how to code a restriction matrix with the following restrictions

2011-04-14 Thread sébastien saegesser
Dear list members, I need to fit a regression with two inequality constraints. I look up in the literature and R archive and found some ways to do it, for example using the ic.infer package. However I do not know how to write in R my constraints. In the package help, it is told that

Re: [R] integer and floating-point storage

2011-04-14 Thread Matt Shotwell
Hi Mike, There are some facilities for storing and manipulating small (2 bit) integers. See here: http://cran.r-project.org/web/packages/ff/index.html -Matt On 04/14/2011 01:20 PM, Mike Miller wrote: I note that "current implementations of R use 32-bit integers for integer vectors," but I a

Re: [R] How to see a R code from a package?

2011-04-14 Thread Soyeon Kim
Thank you all, but I still cannot see the whole code. Closest answer is Steve's answer R> glmnet:::predict.cv.glmnet but I only can see a part of the code. I am not sure whether it is protected by the programmer on purpose or I just cannot find where it is. Soyeon On Thu, Apr 14, 2011 at 1:18 PM,

[R] integer and floating-point storage

2011-04-14 Thread Mike Miller
I note that "current implementations of R use 32-bit integers for integer vectors," but I am working with large arrays that contain integers from 0 to 3, so they could be stored as unsigned 8-bit integers. Can R do this? (FYI -- This is for storing minor-allele counts for genetic studies. Ther

Re: [R] How to see a R code from a package?

2011-04-14 Thread Jannis
Just type the name of your function without (). Or use fix(). Or do you need to do something more complicated? HTH Jannis --- Soyeon Kim schrieb am Do, 14.4.2011: > Von: Soyeon Kim > Betreff: [R] How to see a R code from a package? > An: r-help@r-project.org > Datum: Donnerstag, 14. April, 2

Re: [R] saving a regression model to a file

2011-04-14 Thread Marc Schwartz
On Apr 14, 2011, at 12:45 PM, Alison Callahan wrote: > Hello all, > > First off, I am using R version 2.13.0 in Ubuntu. > > I have read previous posts in the R mailing list on saving models for > later use, and the responses indicate using the R save() function to > save a model and then using l

Re: [R] Trouble using "duleg" from labdsv

2011-04-14 Thread droberts
I apologize for the slow response, but I just registered with Nabble. The duleg function in labdsv was renamed indval to be more consistent with its use in the literature. Typing ?indval will provide more information. As an aside, all R functions have an email for the author or maintainer speci

[R] saving a regression model to a file

2011-04-14 Thread Alison Callahan
Hello all, First off, I am using R version 2.13.0 in Ubuntu. I have read previous posts in the R mailing list on saving models for later use, and the responses indicate using the R save() function to save a model and then using load() to load it is one way to go. However, when I use the save() fu

[R] Automatically extract info from Granger causality output

2011-04-14 Thread ivan
Dear Community, this is my first programming in R and I am stuck with a problem. I have the following code which automatically calculates Granger causalities from a variable, say e.g. "bs" as below, to all other variables in the data frame: log.returns<-as.data.frame( lapply(daten, function(x) di

[R] Reshaping and plotting tabular data

2011-04-14 Thread tsippel
Hi- Tabular data have been provided to me within .csv files. I need to transform the data from tabular format into a dataframe with three columns. The columns need to be the table row id, table column id, and the tabulated variable. An example dataset can be downloaded here: https://docs.google.co

Re: [R] How to see a R code from a package?

2011-04-14 Thread Steve Lianoglou
You could also just download the source package from CRAN and look through it. The thing is, the predict.cv.glmnet function isn't exported by the package (via its namespace file) -- so it's somehow protected. You could still see it using `:::`, like so: R> glmnet:::predict.cv.glmnet function(obje

Re: [R] How to see a R code from a package?

2011-04-14 Thread Kevin Wright
See help for getAnywhere() Kevin On Thu, Apr 14, 2011 at 11:24 AM, Soyeon Kim wrote: > Dear R users, > > Hi. I want know R code of a function: predict.cv.glmnet (which is > included in glmnet package). > Could you let me know how I can see the R code of the function? > > Thank you, > Soyeon Ki

Re: [R] Incremental ReadLines

2011-04-14 Thread William Dunlap
I have two suggestions to speed up your code, if you must use a loop. First, don't grow your output dataset at each iteration. Instead of cases <- 0 output <- numeric(cases) while(length(line <- readLines(input, n=1))==1) { cases <- cases + 1 output[cases] <- as.nume

[R] trouble with \SweaveOpts{grdevice=...}

2011-04-14 Thread Liviu Andronic
Dear all I've just tried the brand new 'grdevice' option in Sweave but couldn't make it work. When I declare \SweaveOpts{grdevice=pdf} or \SweaveOpts{grdevice=cairo_pdf} trying to plot something simple <>= plot(1:10,1:10,main='Some title') @ would result in an Sweave error: 18:16:47.299: 1 : te

[R] How to see a R code from a package?

2011-04-14 Thread Soyeon Kim
Dear R users, Hi. I want know R code of a function: predict.cv.glmnet (which is included in glmnet package). Could you let me know how I can see the R code of the function? Thank you, Soyeon Kim __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] for loop performance

2011-04-14 Thread Barth B. Riley
Thanks Martin, this is very helpful. Barth -Original Message- From: Martin Morgan [mailto:mtmor...@fhcrc.org] Sent: Thursday, April 14, 2011 11:04 AM To: Barth B. Riley Subject: Re: [R] for loop performance On 04/14/2011 07:12 AM, Barth B. Riley wrote: > Hi Martin > > Question--when vari

Re: [R] Categorical bubble plot

2011-04-14 Thread Ben Bolker
Jurgens de Bruin gmail.com> writes: > > Hi, > > I do not have much R experience just the basics, so please excuse > any obvious questions. > > I would like to create bubble plot that have Categorical data on the x and y > axis and then the diameter if the bubble the value related to x and y. >

Re: [R] Identify period length of time series automatically?

2011-04-14 Thread Mike Marchywka
> Date: Thu, 14 Apr 2011 12:42:28 +0200 > From: r.m.k...@gmail.com > To: marchy...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] Identify period length of time series automatically? > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA

Re: [R] appending to a vector

2011-04-14 Thread Jonathan P Daily
Neither is the fastest method. The best way would be to vectorize func so that it accepts and returns a vector. Many builtin R functions do this and say so in their documentation. The slower way would be to use one of the apply functions, such as: ?lapply x2 <- lapply(x, func) If you must use

Re: [R] how to enclose two xyplot

2011-04-14 Thread Francesco Nutini
ok ?c.trellis works well. But I still have a problem. One of my plot is a combination of two xyplot on different scales: a<-xyplot(NDVI_P10~dek_num | Year, type="a", data=data, xlim=c(1,37), ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2, col="darkgrey", col.axis="black", l

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread Ted Harding
Thanks for the clarification, Jim. The terminology "previous" was not self-explanatory! The following implements (in a somewhat crude way, but explicit) a solution to your question: M <- matrix(c(1, 4, 23, 30), byrow=TRUE, ncol=2) M # [,1] [,2] # [1,]14 # [2,] 23 30 f

Re: [R] Previously attainable fisher's exact test

2011-04-14 Thread peter dalgaard
On Apr 14, 2011, at 16:55 , Jim Silverton wrote: > What Ted and Peter did were Fisher's exact test, To get the previous > attainable p-value, what you do is the the fisher exact test p-values of ALL > the possible tables with margins fixed and choose the p-value that is just > below the one f

Re: [R] Wilcoxon rank sum in unbalanced design

2011-04-14 Thread netrunner
Dear Peter, thank you for your reply. It works very well! I have an additional question: what about the Wilcoxon test in case of unequal paired samples with ties? thank you! net -- View this message in context: http://r.789695.n4.nabble.com/Wilcoxon-rank-sum-in-unbalanced-design-tp3447400p34

Re: [R] appending to a vector

2011-04-14 Thread Sarah Goslee
Hi Dirk, On Thu, Apr 14, 2011 at 4:59 AM, dirknbr wrote: > Which one is more efficient? > > x2=c() > for (i in 1:length(x)) { >  x2=c(x2,func(x[i])) > } > > or > > x2=x > for (i in 1:length(x)) { >  x2=func(x[i]) > } > > where func is any function? This one. Creating a [vector|matrix|dataframe]

Re: [R] Comparison of the amount of computation

2011-04-14 Thread helin_susam
Dear Pert, Many thanks to your reply. Fully you are right! Best wishes, Helin. -- View this message in context: http://r.789695.n4.nabble.com/Comparison-of-the-amount-of-computation-tp3448436p3449722.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread B77S
If you don't want your history, why not just do this. >q() Save workspace image? [y/n/c]: >n ?? Am I missing something? 1Rnwb wrote: > > Thanks, I thought that removing the list would take care of it. the > question is I do not see a .Rhistory file in my current working directory, > so where

Re: [R] predict()

2011-04-14 Thread Ivo Shterev
Dear Dr. Therneau, Thank you for your response. Just to point out that we didn't experience any problems with the lm() function under R version 2.12.2 (2011-02-25): > set.seed(123) > testdat=data.frame(y=rexp(10),event=rep(0:1,each=5),x=rnorm(10)) > testfm=as.formula('y~x') > > testfun=function

Re: [R] question about optim‏

2011-04-14 Thread chirine wolley
thank you very much for your response! But I have now another problem: optim( ) gives me the exactly same initial values for the 4 parameters. I have tried many initial values, and it always didnt change them. opt$convergence = 1. I increased the number of iterations, but the problem is still

Re: [R] Clearing Console; of weeks of codes!

2011-04-14 Thread 1Rnwb
Thanks, I thought that removing the list would take care of it. the question is I do not see a .Rhistory file in my current working directory, so where it is stored. it is not visible in C:\Program files\R either. Serarching the C;\ and D:\ drives shows some old .Rhistory files but not the recent o

[R] problem with library tseriesChaos

2011-04-14 Thread mike1989
Hi R-Users I need to estimate Lyapunov exponent of my time series. After reading description of all functions available I still don't know how to determine time delay. My time series length is 4200. Is it possible to determine time delay with other function's output or I can choose any random valu

Re: [R] error for ttest: solved

2011-04-14 Thread 1Rnwb
I knew that the "NA's" in my data were the root cause of the trouble, but did not find out how to get rid of them. Untill I found your another post mentioning to use 'na.omit' to remove the lines containing 'NA's" and the problem got fixed after that. Thanks for the help and all the trouble you hav

[R] Lm.fit extracting r-squared

2011-04-14 Thread jhn_nolan
Dear list, I am running a fama macbeth regression using the lm.fit function and am having problems extracting the rsquareds from each of the cross sectional regressions (second stage) I have estimated. I can obtain the coefficients using cfit = lm.fit(t(bhat[-1,]), t(q))$coefficients However I

[R] Return Level Confidence Intervals

2011-04-14 Thread Champion, Adrian
Hi I'm trying to plot several return level plots on the same axes to compare the return levels from different data sets. To do this I am having to manually plot the return levels for return periods. The problem is when I try to plot the automatically calculated confidence intervals as the array

Re: [R] Incremental ReadLines

2011-04-14 Thread Mike Marchywka
> Date: Wed, 13 Apr 2011 10:57:58 -0700 > From: frederikl...@gmail.com > To: r-help@r-project.org > Subject: Re: [R] Incremental ReadLines > > Hi there, > > I am having a similar problem with reading in a large text file with around > 550.000 observatio

[R] Rcpp segmentation faults on the simplest code

2011-04-14 Thread didu
Hi all, I'm new to R and Rcpp, and I'm trying to learn Rcpp with the simplest code possible. My goal is to be able to call R functions from C++. The code I'm trying to run is: #include #include #include #include int main(int argc, char* argv[]) { Rcpp::NumericVector v(1); r

Re: [R] Identify period length of time series automatically?

2011-04-14 Thread Mike Marchywka
> Date: Thu, 14 Apr 2011 11:29:23 +0200 > From: r.m.k...@gmail.com > To: r-help@r-project.org > Subject: [R] Identify period length of time series automatically? > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi > > I have 10.000 simulatio

Re: [R] question about optim

2011-04-14 Thread chirine wolley
thank you very much for your response! But I have now another problem: optim( ) gives me the exactly same initial values for the 4 parameters. I have tried many initial values, and it always didnt change them. opt$convergence = 1. I increased the number of iterations, but the problem is still

[R] Error is assocplot

2011-04-14 Thread suparna mitra
Hello, I have a contingency table showing relation between two datasets. I tried to see association among them with the assocplot, but it shows error. mosaicplot of the same data worked perfectly. Can anyone please help me. Con.table=as.matrix(Con.table) > dim(Con.table) [1] 27 27 > assocplot(C

[R] appending to a vector

2011-04-14 Thread dirknbr
Which one is more efficient? x2=c() for (i in 1:length(x)) { x2=c(x2,func(x[i])) } or x2=x for (i in 1:length(x)) { x2=func(x[i]) } where func is any function? Dirk -- View this message in context: http://r.789695.n4.nabble.com/appending-to-a-vector-tp3449109p3449109.html Sent from the R

Re: [R] Using help in Windows version of R with disabled browser [SOLVED]

2011-04-14 Thread Ranjan Maitra
Hi, Just wanted to mention that this worked perfectly. Many thanks again and best wishes, Ranjan On Tue, 12 Apr 2011 13:04:14 -0500 Jonathan P Daily wrote: > try: > > options(help_type = 'text') > ?options > > If this works, you can create a site profile (A default is created > automaticall

[R] help on compare two ranks

2011-04-14 Thread Baoqiang Cao
Hi, I have to one set of inputs and their observed true values of each input. Now I have a model takes the input and predict a value. I only consider the ranks based on either the observed true values or the predicted values. My question is how do I compare this two rank in R? That is, how close t

  1   2   >