Re: [R] data.frame(1)*1:4 = 1?

2014-04-02 Thread fabian
This is because your vector is recycled: data.frame(1)*1:4 = data.frame(1)*c(1,2,3,4) only the first element is needed since the data frame has nothing else to multiply with c(2,3,4) (x<-data.frame(1:2, 3:4)) X1.2 X3.4 113 224 (y<-x*5:7) y[1,1] = x[1,1] * 5 y[2,1] = x[2,1

[R] data.frame(1)*1:4 = 1?

2014-04-02 Thread Spencer Graves
Hello, All: What's the logic behind "data.frame(1)*1:4" producing a scalar 1? Or the following: data.frame(1:2, 3:4)*5:7 X1.2 X3.4 15 21 2 12 20 I stumbled over this, because I thought I was multiplying a scalar times a vector, and obtaining a scalar rather than

[R] figure margins too large

2014-04-02 Thread 张以春
Dear R experts, I tried to plot some figures in R using postscript(), but it always shows that the fugures margin is too large. I don't know how to change it. The following is my example: > postscript("All.eps",width=3.27,height=1.416,pointsize=12,family="Arial") >par(mar=c(5.1,4.5,4.1,2.1));

Re: [R] 'rms' package error

2014-04-02 Thread Pascal Oettli
Hello Lucy, If you carefully read, it is is not an error message, but a warning message. It tells you that for the moment, if I am not mistaken, "pphsm" does not return the correct covariance matrix, for any fitting. Regards, Pascal On Thu, Apr 3, 2014 at 11:29 AM, Lucy Leigh wrote: > Hi everyo

[R] 'rms' package error

2014-04-02 Thread Lucy Leigh
Hi everyone, I am attempting to use the R package 'rms' http://biostat.mc.vanderbilt.edu/wiki/Main/Rrms to implement a PH weibull model, using the pphsm() function. However, I get the following error, f.ph <- pphsm(f) Warning message: In pphsm(f) : at present, pphsm does not return the correct c

Re: [R] Strange sprintf Behavior

2014-04-02 Thread Michael Smith
All, Apologies for the thread issue, and many thanks for the pointers to the FAQs. Thanks, M On 04/02/2014 10:14 PM, Jeff Newmiller wrote: > It is poor netiquette to reply to a thread with a different subject. Please > start a new thread for a new subject. > > As for your question, see FAQ 7.3

Re: [R] -fopenmp

2014-04-02 Thread Prof Brian Ripley
On 02/04/2014 22:30, Filippo wrote: Hi everybody, just wanted to know if it is possible to use the openmp library in Fortran code to be used within R. Yes, on a supported platform. But 1) The posting guide tells you this is not the correct list for questions about compiled code. 2) 'Writin

Re: [R] plotting several columns of matrix in one graph

2014-04-02 Thread arun
HI, It is better to show a reproducible example using ?dput().  May be this helps: #vector vec1 <- seq(as.Date("2002-01-01"), as.Date("2009-12-31"),by="1 day") #Assuming that length of the vector is the same as ?nrow of matrix. set.seed(532) mat1 <- matrix(cumsum(rnorm(length(vec1)*5)),ncol=5, d

Re: [R] ggplot: add points selectively to curves

