Re: [R] abline outside of plot region

2011-04-29 Thread Rolf Turner
On 30/04/11 01:14, Nick Sabbe wrote: Hi R people. I ran into this problem: I created a plot with errbars, like this: errbar(x=c(1,2,3,4), y=c(2,1,3,3), yminus=c(1.5,0.5,2.5,2.5), yplus=c(2.5,1.5,3.5,3.5)) Next, I wanted to accentuate some x value with an abline, like this: abline(v=2)

Re: [R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Miao
That works like a charm! Thanks so much Duncan. On Fri, Apr 29, 2011 at 6:37 PM, Duncan Murdoch wrote: > On 29/04/2011 9:34 PM, Miao wrote: > >> Thanks Duncan for clarifying this. I'm pretty a newbie to such type of >> characters and special characters. In R's gsub() what regular >> expression

Re: [R] Best Practices for submitting packages to CRAN

2011-04-29 Thread Spencer Graves
Two additions to Michael Friendly's comments: 1. Have you considered putting your package on R-Forge (r-forge.r-project.org)? They have a facility (which has been broken for several months now but will likely be fixed again at some time in the future) to test your package more or less

Re: [R] Best Practices for submitting packages to CRAN

2011-04-29 Thread Michael Friendly
On 4/28/2011 8:43 AM, Singmann wrote: Dear all, I (and a colleague) have been working on our first package (for fitting a certain type of cognitive models: http://www.psychologie.uni-freiburg.de/Members/singmann/R/mptinr) for quite a while now and have the feeling, that it is "good to go". That

Re: [R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Mike Miller
On Fri, 29 Apr 2011, Duncan Murdoch wrote: On 29/04/2011 7:41 PM, Miao wrote: Can anyone help on gsub() in R? I have a string like something below, and wanted to delete all the strings with leading backslash, including "\xa0On", "\023, "\xab", and many others. How should I write a regular

Re: [R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Duncan Murdoch
On 29/04/2011 9:34 PM, Miao wrote: Thanks Duncan for clarifying this. I'm pretty a newbie to such type of characters and special characters. In R's gsub() what regular expressions shall I use to handle all these situations? I don't know. This might work: gsub("[\x01-\x1f\x7f-\xff]", "", x)

Re: [R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Miao
Thanks Duncan for clarifying this. I'm pretty a newbie to such type of characters and special characters. In R's gsub() what regular expressions shall I use to handle all these situations? On Fri, Apr 29, 2011 at 6:07 PM, Duncan Murdoch wrote: > On 29/04/2011 7:41 PM, Miao wrote: > >> Hello, >

Re: [R] threshold matrix

2011-04-29 Thread Rolf Turner
On 30/04/11 02:44, Alaios wrote: Thanks a lot. I finally used M2<- M M2[M< thresh]<- 0 M2[M>= thresh]<- 1 as I noticed that this one line M2<- as.numeric( M[]< thresh ) vectorizes my matrix. One more question I have two matrices that only differ slightly. What will be the easiest way to co

Re: [R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Duncan Murdoch
On 29/04/2011 7:41 PM, Miao wrote: Hello, Can anyone help on gsub() in R? I have a string like something below, and wanted to delete all the strings with leading backslash, including "\xa0On", "\023, "\xab", and many others. How should I write a regular expression pattern in gsub()? I don't

Re: [R] Analysis and graphics by groups

2011-04-29 Thread Bilonick, Richard A
Unless I misunderstand, I think you might want the nlsList function from the nlme package. It will let you fit a nonlinear model for grouped data. You use "|" to separate the model formula from the grouping factor. Rick From: r-help-boun...@r-project.org

Re: [R] For loop and sqldf

2011-04-29 Thread Jeff Newmiller
Putting SQL columns/variables into square brackets is valid syntax for sqlite. Expecting sqlite to share variables with R is not, so there was only one necessary change. --- Jeff Newmiller The . . Go Live... DCN: Basi

Re: [R] Analysis and graphics by groups

2011-04-29 Thread Andrew Robinson
hi Christiano, the error is that FUN is not a function. That is true, the argument that you are passing to FUN is a different class. Instead of fx, for example, where fx is your model code below, try to write it as a function of the arguments that you want to split by Cerca. You might try to con

[R] regular expression in gsub() for strings with leading backslash

2011-04-29 Thread Miao
Hello, Can anyone help on gsub() in R? I have a string like something below, and wanted to delete all the strings with leading backslash, including "\xa0On", "\023, "\xab", and many others. How should I write a regular expression pattern in gsub()? I don't care how many characters following ba

Re: [R] For loop and sqldf

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 4:27 PM, mathijsdevaan wrote: Hi list, Can anyone tell my why the following does not work? Thanks a lot! Your help is very much appreciated. DF = data.frame(read.table(textConnection("B C D E F G 8025 1995 0 4 1 2 8025 1997 1 1 3 4 8026 1995 0 7 0

Re: [R] Use nparcomp function from nparcomp library to run post hoc

2011-04-29 Thread Jun Shen
Hi, Dennis, Thanks for the reply. I tried to upgrade to R 2.13.0. Then when I tried to load the library(nparcomp), I got an error Error: package 'mvtnorm' is not installed for 'arch=i386' What does that mean? Thanks. Jun On Fri, Apr 29, 2011 at 5:49 PM, Dennis Murphy wrote: > Hi: > > Is this

Re: [R] Use nparcomp function from nparcomp library to run post hoc

2011-04-29 Thread Dennis Murphy
Hi: Is this the function nparcomp() in the nparcomp package or the one from the mutoss package? When using functions from packages, it is useful to indicate the package name. I'm assuming you're using the nparcomp package, because your code worked for me when that package was loaded: > library(np

Re: [R] RCurl and postForm()

2011-04-29 Thread Duncan Temple Lang
Hi Ryan postForm() is using a different style (or specifically Content-Type) of submitting the form than the curl -d command. Switching the style = 'POST' uses the same type, but at a quick guess, the parameter name 'a' is causing confusion and the result is the empty JSON array - "[]". A qui

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread Duncan Temple Lang
Hi Tal You can add ssl.verifypeer = FALSE in the .opts list so that the certificate is simply accepted. Alternatively, you can tell libcurl where to find the certification authority file containing signatures. This can be done via the cainfo option, e.g. cainfo = system.file("CurlSSL", "c

Re: [R] For loop and sqldf

2011-04-29 Thread Dennis Murphy
Hi: Try split(DF, DF$C) Does that work? Dennis On Fri, Apr 29, 2011 at 1:27 PM, mathijsdevaan wrote: > Hi list, > > Can anyone tell my why the following does not work? Thanks a lot! Your help > is very much appreciated. > > DF = data.frame(read.table(textConnection("    B  C  D  E  F  G > 802

[R] Use nparcomp function from nparcomp library to run post hoc

2011-04-29 Thread Jun Shen
Dear list, I tried to use the nparcomp to run some post hoc non-parametric comparison and got and error. Error in uniroot(pfct, interval = interval) : f() values at end points not of opposite sign Appreciate any comments. the command line: >nparcomp(Ulceration~Group,data=test,type='Dunnett'

Re: [R] setting options only inside functions

2011-04-29 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of > luke-tier...@uiowa.edu > Sent: Friday, April 29, 2011 9:35 AM > To: Jonathan Daily > Cc: r-help@r-project.org; Hadley Wickham; Barry Rowlingson > Subject: Re: [R] setting optio

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread Tal Galili
Hello Duncan, Thank you for having a look at this. I tried the code you provided but it failed in the getForm stage. running this: > tt = getForm("http://spreadsheets0.google.com/spreadsheet/pub";, + hl ="en", key = "0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE", + sing

[R] strange fluctuations in system.time with kernapply

2011-04-29 Thread Alexander Senger
Hello expeRts, here is something which strikes me as kind of odd and I would like to ask for some enlightenment: First let's do this: tkern <- kernel("modified.daniell", c(5,5)) test <- rep(1,100) system.time(kernapply(test,tkern)) User System verstrichen 1.100 0.0

Re: [R] Kolmogorov-Smirnov test

2011-04-29 Thread Greg Snow
The general idea of the KS test (and others) can be applied to discrete data, but the implementation in R assumes continuous data (does not have the needed adjustments to deal with ties). The chi-square and other tests suffer from the same problems in your case. In all cases the null hypothesi

Re: [R] fisher exact for > 2x2 table

2011-04-29 Thread Jeremy Miles
On 29 April 2011 08:43, viostorm wrote: > > After I shared comments form the forum yesterday with the biostatistician he > indicated this: > > "Fisher's exact test is the non-parametric analog for the Chi-square > test for 2x2 comparisons. A version (or extension) of the Fisher's Exact > test, kno

Re: [R] fisher exact for > 2x2 table

2011-04-29 Thread Mike Miller
Rob-- Your biostatistician has not disagreed with the rest of us about anything except for his preferred name for the test. He wants to call it the Freeman-Halton test, some people call it the Fisher-Freeman-Halton test, but most people call it the Fisher Exact test -- all are the same test.

Re: [R] Conditonal Rank

2011-04-29 Thread Dennis Murphy
Hi: Does this work? library(plyr) ddply(tmp, .(trial, Gender), transform, rankscore = rank(score)) score trial Gender rankscore 1 1 1 M 1 2 2 1 M 2 3 3 1 F 1 4 4 1 F 2 5 4 2 M 2 6 3

Re: [R] Problem with qualitative variables in anova

2011-04-29 Thread katerinaaa
Yes, I wrote also in the other forum because here I didn't take an answer. Thanks for your reply -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-qualitative-variables-in-anova-tp3483845p3484599.html Sent from the R help mailing list archive at Nabble.com. _

[R] --mem-vsize in R

2011-04-29 Thread kparamas
Hi, I am calculation pairwise correlation coefficient for a matrix of 234 X 3. I am getting the following error, Error in cbind(as.vector(row(cl)), as.vector(col(cl)), as.vector(cl)) : allocMatrix: too many elements specified In addition: There were 50 or more warnings (use warnings() to se

[R] For loop and sqldf

2011-04-29 Thread mathijsdevaan
Hi list, Can anyone tell my why the following does not work? Thanks a lot! Your help is very much appreciated. DF = data.frame(read.table(textConnection("B C D E F G 8025 1995 0 4 1 2 8025 1997 1 1 3 4 8026 1995 0 7 0 0 8026 1996 1 2 3 0 8026 1997 1 2 3 1 8026 1

Re: [R] fisher exact for > 2x2 table

2011-04-29 Thread Brian S Cade
Rob: Fisher's exact test is conceptually possible for any r x c contingency table problem and uses the observed multinomial table probability as the test statistic. Other tests for r x c contingency tables use a different test statistic (Chi-squared, likelihood ratio, Zelterman's). It is p

Re: [R] Speed up code with for() loop

2011-04-29 Thread hck
Barth sent me a very good code and I modified it a bit. Have a look: Error<-rnorm(1000, mean=0, sd=0.05) estimate<-(log(1+0.10)+Error) DCF_korrigiert<-(1/(exp(1/(exp(0.5*(-estimate)^2/(0.05^2))*sqrt(2*pi/(0.05^2 ))*(1-pnorm(0,((-estimate)/(0.05^2)),sqrt(1/(0.05^2))-1)) DCF_verzerrt<-(1/(e

Re: [R] Problem with qualitative variables in anova

2011-04-29 Thread David Winsemius
Are you working on the same homework problem as user494766? http://stackoverflow.com/questions/5835605/1-way-anova-in-r-help -- David. On Apr 29, 2011, at 10:43 AM, katerinaaa wrote: Hi, I am newbie in R programming and I need some help. I have two columns the first has 1000 values Y/N/U

Re: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8

2011-04-29 Thread Mike Miller
On Fri, 29 Apr 2011, David Winsemius wrote: On Apr 29, 2011, at 1:29 PM, Mike Miller wrote: On Fri, 29 Apr 2011, Giovanni Petris wrote: Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke... Well, he is a lot better with E

Re: [R] Using Java methods in R

2011-04-29 Thread Robert Baer
-- snip -- It clogs up my email, takes a long time to delete, and is hard to be selective enough to not delete some of my other important email. -- snip -- If you don't care about contributing to the R listserve community, it's hard to imagine why that community should care about you. Some p

[R] Bigining with a Program of SVR

2011-04-29 Thread ypriverol
Hi: I'm starting a research of Support Vector Regression. I want to obtain a model to predict a property A with a set of property B, C, D, ... This problem is very common for example in QSAR models. I want to know some examples and package that could help me in this way. I know about caret

[R] using R in C#

2011-04-29 Thread Lodha, Akhil
Hi, I've been able to use R in C# on my machine by following the steps on the http://www.codeproject.com/KB/cs/RtoCSharp.aspx. This works locally, i.e. if R is running on my box. I was wondering if its possible to change it so that I can connect to another machine that is running R (and has rs

[R] RCurl and postForm()

2011-04-29 Thread Elmore, Ryan
Hi everybody, I think that I am missing something fundamental in how strings are passed from a postForm() call in R to the curl or libcurl functions underneath. For example, I can do the following using curl from the command line: $ curl -d "Archbishop Huxley" "http://www.datasciencetoolkit.or

Re: [R] Analysis and graphics by groups

2011-04-29 Thread Cristiano Yuji Sasada Sato
Hello, This is my first post in this e-mail list and I hope it's enough to justify calling for help. In case it's not, sorry. I'm trying to do analysis and graphics using a factor as a criteria to split data and do the analysis/graphics for each subset of data. Right now what I'm trying to do is

Re: [R] using lme4 with three nested random effects

2011-04-29 Thread Benjamin Caldwell
Thierry, The first suggestion worked. Thank you very much. *Ben Caldwell* University of California, Berkeley 137 Mulford Hall #3114 Berkeley, CA 94720 Office 223 Mulford Hall (510)859-3358 On Fri, Apr 29, 2011 at 1:52 AM, ONKELINX, Thierry wrote: > Dear Ben, > > Are site, transect and plot fa

[R] Conditonal Rank

2011-04-29 Thread Doran, Harold
Suppose I have data such as tmp <- data.frame(score = c(1,2,3,4, 4,3,2,1), trial = gl(2,4), Gender = gl(2,2,8, labels=c('M', 'F'))) Now I would like to compute a rank on the variable score conditional on trial and gender. I could do res <- with(tmp, tapply(score, list(Gender, trial), rank)) re

Re: [R] Regression Summary for a List

2011-04-29 Thread Phil Spector
Ryan - summary expects an lm object, and fit is a list. So you need to use something like lapply(fit,summary) to pass each list element to the summary function. - Phil Spector Statistical Computing Facility

Re: [R] Convert filogenetic tree to binary matrix

2011-04-29 Thread vanderlei52
Hi Ben, Thank you for your help. I did the same question in the r-sig-phylo mailing list. Liam Revell gave the following solution: temp<-prop.part(tree) X<-matrix(0,nrow=length(tree$tip),ncol=length(temp),dimnames=list(tree$tip.label,tree$node.label)) for(i in 1:ncol(X)) X[temp[[i]],i]<-1 Vand

Re: [R] fisher exact for > 2x2 table

2011-04-29 Thread viostorm
After I shared comments form the forum yesterday with the biostatistician he indicated this: "Fisher's exact test is the non-parametric analog for the Chi-square test for 2x2 comparisons. A version (or extension) of the Fisher's Exact test, known as the Freeman-Halton test applies to comparison

[R] importing and filtering time series data

2011-04-29 Thread Joel Reymont
Folks, I'm new to R and would like to use it to analyze web server performance data. I collect the data in this CSV format: 1304083104.41,Y,668.856249809 1304083104.41,Y,348.143193007 First column is a timestamp, rows with N instead of Y need to be skipped and the last column has the same fo

Re: [R] Questions about lrm, validate, pentrace

2011-04-29 Thread khosoda
(11/04/29 22:09), Frank Harrell wrote: Yes I would select that as the final model. Thank you for your comment. I am able to be confident about my model now. The difference you saw is caused by different treatment of penalization of factor variables, related to the use of the sum squared diffe

[R] Problem with qualitative variables in anova

2011-04-29 Thread katerinaaa
Hi, I am newbie in R programming and I need some help. I have two columns the first has 1000 values Y/N/U and the other has f/m. Like that : q7 sex == Um U f Um Nf I want to do one way anova parametric and no parametric. But I have some problems. Code: frameq7 <- data.fram

[R] Trying to get RWeka/Snowball to work

2011-04-29 Thread Peter Holme
Hi! I was trying to install RWeka to be able to use SnowballStemmer in a Mac OS X 10.6.7 environment... but coudn't do it... I get error messages after: > library(RWeka); > install(Snowball); > ## Test the supplied vocabulary for the default stemmer ('porter'): > source <- readLines(system.file("

[R] Regression Summary for a List

2011-04-29 Thread Ryan J. McGuigan
Hi, I am trying to run a regression on two matrices with 10 columns. I have been able to run the regression with the following code: fit=list() for(i in 1:10) { fit[[i]]=lm(monret[,i]~janret[,i]) } However, I can't get the regression to spit out more than the coefficients (summary(fit) does not

Re: [R] replace non numeric with "NA"

2011-04-29 Thread Nandini B
Thanks a lot Duncan, this is what I was looking for!!Thank you,Nandini > Date: Fri, 29 Apr 2011 09:53:06 -0400 > From: murdoch.dun...@gmail.com > To: nandini...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] replace non numeric with "NA" > > On 29/04/2011 6:45 AM, Nandini B wrote:

[R] logistic regression with glm: cooks distance and dfbetas are different compared to SPSS output

2011-04-29 Thread Biedermann, Jürgen
Hi there, I have the problem, that I'm not able to reproduce the SPSS residual statistics (dfbeta and cook's distance) with a simple binary logistic regression model obtained in R via the glm-function. I tried the following: fit <- glm(y ~ x1 + x2 + x3, data, family=binomial) cooks.distance

[R] mlogit package, "Error in X[omitlines, ] <- NA : subscript out of bounds"

2011-04-29 Thread Yong Wang
I am using the mlogit packages and get a data problem, for which I can't find any clue from R archive. code below shows my related code all the way to the error #--- mydata <- data.frame(dependent,x,y,z) mydata$dependent<-as

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread Philipp Pagel
On Fri, Apr 29, 2011 at 06:19:24PM +0300, Tal Galili wrote: > > data_url <- " > http://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE&single=true&gid=0&output=csv > " > read.csv(data_url) > Error in file(file, "rt") : cannot open the connection

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread Duncan Temple Lang
Thanks David for fixing the early issues. The reason for the failure is that the response from the Web server is a to redirect the requester to another page, specifically https://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE&single=true&g

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Friday, April 29, 2011 10:36 AM > To: Tal Galili > Cc: r-help@r-project.org > Subject: Re: [R] read.csv fails to read a CSV file from google docs > > > O

[R] The bin/R file - hardcoded paths

2011-04-29 Thread Saptarshi Guha
Hello, I notice that e.g /home/sguha/lib64 is hard coded into the /bin/R file . I nstalled R as ./configure --prefix=$HOME ... What i need to do is ship the entire R distribution to remote nodes, and run R. These are shipped to ephemeral directories so I dont know the path ahead of time. R_HOME

Re: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 1:29 PM, Mike Miller wrote: On Fri, 29 Apr 2011, Giovanni Petris wrote: Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke... Well, he is a lot better with English than I am with Mandarin. He seemed

Re: [R] sub-matrix block size

2011-04-29 Thread Santosh
Dear Rxperts, Can "Jordan decomposition" of submatrices be useful to determine size of sub blocks? "http://en.wikipedia.org/wiki/Jordan_normal_form";.. Thanks for the ideas/suggestions. . I have another similar situation, where at least one of the off diagonal elements of the lower triangle subma

Re: [R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 11:19 AM, Tal Galili wrote: Hello all, I wish to use read.csv to read a google doc spreadsheet. I try using the following code: data_url <- " http://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE&single=true&gid=0&outp

Re: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8

2011-04-29 Thread Mike Miller
On Fri, 29 Apr 2011, Giovanni Petris wrote: Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke... Well, he is a lot better with English than I am with Mandarin. He seemed to like the truncated normal answers, so we'll let t

Re: [R] setting options only inside functions

2011-04-29 Thread Jonathan Daily
In python, opening a connection using with allows for a temporary assignment using "as". So: with file("/path/to/file") as con: permanent_object = function(con) would provide the return of function(con) globally, but close con. If function(con) causes an error, con is still closed. I agree w

Re: [R] threshold matrix

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 10:44 AM, Alaios wrote: Thanks a lot. I finally used M2 <- M M2[M < thresh] <- 0 M2[M >= thresh] <- 1 as I noticed that this one line M2 <- as.numeric( M[] < thresh ) vectorizes my matrix. One more question I have two matrices that only differ slightly. What will be th

Re: [R] setting options only inside functions

2011-04-29 Thread luke-tierney
The Python solution does not extend, at least not cleanly, to things like dev on/ dev off or to Hadley's locale example. In any case if I am reading the Python source correctly on how they handle user interrupts this solution has the same non-robusness to user interrupts issue that Bill's initial

Re: [R] replace non numeric with "NA"

2011-04-29 Thread Nandini B
Thanks a lot Jim, this is perfect!! Thank you, Nandini Badarinarayan > Date: Fri, 29 Apr 2011 09:49:26 -0400 > From: jmac...@med.umich.edu > To: nandini...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] replace non numeric with "NA" > > Hi Nandini, > > On 4/29/2011 6:45 AM, Nandi

[R] read.csv fails to read a CSV file from google docs

2011-04-29 Thread Tal Galili
Hello all, I wish to use read.csv to read a google doc spreadsheet. I try using the following code: data_url <- " http://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE&single=true&gid=0&output=csv " read.csv(data_url) Which results in the fo

Re: [R] Still confused about classes

2011-04-29 Thread Russ Abbott
Thanks, to all. I didn't know about either *methods( ) *or the package * lubridate*, which seems like a very nice *Date *package. *-- Russ * On Fri, Apr 29, 2011 at 1:35 AM, Kenn Konstabel wrote: > The function for getting the year from date is there in package > lubridate (as well as many o

[R] Specify custom par(mfrow()) layout for defined plot()

2011-04-29 Thread Michael Bach
Dear R Users, I am doing stats::decompose() on 4 different time series. When I issue csdA <- decompose(tsA) plot(csdA) I get a summary plot for observed, trend, seasonal and random components of decomposed time series tsA. As I understand it, the object returned by decompose() has it's own plo

Re: [R] threshold matrix

2011-04-29 Thread Petr Savicky
On Fri, Apr 29, 2011 at 07:44:59AM -0700, Alaios wrote: > Thanks a lot. > I finally used > > M2 <- M > M2[M < thresh] <- 0 > M2[M >= thresh] <- 1 > > as I noticed that this one line > > M2 <- as.numeric( M[] < thresh ) > vectorizes my matrix. Hi. This may be avoided, for example M2 <- M M

Re: [R] Using Java methods in R

2011-04-29 Thread hill0093
H do I obtain a strictly rectangular type-double array (converted to an R 2-dimensional array) from a Java class? I can obtain a 1-dimensional type-double array (vector) or a scalar, but I cannot figure out the two-dimensional from the instructions. Is .jevalArray also involved? My simple Java te

Re: [R] threshold matrix

2011-04-29 Thread Alaios
Thanks a lot. I finally used M2 <- M M2[M < thresh] <- 0 M2[M >= thresh] <- 1 as I noticed that this one line M2 <- as.numeric( M[] < thresh ) vectorizes my matrix. One more question I have two matrices that only differ slightly. What will be the easiest way to compare and find the cells that

Re: [R] how to generate a normal distribution with mean=1, min=0.2, max=0.8

2011-04-29 Thread Giovanni Petris
Well, but the original poster also refers to 0.2 and 0.8 as "expected min and max", in which case we are back to a joke... Giovanni On Thu, 2011-04-28 at 13:06 -0400, David Winsemius wrote: > On Apr 28, 2011, at 12:09 PM, Ravi Varadhan wrote: > > > Surely you must be joking, Mr. Jianfeng. > >

Re: [R] matrix evaluation using if function

2011-04-29 Thread Berend Hasselman
David Winsemius wrote: > > On Apr 29, 2011, at 4:27 AM, ivan wrote: > >> Hi All, >> >> I am trying to create a function which evaluates whether the values >> (which >> are equal to one) of a matrix are the same as their mirror values. >> Consider >> the following matrix: >> >>> n<-matrix(cbi

Re: [R] threshold matrix

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 9:37 AM, Alaios wrote: Dear all, I have a quite big matrix which I would like to threshold. If the value is below threshold the cell should be zero and if the value is over threshold the cell should be one M2 <- M M2[M < thresh] <- 0 M2[M >= thresh] <- 1 or perhaps simply

Re: [R] abline outside of plot region

2011-04-29 Thread Peter Ehlers
On 2011-04-29 06:14, Nick Sabbe wrote: Hi R people. I ran into this problem: I created a plot with errbars, like this: errbar(x=c(1,2,3,4), y=c(2,1,3,3), yminus=c(1.5,0.5,2.5,2.5), yplus=c(2.5,1.5,3.5,3.5)) Next, I wanted to accentuate some x value with an abline, like this: abline(v=2)

Re: [R] Speed up plotting to MSWindows graphics window

2011-04-29 Thread jim holtman
If you are plotting that many data points, you might want to look at 'hexbin' as a way of aggregating the values to a different presentation. It is especially nice if you are doing a scatter plot with a lot of data points and trying to make sense out of it. On Wed, Apr 27, 2011 at 5:16 AM, Jonat

Re: [R] replace non numeric with "NA"

2011-04-29 Thread Duncan Murdoch
On 29/04/2011 6:45 AM, Nandini B wrote: Hello, I have a sample data frame which looks like this day od month 1 1 0.12 2 3 #VALUE! 1 3 5 0.4 12 4 7 0.8 10 5 11 - 3 6 14 s 7 7 18

Re: [R] 3-way contingency table

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 6:47 AM, Mathias Walter wrote: Hi, I have large data frame with many columns. A short example is given below: dataH host ms01 ms31 ms33 ms34 1 cattle4 2096 2 sheep4345 3 cattle4345 4 cattle4345 5

Re: [R] replace non numeric with "NA"

2011-04-29 Thread James W. MacDonald
Hi Nandini, On 4/29/2011 6:45 AM, Nandini B wrote: Hello, I have a sample data frame which looks like this day od month 1 1 0.12 2 3 #VALUE! 1 3 5 0.4 12 4 7 0.8 10 5 11 - 3 6 14 s

[R] threshold matrix

2011-04-29 Thread Alaios
Dear all, I have a quite big matrix which I would like to threshold. If the value is below threshold the cell should be zero and if the value is over threshold the cell should be one One really simple way to do that is two have a nested loop and check cell by cell. The problem is that this seem

Re: [R] Questions about lrm, validate, pentrace

2011-04-29 Thread Frank Harrell
Yes I would select that as the final model. The difference you saw is caused by different treatment of penalization of factor variables, related to the use of the sum squared differences between the estimate at one category from the average over all categories. I think that as long as you code it

Re: [R] How to define specially nested functions

2011-04-29 Thread Chee Chen
Hi, Jerome and Phil, Thank you for your solutions and I have studied carefully your codes but I have further questions (since I guess the simple lines of codes may not do the real job I am going to describe to you. Please forgive me for my shallowness!) I guess I over-simplified my question, ba

Re: [R] Problem installing package "sp" in R 2.13.0

2011-04-29 Thread Roger Bivand
The rgdal package is not a dependency of sp, only suggested. In addition, you are trying to install source packages, but should (probably) be installing binaries, with type="mac.binary.leopard" the most likely. If you need the OSX rgdal binary, make sure that CRAN extras is on your repository path

[R] replace non numeric with "NA"

2011-04-29 Thread Nandini B
Hello, I have a sample data frame which looks like this day od month 1 1 0.12 2 3 #VALUE! 1 3 5 0.4 12 4 7 0.8 10 5 11 - 3 6 14 s 7 7 18 -- 12 8 27 19

[R] Plot multiple ctrees in the same figure

2011-04-29 Thread tudor
Dear all: Is there a way one could plot two conditional inference trees (party package, ctree) in a figure specified by layout? My attempts failed as plot.party seemed to take over the layout functionality and forced a single ctree plot to be displayed. A brief (non reproducible) example togethe

Re: [R] Change the text size of the title in a legend of a R plot.

2011-04-29 Thread Victor Gabillon
thanks everyone for the help. I ended up copying and pasting the legend function from the R source files. I changed it so that the title.cex is not set by default to cex and so that this title.cex can be given as a parameter. It works fine for me. Note that if you make the title too big it goe

[R] question of VECM restricted regression

2011-04-29 Thread Meilan Yan
Dear Colleague I am trying to figure out how to use R to do OLS restricted VECM regression. However, there are some notation I cannot understand. Please tell me what is 'ect', 'sd' and 'LRM.dl1 in the following practice: #OLS retricted VECM regression data(denmark) sjd <- denmark[, c("LRM",

[R] 3-way contingency table

2011-04-29 Thread Mathias Walter
Hi, I have large data frame with many columns. A short example is given below: > dataH host ms01 ms31 ms33 ms34 1 cattle4 2096 2 sheep4345 3 cattle4345 4 cattle4345 5 sheep4355 6goat4345 7

[R] abline outside of plot region

2011-04-29 Thread Nick Sabbe
Hi R people. I ran into this problem: I created a plot with errbars, like this: > errbar(x=c(1,2,3,4), y=c(2,1,3,3), yminus=c(1.5,0.5,2.5,2.5), yplus=c(2.5,1.5,3.5,3.5)) Next, I wanted to accentuate some x value with an abline, like this: > abline(v=2) In one of my R sessions (which admi

Re: [R] Element by Element addition of the columns of a Matrix

2011-04-29 Thread Pete Brecknock
... is the apply function what you are looking for? A=matrix(1,2,4) apply(A,1,sum) HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Element-by-Element-addition-of-the-columns-of-a-Matrix-tp3483545p3483628.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Nomograms from rms' fastbw output objects

2011-04-29 Thread Frank Harrell
Hi Rob, fastbw does not try to produce a full fit object. You have to re-run the fit manually based on what you (sometimes dangerously) learn from fastbw. If I can find a way to add a 'formula' component to the fastbw result then you could do something like lrm(fastbw(fit)$formula, ...). Frank

Re: [R] plot several histograms with same y-axes scaling using hist()

2011-04-29 Thread Jim Lemon
On 04/29/2011 08:35 PM, hck wrote: Dear all Problem: hist()-function, scale = “percent” I want to generate histograms for changing underlying data. In order to make them comparable, I want to fix the y-axis (vertical-axis) to, e.g., 0%, 10%, 20%, 30% as well as to fix the spaces, too. So the y-

Re: [R] matrix evaluation using if function

2011-04-29 Thread David Winsemius
On Apr 29, 2011, at 4:27 AM, ivan wrote: Hi All, I am trying to create a function which evaluates whether the values (which are equal to one) of a matrix are the same as their mirror values. Consider the following matrix: n<-matrix(cbind(c(0,1,1),c(1,0,0),c(0,1,0)),3,3) colnames(n)<-cbi

Re: [R] Reference variables by string in for loop

2011-04-29 Thread Michael Bach
Kenn Konstabel writes: > Another way (not elegant but better and shorter than the eval-parse > way) is to use get. ?get This one is handy for interactive use, thanks for the hint. Kind Regards, Michael Bach __ R-help@r-project.org mailing list https:

Re: [R] Reference variables by string in for loop

2011-04-29 Thread Michael Bach
"Nick Sabbe" writes: > ObjectsOfInterest<- list(one_df, two_df, three_df) > for(namedf in ObjectsOfInterest){...} I see. This is also more readable and traceable for others. > or probably even better > sapply(ObjectsOfInterest, function(namedf){...}) I like this one for its functional style.

Re: [R] Putting x-axis in opposite order

2011-04-29 Thread Jim Lemon
On 04/29/2011 04:09 AM, Bogaso Christofer wrote: Hi all, please consider this plot: xx<- seq(4, 0.01, by = -0.04) yy<- rnorm(xx) plot(xx, yy, type="l") Here you see my original 'xx' was in decreasing order, however R puts it in the increasing order. I understand that in any plot x and y a

Re: [R] plot several histograms with same y-axes scaling using hist()

2011-04-29 Thread hck
Thanks for the note: Indeed, the function is the hist() function not Hist() with capital letter. I use the standard R hist()-function with the lower case only. Nevertheless, the ylim does not work as supposed to. -- View this message in context: http://r.789695.n4.nabble.com/plot-several-histog

Re: [R] plot several histograms with same y-axes scaling using hist()

2011-04-29 Thread Philipp Pagel
On Fri, Apr 29, 2011 at 03:35:41AM -0700, hck wrote: > Problem: hist()-function, scale = “percent” [...] > ="Hist(na.exclude("&AA3&"), breaks=50, col=""seashell3"", > scale=""percent"",xlim=c(-1, 1), xlab=""Bewertungsfehler"", > ylab=""Haeufigkeit (in %)"", main=""KBV"", border=""white"")" Before

[R] Summer student internship placement at University of York / YCCSA / SEI (paid)

2011-04-29 Thread Corrado Topi
Dear R-lings, I did not know which list to post to, because it is a studentship so not really a job, so it did not fit the r-sig-jobs list and it is about devloping an extension package interfaced with R I hope I did not upset anyone. If so apologies. The Centre For Complex systems A

[R] is there a way/library for generating colorful noise in R ??

2011-04-29 Thread Ubuntu Diego
I would like to generate some noisy time series. I know that it is possible to "classify" noise by looking at the exponent (beta) of the relationship between the spectrum of the time series and the frequencies (i.e. spectrum ~ frequency ^ beta ). Is there a way to generate White (beta=0), Pink

Re: [R] Reference variables by string in for loop

2011-04-29 Thread Nick Sabbe
Hi Michael. This is a classic :-) ObjectsOfInterest<- list(one_df, two_df, three_df) for(namedf in ObjectsOfInterest){...} or probably even better sapply(ObjectsOfInterest, function(namedf){...}) hth. Nick Sabbe -- ping: nick.sa...@ugent.be link: http://biomath.ugent.be wink: A1.056, Coupure L

  1   2   >