[R] TreynorRatio

2012-11-08 Thread sheenmaria
i read about the performance analytics package i have a doubt about the TreynorRatio i have code g=getSymbols("IBM") > c=Cl(g) > r=Return.calculate(c) > SharpeRatio.annualized(r) IBM.Close Annualized Sharpe Ratio (Rf=0%) 0.3566339 > TreynorRatio (ret) Err

Re: [R] if url.exists() or not

2012-11-08 Thread veepsirtt
Hi Rusers, the file is available for download but it returns not exists. How to download the files? thanks veepsirtt > # > # check for if file exist or not > # >

Re: [R] Controlling R fonts through LaTeX

2012-11-08 Thread Karen Kotschy
Thanks a lot, I'll check out those two options! Karen On Thu, Nov 8, 2012 at 7:43 PM, Yihui Xie wrote: > Perhaps you can use ps.options(family = "...") to set the font family > globally. > > If you really want to control R fonts through LaTeX, you can try the > tikzDevice package (optionally wi

Re: [R] vectorized uni-root?

2012-11-08 Thread ivo welch
hi michael---this can be done better than with outer(). A vectorized bisection search that works with an arbitrary number of arguments is bisection <- function(f, lower, upper, ..., numiter =100, tolerance = .Machine$double.eps^0.25 ) { stopifnot(length(lower) == length(upper)) flower <- f(l

Re: [R] Looking for a test of standard normality

2012-11-08 Thread Pascal Oettli
I would suggest reading the following: http://stackoverflow.com/questions/7781798/seeing-if-data-is-normally-distributed-in-r Regards, Pascal Le 09/11/2012 09:23, Herschtal Alan a écrit : Dear list members, I am looking for a goodness of test that will tell me if a sample is likely to have c

Re: [R] Creating yyyymm regexp strings on the fly for aggregation.

2012-11-08 Thread arun
HI, Not sure whether you are looking for something similar to this: I modified groupingStrings(): groupingStrings<-function(yrs,numSplits) unlist(lapply(yrs,function(x) paste(x,formatC(numSplits,width=2,flag=0),sep=""))) splitIt <- function(x, n) {split(x, sort(rank(x) %% n))} lapply(split(grou

Re: [R] using lapply with recode

2012-11-08 Thread arun
HI, Sorry, I gave the wrong answer.  res<-lapply(mylist,function(x) data.frame(a=x[,1],prov=recode(x[,2],"'QUE'='QC';'Quebec'='QC'"))) res[[1]][1:6,] #  a prov #1 1   QC #2 2   QC #3 3   QC #4 4   QC #5 5   QC #6 6   BC A.K. - Original Message - From: Simon Kiss To: r-help@r-project.o

[R] Creating yyyymm regexp strings on the fly for aggregation.

2012-11-08 Thread Keith Weintraub
Folks, This question is somewhat related to a previous posting of mine. I just can't seem to create a generic solution. Here is a function that I found searching around the internet: splitIt <- function(x, n) {split(x, sort(rank(x) %% n))} I use it like so: > splitIt(1:12, 2) $`0` [1] 1 2 3 4

Re: [R] using lapply with recode

2012-11-08 Thread arun
HI, Try this:  lapply(mylist,function(x) {recode(x[,2],"'QUE'='QC';'Quebec'='QC'") return(x)}) #$df1  #   a prov #1   1  QUE #2   2  QUE #3   3  QUE #4   4  QUE #5   5  QUE #6   6   BC #7   7   BC #8   8   BC #9   9   BC #10 10   BC #$df2  #   a   prov #1   1 Quebec #2   2 Quebec #3   3 Quebec #

Re: [R] using lapply with recode

2012-11-08 Thread Jim Holtman
you need to return 'x' as the last statement of the lapply. Sent from my iPad On Nov 8, 2012, at 22:06, Simon Kiss wrote: > Hello: > Forgive me, this is surely a simple question but I can't figure it out, > having consulted the help archives and "Data Manipulation With R" (Spector). > I have

Re: [R] Looking for a test of standard normality

2012-11-08 Thread Mark Lamias
The Anderson-Darling Test and the Shapiro-Wilk test have considerably more power. I'd refer you to a non-R related discussion board for statistics related questions.  Perhaps the following might be more useful: http://stats.stackexchange.com/questions/8184/most-powerful-gof-test-for-normality

Re: [R] Looking for a test of standard normality

2012-11-08 Thread Rolf Turner
Others may correct me, but I cannot imagine any test of standard normality giving appreciably more power than is given by the Kolmogorov-Smirnov test. I also wonder about the point of testing for (standard) normality in the first place. There is a quote --- I think it refers to testing for het

[R] using lapply with recode

2012-11-08 Thread Simon Kiss
Hello: Forgive me, this is surely a simple question but I can't figure it out, having consulted the help archives and "Data Manipulation With R" (Spector). I have a list of 11 data frames with one common variable in each (prov). I'd like to use lapply to go through and recode one particular leve

Re: [R] Two-way Random Effects with unbalanced data

2012-11-08 Thread asafwe
Matthias, This is so very helpful! Thank you so much for exposing me to this. Seems like exactly what I was looking for. Best regards, Asaf -- View this message in context: http://r.789695.n4.nabble.com/Two-way-Random-Effects-with-unbalanced-data-tp4647795p4648995.html Sent from the R help

[R] Looking for a test of standard normality

2012-11-08 Thread Herschtal Alan
Dear list members, I am looking for a goodness of test that will tell me if a sample is likely to have come from a standard normal distribution. I can find plenty of omnibus tests for normality in the nor.test package, but none of them appear to allow me to test against the specific alternative th

Re: [R] loading both RPostgreSQL and RSQLite leads to problems

2012-11-08 Thread Martin Morgan
On 11/8/2012 11:43 AM, Jon McAuliffe wrote: hi martin, i have installed 2.15.2 and tried your code example below, but i still get the same error: library(RSQLite) Loading required package: DBI library(RPostgreSQL) dbDriver('PostgreSQL') Error in function (classes, fdef, mtable) : unab

Re: [R] Issues with Heat Map Images

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 1:09 PM, cpleisner wrote: > David, > I tried that and zoomed in on the labels. It seems that the labels are > oriented wrong with is possibly why they are smearing. Instead of reading > left to right they are turned 90 degrees and read from the top to the bottom > along the a

Re: [R] Beginner help about output in R

2012-11-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Jean V Adams > Sent: Thursday, November 08, 2012 3:52 PM > To: nicolapon > Cc: r-help@r-project.org > Subject: Re: [R] Beginner help about output in R > > Nicolas, > > Maybe som

Re: [R] Beginner help about output in R

2012-11-08 Thread Jean V Adams
Nicolas, Maybe something like this would work for you. Put all of your x values in a list (or a vector, if your x values are scalars). Use sapply to loop through all of your x values, applying the value1() and value2() functions, and saving the results in a data frame. Then write the data f

Re: [R] Beginner help about output in R

2012-11-08 Thread Michael Weylandt
On Nov 8, 2012, at 9:14 PM, nicolapon wrote: > Dear R experts, > > I am a beginner with R and I have a question regarding the output of a > function. > > Basically, I created 2 functions, value1 and value2, that calculate two > values, and I would like to print those two values to an output d

Re: [R] sweave xtable and driver RweaveHTML

2012-11-08 Thread Duncan Mackay
Hi I have sometimes had to produce an html table in Sweave for a complicated table and have make a chunk of it . cut down version below. You could use the defaults for write.table fhtml <- paste(baseRimg, "-T", ".html", sep = "") if (file.exists(fhtml) ) file.remove(fhtml) file

Re: [R] Regrouping dataframe

2012-11-08 Thread arun
Hi, No problem. Another method will be: library(reshape2) dcast(dat1,TYPE~VAL,value.var="AMOUNT") #    TYPE BB BE  BK  BW BZ HH HR MN  MT  NK  RR SL SM SN SZ UU #1 WASTE1 82 19 254 167 14 33 93 48 144 359 112 27 62 59 86 51 #2 WASTE2 11  2  60  46 NA 13 54  6  48 159  19  2 16 16 59  9 #3 WASTE3 1

Re: [R] multiple comparisons with generalised least squares

2012-11-08 Thread mikachu
Ariel THANK YOU for posting this. worked great for me just pasting this part into R Ariel wrote > model.matrix.gls <- function(object, ...) > model.matrix(terms(object), data = getData(object), ...) > > > model.frame.gls <- function(object, ...) > model.frame(formula(object), data

Re: [R] Issues with Heat Map Images

2012-11-08 Thread cpleisner
David, I tried that and zoomed in on the labels. It seems that the labels are oriented wrong with is possibly why they are smearing. Instead of reading left to right they are turned 90 degrees and read from the top to the bottom along the axis of the heatmap. How do I fix this? Thanks! Courtney

[R] Beginner help about output in R

2012-11-08 Thread nicolapon
Dear R experts, I am a beginner with R and I have a question regarding the output of a function. Basically, I created 2 functions, value1 and value2, that calculate two values, and I would like to print those two values to an output datafile. I tryed the following function: function (x) {write.t

[R] FW: Interfacing R and Weka

2012-11-08 Thread Peter Alspach
-Original Message- From: Patrick Connolly Sent: Friday, 9 November 2012 11:29 a.m. To: Peter Alspach Subject: Interfacing R and Weka > version _ platform x86_64-unknown-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status

Re: [R] Help Read File With Odd Characters

2012-11-08 Thread Lee Hachadoorian
On 11/08/2012 02:51 AM, Prof Brian Ripley wrote: On 08/11/2012 07:11, Lee Hachadoorian wrote: I have a large (105MB) data file, tab-delimited with a header. There are some odd characters at the beginning of the file that are preventing it from being read by R. That is a BOM make in UCS-2 enco

Re: [R] the results of the SORT function differ from Scilab/Matlab for Complex Numbers

2012-11-08 Thread Duncan Murdoch
On 08/11/2012 4:42 PM, Cleber N.Borges wrote: Ok, thanks. There are a simple mode for emulate this behaviour? This should sort by modulus then argument (phase): x[order(Mod(x), Arg(x))] It does strange things if x happens to be real: > x <- (-5):5 > sort(x) [1] -5 -4 -3 -2 -1 0 1 2 3

Re: [R] the results of the SORT function differ from Scilab/Matlab for Complex Numbers

2012-11-08 Thread Cleber N.Borges
Ok, thanks. There are a simple mode for emulate this behaviour? Cleber Em 08/11/2012 19:25, Thomas Lumley escreveu: > On Fri, Nov 9, 2012 at 10:02 AM, Cleber N.Borges > wrote: > > Hello useRs, > > The results of the SORT function differ from Scilab/Matlab for

Re: [R] RMySQL install on windows

2012-11-08 Thread Uwe Ligges
On 07.11.2012 21:50, sbarandiaran wrote: Hi, I've followed these steps: I set the MYSQL_HOME environmental variable like this: "c:\PROGRA~1\MySQL\MYSQLS~1.5", then I opened a command prompt, got to the folder that contains the "RMySQL_0.9-3.tar.gz" file, and run the command: "c:\Program Files

Re: [R] mergeing a large number of large .csvs

2012-11-08 Thread Uwe Ligges
On 06.11.2012 05:24, Benjamin Caldwell wrote: Thanks to you all. Modifying the code to use rbind instead of merge worked like a charm - I can only speculate why. Because merge is not intended for appending. See its help page. Uwe Ligges Best *Ben Caldwell* PhD Candidate University of Cal

Re: [R] Obtaining R-squared value in Logistic Regression

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 11:58 AM, hoguejm wrote: > I do not see an R-squared value after preforming the glm regression. > > Is there a separate command for this? Which pseudo-R^2 are you looking for? -- David Winsemius, MD Alameda, CA, USA __ R-help@r

Re: [R] the results of the SORT function differ from Scilab/Matlab for Complex Numbers

2012-11-08 Thread Thomas Lumley
On Fri, Nov 9, 2012 at 10:02 AM, Cleber N.Borges wrote: > Hello useRs, > > The results of the SORT function differ from Scilab/Matlab for Complex > Numbers in my example. > This design is the desirable in R? > Well, it's deliberate and documented. R sorts complex numbers by real part then by ima

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-08 Thread Bärbel
Thanks a lot for all your input!! -- View this message in context: http://r.789695.n4.nabble.com/how-to-generate-a-set-of-random-numbers-that-sum-to-1-with-uniform-distribution-of-elements-tp4648695p4648973.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Obtaining R-squared value in Logistic Regression

2012-11-08 Thread Rolf Turner
On 09/11/12 08:58, hoguejm wrote: I do not see an R-squared value after preforming the glm regression. Is there a separate command for this? A logistic regression is fitted via maximum likelihood, not by least squares. Unless I am very much mistaken (always a contingency to be considered!)

Re: [R] Extracting columns

2012-11-08 Thread arun
HI Silvano, I was using the sample() to create column names without a given seed.  So, there was a possibility of having the same column names for list elements.   In your case, there are fixed number of columns and I believe no two columns from all the 22 files have the same column name.  The

Re: [R] LiblineaR: accept sparse matrices

2012-11-08 Thread Sam Steingold
> * Ben Bolker [2012-11-07 21:51:07 +]: > > Sam Steingold gnu.org> writes: > >> It would be nice if LiblineaR() accepted data in the form of a sparse >> matrix (it does not accept whatever e1071::read.matrix.csr returns). >> >> It would also be nice if there were functions to read/write file

Re: [R] Regrouping dataframe

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 9:51 AM, Geophagus wrote: > Hi @ all, > I hope for some help of you. > I have a dataframe and I want to regroup it. > examp4.csv Sigh. Please expalin why you posted a link to a "csv file" that had no commas. > > I ne

[R] the results of the SORT function differ from Scilab/Matlab for Complex Numbers

2012-11-08 Thread Cleber N.Borges
Hello useRs, The results of the SORT function differ from Scilab/Matlab for Complex Numbers in my example. This design is the desirable in R? Thanks. Cleber r <- c( 1.7507+0.1689i, 1.7507-0.1689i, 1.3886+0.i, 1.0458+0.0792i, 1.0458-0.0792i, 0.8279+0.1861i, 0.8279-0.1861i, 0.8263+0.3731

Re: [R] Obtaining R-squared value in Logistic Regression

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 1:58 PM, hoguejm wrote: > I do not see an R-squared value after preforming the glm regression. > > Is there a separate command for this? > > Thanks You might want to look at the lrm() function in Frank's 'rms' package on CRAN, which will provide Nagelkerke's pseudo R^2 as

Re: [R] Regrouping dataframe

2012-11-08 Thread Geophagus
Thank you very much! It works ! Best greetings GeO -- View this message in context: http://r.789695.n4.nabble.com/Regrouping-dataframe-tp4648927p4648956.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing l

[R] Obtaining R-squared value in Logistic Regression

2012-11-08 Thread hoguejm
I do not see an R-squared value after preforming the glm regression. Is there a separate command for this? Thanks -- View this message in context: http://r.789695.n4.nabble.com/Obtaining-R-squared-value-in-Logistic-Regression-tp4648954.html Sent from the R help mailing list archive at Nabble

[R] Regrouping dataframe

2012-11-08 Thread Geophagus
Hi @ all, I hope for some help of you. I have a dataframe and I want to regroup it. examp4.csv I need the arguments of "VAL" as table heads and the "TYPE " only in individual expression. The result should look like in the example pic. exp

Re: [R] Calling R object from R function

2012-11-08 Thread frespider
Hi, I edit my post, Can you please help with this matter? Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function # Initialize some data Dat <- cbind( a0 = rep(1, 40), a = rep(0:1, 20), b = rep(c(1,0), each =

Re: [R] row index for max values of row groups

2012-11-08 Thread Omphalodes Verna
Thansk for help to all.   OV From: William Dunlap Cc: R help ; Omphalodes Verna Sent: Wednesday, November 7, 2012 8:38 PM Subject: RE: [R] row index for max values of row groups Note that the unlist(tapply()) algorithm depends on the groups column being

Re: [R] Extract cell of many values from dataframe cells and sample from them.

2012-11-08 Thread Jean V Adams
Ben, I think you would find lists a helpful way to arrange your data. They do not require equal lengths of data in each element. Check out the code below for a smaller version of the example you provided (with only 5 individuals rather than 500). # An alternative way to arrange your data, as

Re: [R] loading both RPostgreSQL and RSQLite leads to problems

2012-11-08 Thread Jon McAuliffe
hi martin, i have installed 2.15.2 and tried your code example below, but i still get the same error: > library(RSQLite) Loading required package: DBI > library(RPostgreSQL) > dbDriver('PostgreSQL') Error in function (classes, fdef, mtable) : unable to find an inherited method for function

Re: [R] How to include CI in a grouped barplot?

2012-11-08 Thread ilai
On Thu, Nov 8, 2012 at 12:14 PM, Rui Barradas wrote: > Hello, > > If I understand it right, you can use the arrows() function with an angle > of 90 to get ci bars. > Using your data example, but with made up standard errors, > > > a=c(10,15) > b=c(20,24) > c=c(21,23) > > hei=cbind(a,b,c) > > # St

Re: [R] Extracting columns

2012-11-08 Thread arun
HI, May be this helps: list1<-lapply(1:5,function(x) data.frame(matrix(sample(1:100,50,replace=TRUE),ncol=5))) list1<-lapply(list1,function(x) {colnames(x)<-sample(paste0("A",1:50),5,replace=FALSE)  return(x)}) coldat<-data.frame(col1=c("A9","A35","A7","A30")) #colnames that needs to be extra

Re: [R] Produce "a prism like plot"

2012-11-08 Thread Jim Lemon
On 11/08/2012 11:48 PM, DusanP wrote: Sorry to bother you again, But I have two other questions : 1. How do I change symbols (dots) for each group? I tried : For group 1, n=5. points(x=groups[1:5],y=data[1:5],type=pch). The issue is that it doesn't select the right points, or coordinates. 2.

Re: [R] How to include CI in a grouped barplot?

2012-11-08 Thread Rui Barradas
Hello, If I understand it right, you can use the arrows() function with an angle of 90 to get ci bars. Using your data example, but with made up standard errors, a=c(10,15) b=c(20,24) c=c(21,23) hei=cbind(a,b,c) # Standard errors sigma <- matrix(runif(6), ncol = 3) # helper function ci <- f

Re: [R] Extracting columns

2012-11-08 Thread Rui Barradas
Hello, Something like this should get you close. filenames <- paste0("A", 1:22) cols <- c('c1', 'c50', 'C750') lapply(filenames, function(x){ dat <- read.table(x, header = TRUE) subset(dat, select = which(names(dat) %in% cols)) }) Hope this helps, Rui Barradas Em 08-11-2012 15:50, S

Re: [R] Looping matrix multiplication

2012-11-08 Thread R. Michael Weylandt
On Thu, Nov 8, 2012 at 6:16 PM, Nordlund, Dan (DSHS/RDA) wrote: > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of wilkesma >> Sent: Thursday, November 08, 2012 5:49 AM >> To: r-help@r-project.org >> Subject: [R] Looping mat

Re: [R] Formatting digits in a table with mix of numbers and characters

2012-11-08 Thread arun
Hi, You can also use formatC(). table[]<-ifelse(!is.na(as.numeric(tab1)),formatC(as.numeric(table),format="fg",width=4),table) #warnings will be present  table # [,1]    [,2]    [,3]  #[1,] "12.35" "--"    "  10" #[2,] "12.35" "--"    "NA"  #[3,] "--"    "123.5" "--"  A.K. - Ori

Re: [R] Looping matrix multiplication

2012-11-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of wilkesma > Sent: Thursday, November 08, 2012 5:49 AM > To: r-help@r-project.org > Subject: [R] Looping matrix multiplication > > I am dealing with a number of time-series consis

Re: [R] strsplit with invalid regular expression

2012-11-08 Thread Jeff Newmiller
In R, the source code representation of a special character uses the \ as an escape character to begin a special character sequence. For example, "\n" is a single newline character. Because backslash has this special meaning, to represent a single backslash character one must escape it: "\\" lo

Re: [R] Formatting digits in a table with mix of numbers and characters

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 10:14 AM, Brian Hobbs wrote: > Hello, > > I am currently trying to find an easy way to take a table with a mix > of numbers and characters and format the numbers in the table to be > constrained to 4 significant digits. > > Example: > > #this is my table creation >> table <-

Re: [R] Formatting digits in a table with mix of numbers and characters

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 8:14 AM, Brian Hobbs wrote: > Hello, > > I am currently trying to find an easy way to take a table with a mix > of numbers and characters and format the numbers in the table to be > constrained to 4 significant digits. > > Example: > > #this is my table creation >> table <-

Re: [R] vectorized uni-root?

2012-11-08 Thread R. Michael Weylandt
On Thu, Nov 8, 2012 at 3:05 PM, ivo welch wrote: > dear R experts--- I have (many) unidimensional root problems. think > > loc.of.root <- uniroot( f= function(x,a) log( exp(a) + a) + a, > c(.,9e10), a=rnorm(1) ) $root > > (for some coefficients a, there won't be a solution; for others, it > may

Re: [R] conditional coding question

2012-11-08 Thread haps
Thank you all very much for your helpful comments and showing where I went wrong. After so many trials, the code below seems to work: incorp <- with(data7.13.11, ifelse(groupinc %in% c(5), 'cons', ifelse(groupinc %in% c(-3,-2) & indinc < 9, 'ethnat',

Re: [R] Issues with Heat Map Images

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 7:58 AM, cpleisner wrote: > David, > Thanks for the help. I tried the following code: > > heatdata <- read.csv("logFC_bin17.csv", sep=",") > heatdata <- heatdata[,2:5] > heatdata_matrix <- data.matrix(heatdata) > rownames(heatdata_matrix) = paste("Gene", 2:655) > jpeg("Heatma

Re: [R] Line feed on "main" title of the plot

2012-11-08 Thread R. Michael Weylandt
On Thu, Nov 8, 2012 at 2:23 PM, DusanP wrote: > Hello everyone, > > I would like to perform a line feed on the main title of the plot. > > How to do that? > plot(1:5, main = "A line\nsplit in two") The "\n" is the newline character. __ R-help@r-projec

Re: [R] Controlling R fonts through LaTeX

2012-11-08 Thread Yihui Xie
Perhaps you can use ps.options(family = "...") to set the font family globally. If you really want to control R fonts through LaTeX, you can try the tikzDevice package (optionally with knitr) following the instructions in https://github.com/yihui/knitr-examples/blob/master/059-tikz.Rnw This allows

Re: [R] How to include CI in a grouped barplot?

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 7:02 AM, Thais Rangel wrote: > Hello everyone! > > I need to include the confidence interval bar in a grouped barplot. I've > found some options on the web, but none of them solved my problem. > > The question is: my barplot was created using vectors for each pair of bar > an

Re: [R] Line feed on "main" title of the plot

2012-11-08 Thread Sarah Goslee
Simply inserting a line feed works for me: plot(1:5, 1:5, main="A title\nwith a line break") Sarah On Thu, Nov 8, 2012 at 9:23 AM, DusanP wrote: > Hello everyone, > > I would like to perform a line feed on the main title of the plot. > > How to do that? > > Thanks > > Dusan > > > > -- > --

Re: [R] Produce "a prism like plot"

2012-11-08 Thread Jose Iparraguirre
See the 4th example in ?ehplot in the plotrix package: ehplot(iris$Petal.Length, iris$Species, offset=0.06, pch=as.numeric(iris$Species)) José José Iparraguirre Chief Economist Age UK T 020 303 31482 E jose.iparragui...@ageuk.org.uk Twitter @jose.iparraguirre@ageuk Tavis House, 1- 6 Tavistock

[R] Estimate two parameter for exponential dist

2012-11-08 Thread Perlaza
I'm trying to estimate two parameter for a markov chain (exponential). I used maximum likelihood to do it. (fitdistr{MASS},fitdist{fitdistrplus}), but I get just one parameter. Do you have any suggestion to help me? THANKS!! -- View this message in context: http://r.789695.n4.nabble.com/Estimat

Re: [R] A panel of contour plots through a iteration process

2012-11-08 Thread Loukia Spineli
Thank you very much both of you!! Jose, I will try your suggestion (regardless its application on my "issue") to see how it works!:) You never know, Maybe, I will need to apply it sometime. As for the par and the filled.contour I know that the layout parameter thatis already incorporated in fille

Re: [R] Apply same linear model to subset of dataframe

2012-11-08 Thread David Winsemius
On Nov 8, 2012, at 4:40 AM, Ross Ahmed wrote: > There is a slight problem with the code. Due to the collapse=Œ+¹ argument, > the code only works if there are >1 predictor variables. How can I amend > code so it also works if number of predictor variable==1? > > # WORKING ­ LENGTH OF EACH SET OF

Re: [R] Calling R object from R function

2012-11-08 Thread R. Michael Weylandt
On Thu, Nov 8, 2012 at 4:57 PM, Fares Said wrote: > Hi Micheal, > > Please Can you tell me how I do that? How to do what? I wrote you a very long reply with many nouns I'll assume you mean keeping your reply on list: it's what I've done differently than you in each step of our communication

Re: [R] Calling R object from R function

2012-11-08 Thread Fares Said
Hi Michael, I dont need private help, I am not sure what do you mean by global assignment and/or lexical scoping does what you want? What I would like to have call one r object(vectx) from the function (M1) with out me using this line of code modInd <- ModelFun(Trdat=dat,Tedat=dat,mdat=dat,n

Re: [R] conditional coding question

2012-11-08 Thread Rui Barradas
Hello, Sorry, there's a mistake repeated in 3 code lines. Corrected: incorp <- rep(NA, 4408) incorp[groupinc == 5] <- 'cons' incorp[(groupinc %in% -3:-2) & (indinc < 9)] <- 'ethnat' incorp[(groupinc %in% 1:4) & (indinc > 8)] <- 'libmul' incorp[(groupinc %in% -2:-1) & (indinc > 8)] <- 'civic' H

Re: [R] sweave xtable and driver RweaveHTML

2012-11-08 Thread Yihui Xie
You can certainly generate an HTML table, but how about the rest of your Snw document? How are you going to convert them to HTML? I mean otherwise you get something like this which is not a valid HTML document: \documentclass{article} \begin{document} Sepal.Length Sepal.Width Petal.Lengt

[R] mirt vs. eRm vs. ltm vs. winsteps

2012-11-08 Thread D. Alain
Dear R-List, I tried to fit a partial credit model using the "pcmdat" from eRm-package comparing the results of mirt, eRm, ltm and winsteps. The results where quite different, though. I cannot figure out what went wrong and I do not know which result I can rely on. This is what I did in R

Re: [R] Controlling R fonts through LaTeX

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 7:00 AM, Karen Kotschy wrote: > Dear help list > > Does anybody know if it is possible to somehow tell R to let LaTeX handle > the fonts for postscript plots produced by R? > > It is for a thesis and I have MANY figures. These are created by R scripts > dynamically as the doc

[R] Extract cell of many values from dataframe cells and sample from them.

2012-11-08 Thread Benjamin Ward (ENV)
Hi, First my apologies for a non-working piece of code in a previous submission, I have corrected this error. I'm doing is individual based modelling of a pathogen and it's host. The way I've thought of doing this is with two dataframes, one of the pathogen and it's genes and effector genes, a

[R] Extracting columns

2012-11-08 Thread Silvano Cesar da Costa
Hi, I have 22 files (A1, A2, ..., A22) with different number of columns, totaling 10,000 columns: c1, c2, c3, ..., c1 I have another file with a list of 100 columns that I need to extract. These 100 columns are distributed in 22 files. How to extract the 100 columns of the 22 files? I have

Re: [R] Issues with Heat Map Images

2012-11-08 Thread cpleisner
David, Thanks for the help. I tried the following code: heatdata <- read.csv("logFC_bin17.csv", sep=",") heatdata <- heatdata[,2:5] heatdata_matrix <- data.matrix(heatdata) rownames(heatdata_matrix) = paste("Gene", 2:655) jpeg("Heatmap_bin17.jpeg", width=8, height=8, units="in", res=300, quality

[R] Formatting digits in a table with mix of numbers and characters

2012-11-08 Thread Brian Hobbs
Hello, I am currently trying to find an easy way to take a table with a mix of numbers and characters and format the numbers in the table to be constrained to 4 significant digits. Example: #this is my table creation > table <- matrix(c(12.34567, "--", 10, 12.34567, "--", "NA", "--", 123.45678,

[R] Line feed on "main" title of the plot

2012-11-08 Thread DusanP
Hello everyone, I would like to perform a line feed on the main title of the plot. How to do that? Thanks Dusan -- View this message in context: http://r.789695.n4.nabble.com/Line-feed-on-main-title-of-the-plot-tp4648884.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Stacked Barchart as relative share

2012-11-08 Thread Geophagus
It Works :-) Thank you very much! Thats my way ! Best greetings GEO -- View this message in context: http://r.789695.n4.nabble.com/Stacked-Barchart-as-relative-share-tp4648854p4648883.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Package "glmulti": Include a variable in ALL models

2012-11-08 Thread Machteld VDC
Solved! Thanx to Vincent Calcagno: /Dear Machteld, In the coming 2.0 version of glmulti, there will be a more proper way to force variables in. In the current version, it has to be done ad-hoc, and you did it well. The 'formulas' only show terms that are shuffled by glmulti; the constant terms are

[R] Looping matrix multiplication

2012-11-08 Thread wilkesma
I am dealing with a number of time-series consisting of 2250 samples of flow velocity in 2D (Vx, Vy). For each time-series I have determined the resultant vector angle (d) and magnitude (Vres) based on the ensemble means of Vx and Vy and now want to rotate each point in the time-series by d so tha

Re: [R] strsplit with invalid regular expression

2012-11-08 Thread arun
HI, cond<-"andsin(log_angle_1_4)"  diff_operator<-"sin\\("  strsplit(cond,diff_operator) #[[1]] #[1] "and"    "log_angle_1_4)" A.K. - Original Message - From: Bharat Warule To: r-help@r-project.org Cc: Sent: Thursday, November 8, 2012 6:39 AM Subject: [R] strsplit with inv

Re: [R] Produce "a prism like plot"

2012-11-08 Thread DusanP
Sorry to bother you again, But I have two other questions : 1. How do I change symbols (dots) for each group? I tried : For group 1, n=5. points(x=groups[1:5],y=data[1:5],type=pch). The issue is that it doesn't select the right points, or coordinates. 2. How can I increase horizontal spacing

[R] Controlling R fonts through LaTeX

2012-11-08 Thread Karen Kotschy
Dear help list Does anybody know if it is possible to somehow tell R to let LaTeX handle the fonts for postscript plots produced by R? It is for a thesis and I have MANY figures. These are created by R scripts dynamically as the document is compiled, using the Make system. I see that I can `manua

[R] How to include CI in a grouped barplot?

2012-11-08 Thread Thais Rangel
Hello everyone! I need to include the confidence interval bar in a grouped barplot. I've found some options on the web, but none of them solved my problem. The question is: my barplot was created using vectors for each pair of bar and them combining them using cbind. I mean: a=c(10,15) b=c(20,24

Re: [R] Apply same linear model to subset of dataframe

2012-11-08 Thread Ross Ahmed
There is a slight problem with the code. Due to the collapse=Œ+¹ argument, the code only works if there are >1 predictor variables. How can I amend code so it also works if number of predictor variable==1? # WORKING ­ LENGTH OF EACH SET OF PREDICTOR >1 DV <- c("mpg", "drat", "gear") IV <- list(c

Re: [R] Calling R object from R function

2012-11-08 Thread R. Michael Weylandt
On Thu, Nov 8, 2012 at 2:44 PM, Fares Said wrote: > Hi Michael, > > you mentioned I can get help, can you give more details please. Hi Fares, I also asked that you keep our correspondance on the mailing list. Please do so. If you want private help, you can seek a local statistical consultancy, b

Re: [R] conditional coding question

2012-11-08 Thread David Winsemius
On Nov 7, 2012, at 3:07 PM, haps wrote: > I have a big dataset. I want to create a new factor variable with certain > conditions based on two existing numeric variables. > Existing variables: indinc (range: 0 to 16), groupinc (range -3 to 5) > Conditional values that 'incorp' will take: > If gro

Re: [R] A panel of contour plots through a iteration process

2012-11-08 Thread Jose Iparraguirre
Thierry's solution is such more elegant and succinct. Loukia, you'd better forget about the multiplot() function for this... José -Original Message- From: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be] Sent: 08 November 2012 16:12 To: Jose Iparraguirre; Loukia Spineli; r-help@r-pr

Re: [R] A panel of contour plots through a iteration process

2012-11-08 Thread ONKELINX, Thierry
I would rather use facet_wrap() instead of multiplot() Just combine all your data in one data.frame and make sure that you have a variable indication the iteration. library(reshape2) volcano3d <- melt(volcano) names(volcano3d) = c("x", "y", "z") volcano3d <- merge(volcano3d, data.frame(Iteration

Re: [R] A panel of contour plots through a iteration process

2012-11-08 Thread Jose Iparraguirre
Hi Loukia, I think the problem stems from the fact that the filled.contour "uses the layout function and so is restricted to a full page display" as its documentation reads. And if you look at the documentation of the layout function, it says that it is "totally incompatible with the other mech

Re: [R] Absolute path in gdata library

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 9:33 AM, Prof Brian Ripley wrote: > On 08/11/2012 15:28, Marc Schwartz wrote: >> >> On Nov 8, 2012, at 12:57 AM, Prof Brian Ripley wrote: >> >>> On 07/11/2012 23:12, Marc Schwartz wrote: On Nov 7, 2012, at 4:58 PM, r wrote: > Dear list, I have some .xls file

Re: [R] Executing SAS Codes in R

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 9:09 AM, Peter Maclean wrote: > The answer I got from my previous questions suggeted how to read SAS data > into R. That was not the question. I want to execute/evaluate SAS code inside > R environment. I have SAS data and SAS codes but I have no access to SAS > software. In

Re: [R] Absolute path in gdata library

2012-11-08 Thread Prof Brian Ripley
On 08/11/2012 15:28, Marc Schwartz wrote: On Nov 8, 2012, at 12:57 AM, Prof Brian Ripley wrote: On 07/11/2012 23:12, Marc Schwartz wrote: On Nov 7, 2012, at 4:58 PM, r wrote: Dear list, I have some .xls files that I need to read into R. I am able to do so using read.xls in the gdata packa

Re: [R] Absolute path in gdata library

2012-11-08 Thread Marc Schwartz
On Nov 8, 2012, at 12:57 AM, Prof Brian Ripley wrote: > On 07/11/2012 23:12, Marc Schwartz wrote: >> On Nov 7, 2012, at 4:58 PM, r wrote: >> >>> Dear list, I have some .xls files that I need to read into R. I am >>> able to do so using read.xls in the gdata package, however the >>> helper func

Re: [R] Executing SAS Codes in R

2012-11-08 Thread John Kane
Perhaps http://www.statmethods.net/ or google for "R for SAS and SPSS users" John Kane Kingston ON Canada > -Original Message- > From: pmaclean2...@yahoo.com > Sent: Thu, 8 Nov 2012 07:09:39 -0800 (PST) > To: r-help@r-project.org > Subject: Re: [R] Executing SAS Codes in R > > The answ

Re: [R] Accessing selected elements of a list

2012-11-08 Thread arun
Hi, You can also use: jlist[unlist(lapply(jlist,length))>0] #[[1]] #[1] 1 0 #[[2]] #[1] 1 2 3 A.K. From: Gonçalo Ferraz To: arun Sent: Thursday, November 8, 2012 9:59 AM Subject: Re: [R] Accessing selected elements of a list Thanks! I think one quick soluti

Re: [R] map two names into one

2012-11-08 Thread arun
Hi, After thinking about this for some other situations, I think this function will be more suitable. fun2<-function(x){ res1<-toupper(x) res2<- gsub("^\\s+|\\s+$","",paste0(sort(unlist(strsplit(res1,""))),collapse="")) res2} vec6<-"Glaxy ace S 5830"  vec7<-"S 5830 Glaxy ace" vec1<-"Iphone 4S 16

  1   2   >