2014-04-02 Thread arun
Hi, May be this helps: gg <- ggplot(plotdat, aes(x = Age, y = Probability, color = Level)) + geom_line(size=2.5) + theme_bw() + xlim(10,80) + facet_grid(Sex ~ Treatment, # scales = "free", labeller = function(x, y) sprintf("%s = %s", x, y) ) plotdat2 <- subset(plotdat,as.character(Improved)==as

Re: [R] ggplot: add points selectively to curves

2014-04-02 Thread Michael Friendly
Thanks, Dennis Not quite. I need to have the same lines as in the original, using plotdat, but then add the points from your plotdat2 gg <- ggplot(plotdat, aes(x = Age, y = Probability, color = Level)) + geom_line(size=2.5) + theme_bw() + xlim(10,80) + #geom_point(color="black", size=

Re: [R] Subset error on atomic vectors why?

2014-04-02 Thread arun
Hi, It is not mentioned whether your dataset is a matrix of data.frame.  Also, please use ?dput() to show the dataset.  I get similar errors with matrix. MOPrice <- data.frame(Date=c("2013-12-31","2013-12-31","2013-12-31","2013-11-28"),stringsAsFactors=FALSE) subset(MOPrice, as.Date(Date,"%Y-%m-

Re: [R] Subset error on atomic vectors why?

2014-04-02 Thread David Winsemius
On Apr 2, 2014, at 3:35 PM, jcrosbie wrote: > I'm getting this error: "Error in MOPrice$Date : $ operator is invalid for > atomic vectors" > > The cost is: subset(MOPrice, > as.Date(MOPrice$Date,"%Y-%m-%d")==as.Date("2013-11-28","%Y-%m-%d")) > > The date column looks like: > "2013-12-31" "2013

Re: [R] Icelandic Characters in Mac

2014-04-02 Thread David Winsemius
On Apr 2, 2014, at 2:18 PM, Stefán Hrafn Jónsson wrote: > Dear R community > > I have few students that use Mac. When creating graphs they inform me that > when they use Icelandic characters in title or xlab they get some wrong > results. In stead of > > "fia› er sætt" they get ".a. er s.tt" per

Re: [R] Survey

2014-04-02 Thread Thomas Lumley
On Thu, Apr 3, 2014 at 2:37 AM, Leandro Marino < leandromar...@leandromarino.com.br> wrote: > Dear R-Users, > > I was using survey for the past years and now I am experiencing some > problems with scripts that was working in the past. > > We are working with big data bases so I can't put all varia

[R] Subset error on atomic vectors why?

2014-04-02 Thread jcrosbie
I'm getting this error: "Error in MOPrice$Date : $ operator is invalid for atomic vectors" The cost is: subset(MOPrice, as.Date(MOPrice$Date,"%Y-%m-%d")==as.Date("2013-11-28","%Y-%m-%d")) The date column looks like: "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" -- View

Re: [R] plotting several columns of matrix in one graph

2014-04-02 Thread arun
Hi, May be this helps: library(xts) library(xtsExtra) data(sample_matrix) plot(as.xts(sample_matrix),screens=1) #or library(zoo) plot(as.zoo(sample_matrix), plot.type="single",col=1:ncol(sample_matrix)) You may also check ?matplot A.K. Hi everyone, I have started using R and although I am us

Re: [R] R2WinBUGS "expected collection operator c" error

2014-04-02 Thread Uwe Ligges
This is probably a BUGS rather than an R problem, hence better for a BUGS mailing list. But if we should help, then we need at least the modelfile. Best, Uwe Ligges On 02.04.2014 19:10, zumacrume wrote: Hi all, I am currently in a Bayesian Modeling course and am trying to implement an analo

[R] -fopenmp

2014-04-02 Thread Filippo
Hi everybody, just wanted to know if it is possible to use the openmp library in Fortran code to be used within R. I tried this simple thing: subroutine test !$OMP parallel write(*,*) 'hello' !$OMP end parallel end subroutine test and I compiled in the following way: R CMD SHLIB test.f90 -fop

[R] Icelandic Characters in Mac

2014-04-02 Thread Stefán Hrafn Jónsson
Dear R community I have few students that use Mac. When creating graphs they inform me that when they use Icelandic characters in title or xlab they get some wrong results. In stead of "Það er sætt" they get ".a. er s.tt" period in stead of the Icelandic character. Any Icelandic Mac user that h

[R] ASA Conference on Statistical Practice - call for short courses

2014-04-02 Thread Adams, Jean
R users, The 2015 American Statistical Association Conference on Statistical Practice is currently accepting proposals for short courses and tutorials. The conference will be held February 19-21 in New Orleans, Louisiana, USA. Two R-related short courses were offered at the last conference, both

Re: [R] looping in R

2014-04-02 Thread Duncan Murdoch
On 02/04/2014, 3:15 PM, Abugri James wrote: I ran the following loop on my SNP data and got an error message as indicated I would assume that the error message is accurate: as.character(current[1, "gene_old"]) has length zero. You'll need to debug why that happened. Duncan Murdoch for (i

Re: [R] looping in R

2014-04-02 Thread Jeff Newmiller
You desperately need to read the Posting Guide (mentioned in the footer of this email) which warns you not to post in HTML format, and learn how to make a reproducible example (e.g. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). The problem lies in some

[R] looping in R

2014-04-02 Thread Abugri James
I ran the following loop on my SNP data and got an error message as indicated for (i in genenames){ + current <- fst1[which(fst1$Gene == i),] + num <- nrow(current) + fst <- max(current$fst) + position <- mean(current$pos) + nposition <- mean(current$newpos) + numhigh <- nrow(current[wh

[R] 127.0.0.1:22381/doc/html/index.html hep.start won't start

2014-04-02 Thread Christian Hoffmann
Dear All, Sorry to bother you. I narrowed my problem to the function help.start() which causes the freezing of R by mill endlessly after M-x R waiting for 127.0.0.1:22381/doc/html/index.html to load. I am using Aquamacs 3.0a (GNU Emacs 24.3.50.2)with R3.0.3, newly installed: sessionInfo()

[R] Interpreting effect of ordered categorical predictor

2014-04-02 Thread Marc Girondot
(I posted this question in http://stackoverflow.com/questions/22781965/interpreting-effect-of-ordered-categorical-predictor without answer... I try here) Thanks a lot Marc My question is very similar to this one (https://stat.ethz.ch/pipermail/r-help/2012-March/305357.html) but I fail to und

Re: [R] Removing White spaces with NA

2014-04-02 Thread arun
Hi, May be this helps: dat <- data.frame(Col1=c("A", "", "B","C", "","","D"), stringsAsFactors=FALSE) is.na(dat) <- dat=='' dat$Col1 #[1] "A" NA "B" "C" NA NA "D" A.K. Hi All, I have a table and a column with values as below Col1 A B C D I need to replace the Empty cells with the value NA as

Re: [R] CORDIF test

2014-04-02 Thread Ista Zahn
Hi Elizabeth, In addition to the helpful suggestions you have already received, I would add that for simple functions like this it can be very instructive to just look at the function definition. Loading the multilevel package and typing 'cordif' will show you function (rvalue1, rvalue2, n1, n2)

Re: [R] CORDIF test

2014-04-02 Thread Marc Schwartz
On Apr 2, 2014, at 8:09 AM, Elizabeth Caron-Gamache wrote: > Hi, > > I search on your website for a definition of the CORDIF test, but it wasn’t > successful. I’m analyzing an article that use that test and it’s not really > documented on the net. The article refers to your website, so I pre

Re: [R] CORDIF test

2014-04-02 Thread Bert Gunter
google is your friend! google "r cordif test" -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Wed, Apr 2, 2014 at 6:09 AM, Elizabeth Caron-Gamache wrot

[R] R2WinBUGS "expected collection operator c" error

2014-04-02 Thread zumacrume
Hi all, I am currently in a Bayesian Modeling course and am trying to implement an analog representation model using R, WinBUGS, and R2WinBUGS. I'm currently stuck banging my head against an "expected collection operator c" error. I am working off of a template code, and I swear I haven't moved a

[R] Help with MANOVA

2014-04-02 Thread Natalie Houghton McNair
I'm trying to run a MANOVA on shoreline habitat data. The data was collected in an odd way. For each reach of shoreline, data was collected for each habitat variable (shade, veg and IWM). Each variable was described as having a certain percentage of a particular category of the variable. For ex

[R] Insert DateTime from R into MongoDB

2014-04-02 Thread PHOULIHAN
First time poster, for forgive if I'm not following the etiquette: How does one properly insert a DateTime, from R, into mongoDB and have it recognized as a DateTime in mongoDB in lieu of being recognized as a string? I've tried a zillion things, and NOTHING works. I'm using: library('RMongo') r

[R] CORDIF test

2014-04-02 Thread Elizabeth Caron-Gamache
Hi, I search on your website for a definition of the CORDIF test, but it wasn’t successful. I’m analyzing an article that use that test and it’s not really documented on the net. The article refers to your website, so I pretend that you will be able to give me a brief explanation of this test.

[R] ggplot: add points selectively to curves

2014-04-02 Thread Michael Friendly
I'm working on an example of plotting predicted probabilities from a proportional odds model. The steps below generate a data frame, plotdat, that I want to plot with ggplot. library(MASS) data("Arthritis", package="vcd") arth.polr <- polr(Improved ~ Sex + Treatment + Age, data=Arthritis, Hess

Re: [R] Strange sprintf Behavior

2014-04-02 Thread Jeff Newmiller
It is poor netiquette to reply to a thread with a different subject. Please start a new thread for a new subject. As for your question, see FAQ 7.31. This is standard floating point numerical limitations at work. --- Jeff Ne

[R] Survey

2014-04-02 Thread Leandro Marino
Dear R-Users, I was using survey for the past years and now I am experiencing some problems with scripts that was working in the past. We are working with big data bases so I can't put all variables that I will use in the svydesign. Script working: > data(api) > dclus1<-svydesign(id=apiclus1$d

[R] gradientForest input data structure

2014-04-02 Thread Sean Porter
Dear All, Following on from my last post (randomForest warning: The response has five or fewer unique values. Are you sure you want to do regression?) which presented two problems whilst trying to conduct a gradientForest regression, the warning I got was not an issue as Andy kindly pointed out, b

Re: [R] Strange sprintf Behavior

2014-04-02 Thread Marc Schwartz
On Apr 2, 2014, at 6:32 AM, Michael Smith wrote: > All, > > I'm getting this: > >> sprintf("%.17f", 0.8) > [1] "0.80004" > > Where does the `4` at the end come from? Shouldn't it be zero at the > end? Maybe I'm missing something. Hi, First, please start a new thread when postin

[R] Strange sprintf Behavior

2014-04-02 Thread Michael Smith
All, I'm getting this: > sprintf("%.17f", 0.8) [1] "0.80004" Where does the `4` at the end come from? Shouldn't it be zero at the end? Maybe I'm missing something. > sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.ut

[R] mzR and Rcpp version bug

2014-04-02 Thread Zsurzsa Laszlo
Good morning everyone, I'm having the following error when I try to load the *mzR* libary. Does someone have a clue where to search for a solution. I tried to re-install *mzR *and *Rcpp* also, but with no effect. - > library(mzR) La

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-02 Thread peter dalgaard
On 01 Apr 2014, at 17:22 , Rui Barradas wrote: > Hello, > > One way is to use ?scale. > ...except that the sd will be less than 0.5 (not obvious at n=1e6, though). However, if you want - normal distribution - symmetry - constant marginal variance of sigma^2 - fixed sum = 0 I don't see any

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-02 Thread Frede Aakmann Tøgersen
Hi Marc I think that we could help you better if we knew in which context you need sample from a sum constrained normal distribution. However this is more a question on probability theory than on how to do it in R. The proposal so far has been linear transformation of multivariate normal distr