Re: [R] complicated IF

2014-01-23 Thread Bill
Dear Jim, I am confused by the function function(.week) Generally I have not figured it out yet and in particular, why are you using "dot" week as in .week Is there any significance to the dot? Thanks, Bill On Wed, Jan 22, 2014 at 10:48 PM, jim holtman wrote: > function(.week) [[alte

Re: [R] Help with importing scripts within the same package?

2014-01-23 Thread Jeff Newmiller
Use a separate R file that is not part of your package that includes any or all of the R files from your package using full directory path specifications for debugging. The package is for (mostly) debugged code. --- Jeff Newm

Re: [R] Help with importing scripts within the same package?

2014-01-23 Thread Charlie Xia
Ah.. I see your point. That's interesting. Thanks a lot! But still kind of annoying for debugging, as you still need to source the code from the other file. Then you need to disable that part when you install. Need to figure out an elegant way for switching? On Thu, Jan 23, 2014 at 8:08 PM, Jeff

Re: [R] Help with importing scripts within the same package?

2014-01-23 Thread Jeff Newmiller
You keep talking about "including" and "sourcing" and now "dependencies". Stop that. Don't do it, don't think that. All functions in all R files of a package are loaded together in one namespace. Your separation of functions between R files in the package source is entirely for your editing conv

[R] memory use of copies

2014-01-23 Thread Ross Boylan
[Apologies if a duplicate; we are having mail problems.] I am trying to understand the circumstances under which R makes a copy of an object, as opposed to simply referring to it. I'm talking about what goes on under the hood, not the user semantics. I'm doing things that take a lot of memory,

Re: [R] Help with importing scripts within the same package?

2014-01-23 Thread Charlie Xia
Hi Duncan, Thanks for replying. I may need to clarify. What I want is something that can let one R file in a package aware of another R file in the same package. It does happen a lot in real life, for example for organizing the functions into separate files, or just because you need to include a

[R] Safe prediction does not work for bivariate polynomial terms?

2014-01-23 Thread Xing Zhao
Hi everyone, R documents says the safe prediction is implemented, when basis functions are used, such as poly(), bs(), ns() This works for univariate basis, but fails in my bivariate polynomial setting. Can anyone explain the reason? The following is a small example. set.seed(731) x<-runif(300

Re: [R] Biology package install error

2014-01-23 Thread David Winsemius
On Jan 23, 2014, at 3:23 PM, Allison Yoshida wrote: > Hi, > > I am trying to install a package called "biology" in R version 3.0.2 on my > Macbook Pro. I get a warning message that says "package 'biology' is not > available (for R version 3.0.2)" > Upon some research it seems the package was pu

Re: [R] Help with importing scripts within the same package?

2014-01-23 Thread Duncan Murdoch
On 14-01-23 7:54 PM, Charlie Xia wrote: Hi all, I have a very quick question yet found no answers with google. Say you when you are writing a package and have R/A.r and R/B.r, if you want to load B.r in A.r, is there an obvious way to do so? That question doesn't make sense. You should think

[R] Comparing two HMMs to time series data using a Monte-Carlo method

2014-01-23 Thread Luis E. Vargas
Hi, we have some sequence data (animal vocalizations) and are wondering if someone could either confirm that our analysis strategy is sound or shoot it down (and hopefully make a recommendation for something better). We're using the *hmm.discnp R* package. For each individual, we have sequence data

[R] Help with importing scripts within the same package?

2014-01-23 Thread Charlie Xia
Hi all, I have a very quick question yet found no answers with google. Say you when you are writing a package and have R/A.r and R/B.r, if you want to load B.r in A.r, is there an obvious way to do so? Thank you! Charlie [[alternative HTML version deleted]]

[R] Biology package install error

2014-01-23 Thread Allison Yoshida
Hi, I am trying to install a package called "biology" in R version 3.0.2 on my Macbook Pro. I get a warning message that says "package 'biology' is not available (for R version 3.0.2)" Upon some research it seems the package was put together by Logan Murray who authored an R help book, in which h

Re: [R] counting matched elements in two vectors

2014-01-23 Thread Hervé Pagès
On 01/23/2014 04:49 PM, Hervé Pagès wrote: Hi Mintewab, With the IRanges packages (from Bioconductor): > library(IRanges) > countMatches(z, w) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 3 1 1 0 1 0 0 0 0 0 0 1 3 2 0 0 1 0 0 [39] 0 0 0 0 0 0 0 0 And if you don't want to depend on I

Re: [R] counting matched elements in two vectors

2014-01-23 Thread Peter Langfelder
Here's a solution: # This gives a vector of counts (if z is a data frame, first convert it to a matrix) res = sapply(as.vector(z), function(x) sum(w==x)) # This copies the dimensions of the variable 'z' to 'res': dim(res) = dim(z) Peter On Thu, Jan 23, 2014 at 7:43 AM, wrote: >Hi all, > I

Re: [R] counting matched elements in two vectors

2014-01-23 Thread Hervé Pagès
Hi Mintewab, With the IRanges packages (from Bioconductor): > library(IRanges) > countMatches(z, w) [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 1 0 3 1 1 0 1 0 0 0 0 0 0 1 3 2 0 0 1 0 0 [39] 0 0 0 0 0 0 0 0 To install the IRanges package: source("http://bioconductor.org/biocLite.R";)

Re: [R] counting matched elements in two vectors

2014-01-23 Thread Jeff Newmiller
Thank you for the reproducible example, but your description is missing a clear definition of what you want. For example, if your desired output is result <- c(rep(0,16),2,1,0,3,1,1,0,1,0,0,0,0,0,0,1,3,2,0,0,1,rep(0,10)) then one answer might be as.vector(table(factor(w,levels=z))) --

Re: [R] add median/mean line to stri-plot in lattice

2014-01-23 Thread Duncan Mackay
Hi Luigi Not sure what you want exactly. I have cleaned up the formula - do that at the data.frame first. see http://lmdvr.r-forge.r-project.org/figures/figures.html for more examples on lattice Please dput your data - makes things easier and we have what you are working with There may be better

[R] [R-pkgs] Major update to Hmisc package available on CRAN

2014-01-23 Thread Frank Harrell
Hmisc has had the following updates, with some of the new functions demonstrated on http://biostat.mc.vanderbilt.edu/HmiscNew . Much of the new work is motivated by the need to replace tables with graphics. Changes in version 3.1

Re: [R] degrees of freedom

2014-01-23 Thread Ben Bolker
Iain Gallagher btopenworld.com> writes: > > Hello List > > I have been asked to analyse some data for a colleague. > The design consists of a two sets of animals > > First set of three - one leg is treated and the > other is not under two different conditions (control & > overload are the sa

Re: [R] R Installation Options

2014-01-23 Thread Mark Lyman
Thank you. I ask because our IT people have security concerns with that functionality On Thu, Jan 23, 2014 at 10:25 AM, Prof Brian Ripley wrote: > On 23/01/2014 16:15, Mark Lyman wrote: > >> Can I build a version of R for Windows without some functionality like ftp >> and sockets? And without so

Re: [R] Converting Matrix to List

2014-01-23 Thread arun
Hi, Try ?split() set.seed(484) mat1 <- cbind(rep(1:8,c(2,4,3,6,8,4,3,10)),matrix(sample(200,40*10,replace=TRUE),nrow=40)) res <- split(as.data.frame(mat1[,-1]),as.matrix(mat1[,1])) A.K. Hi. I have very large matrix of 2648 observations by 98 people in a study. They are covariance matrices fo

Re: [R] summary() and the mode

2014-01-23 Thread Marc Schwartz
On Jan 23, 2014, at 2:27 PM, Ruhil, Anirudh wrote: > A student asked: Why does R's summary() command yield the Mean and the > Median, quartiles, min, and max but was written to exclude the Mode? > > I said I had no clue, googled the question without much luck, and am now > posting it to see i

Re: [R] summary() and the mode

2014-01-23 Thread Jim Lemon
On 01/24/2014 07:27 AM, Ruhil, Anirudh wrote: A student asked: Why does R's summary() command yield the Mean and the Median, quartiles, min, and max but was written to exclude the Mode? I said I had no clue, googled the question without much luck, and am now posting it to see if anybody knows

Re: [R] summary() and the mode

2014-01-23 Thread Rolf Turner
On 24/01/14 09:27, Ruhil, Anirudh wrote: A student asked: Why does R's summary() command yield the Mean and the Median, quartiles, min, and max but was written to exclude the Mode? I said I had no clue, googled the question without much luck, and am now posting it to see if anybody knows why.

Re: [R] Deleting subsequences from a string sequence

2014-01-23 Thread Hervé Pagès
Hi, This is easy to do with the Biostrings package (from Bioconductor). Let's say you've managed to load the string from your eya4_lagan_HM_cp.txt file: my_seq <- "123456789012345678901234567890" What you call "pairs of positions" are "ranges". Let's say you've managed to the ranges from you

[R] summary() and the mode

2014-01-23 Thread Ruhil, Anirudh
A student asked: Why does R's summary() command yield the Mean and the Median, quartiles, min, and max but was written to exclude the Mode? I said I had no clue, googled the question without much luck, and am now posting it to see if anybody knows why. Ani [[alternative HTML version

[R] add median/mean line to stri-plot in lattice

2014-01-23 Thread Luigi Marongiu
dear all, I set a series of variable subdivided in classes (there are 7 in here, defined by the clause 'levels'), and I am showing the results in strip chart using the package 'lattice'. Whitin each class the samples are further subdivided in "active" (A) and "latent" (L). The function I have writt

[R] degrees of freedom

2014-01-23 Thread Iain Gallagher
Hello List I have been asked to analyse some data for a colleague. The design consists of a two sets of animals First set of three - one leg is treated and the other is not under two different conditions (control & overload are the same animals - control leg is control (!) for treated leg;

Re: [R] Question on density values obtained from kde2d() from package MASS

2014-01-23 Thread Peter Löwenberg
Hello Andy, Do you already understand kde2d output? if I run > max(tmp$z) do I take the maximum value of the 2d density? Cheers, Peter Em quinta-feira, 24 de novembro de 2011 16h12min19s UTC-2, Andreas Klein escreveu: > > Hello, > > I am a little bit confused regarding the density values obt

Re: [R] Deleting subsequences from a string sequence

2014-01-23 Thread arun
Hi, Try:  CDS1 <- read.table("CDS coordinates.txt",header=FALSE) CDS2 <- split(CDS1[,1],as.numeric(as.character(gl(nrow(CDS1),2,length=nrow(CDS1) eya4 <- readChar("eya4_lagan_HM_cp.txt",file.info("eya4_lagan_HM_cp.txt")$size)  eyaSpl<- head(strsplit(eya4,"")[[1]],-1) length(eyaSpl) #[1] 311522

Re: [R] counting matches in two vectors

2014-01-23 Thread M.Bezabih
Many thanks, Arun. Res 1 is exactly what I wanted. Mintewab -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of arun Sent: 23 January 2014 16:27 To: R help Subject: Re: [R] counting matches in two vectors Hi, May be this helps:  z1 <

[R] Determining appropriate order of Markov chain

2014-01-23 Thread Akshay Chougule
Hello I am working with sequential data . Is there any existing R library or code that would help to determine (or provide the results of statistical tests for) the most significant or appropriate order of a Markov chain, given a sequence of discrete states? For example, given a sequence of discr

Re: [R] Problems with a R-packages

2014-01-23 Thread William R Revelle
Andreas, You need to install those dependencies first. That is, ‘lossDev’ is not installed until you first . first install ‘rjags’, ‘logspline’ but those probably require some other dependencies as well. That is, when you try to install ‘rjags’, ‘logspline’ it will probably give you mes

Re: [R] counting matches in two vectors

2014-01-23 Thread arun
Also,  res3 <- table(z1[match(w,z1)])  identical(res3,res1) #[1] TRUE A.K. On Thursday, January 23, 2014 11:26 AM, arun wrote: Hi, May be this helps:  z1 <- factor(z) res1 <- table(z1[cut(w,breaks=c(-Inf,z,Inf),labels=F)]) res1 # #-5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14

Re: [R] R Installation Options

2014-01-23 Thread Prof Brian Ripley
On 23/01/2014 16:15, Mark Lyman wrote: Can I build a version of R for Windows without some functionality like ftp and sockets? And without some of the recommended packages? It doesn't look like this can be done from the Windows install file, but if it can that would nice to know too. Installing

Re: [R] modify subset of array in list in a function

2014-01-23 Thread William Dunlap
> But the last > part is giving me trouble, since in R calls are by value, not reference, > so I don't end up modifying the original array in the code below (when > set_subarray is called): You can get this effect with R-like syntax by (a) changing set_subarray to `set_subarray<-`, putting the

Re: [R] Matching data in two files but returning a value from a adjacent column

2014-01-23 Thread arun
Hi, Try ?merge() or ?join() from library(plyr) #Please provide reproducible example.  set.seed(42)  dat1 <- data.frame(Stat_Ana=sample(20:30,10,replace=TRUE)) dat2 <- data.frame(Stat_Ana=20:30,Group=LETTERS[1:11]) merge(dat1,dat2,by="Stat_Ana") library(plyr)  join(dat1,dat2,by="Stat_Ana") A.K.

[R] modify subset of array in list in a function

2014-01-23 Thread Tamas Papp
Hi, I am trying to implement a function that would allow functional transformations of posterior simulations (useful in posterior predictive checks after MCMC, eg in Stan). A posterior simulation is a list of vectors and arrays. Usually, one uses loops to transform it, but that's error prone. I w

[R] [R-pkgs] psych version 1.4.1

2014-01-23 Thread William R Revelle
psych 1.4.1 is now on CRAN and being distributed to the mirrors. • Substantial improvements in speed through the use of the parallel package and some coding improvements in a number of functions. • Added parallel processing (multicores) to polychoric, tetrachoric, mixed.cor, fa, fa.parallel, c

[R] R Installation Options

2014-01-23 Thread Mark Lyman
Can I build a version of R for Windows without some functionality like ftp and sockets? And without some of the recommended packages? It doesn't look like this can be done from the Windows install file, but if it can that would nice to know too. Thanks, Mark [[alternative HTML version del

Re: [R] counting matches in two vectors

2014-01-23 Thread arun
Hi, May be this helps:  z1 <- factor(z) res1 <- table(z1[cut(w,breaks=c(-Inf,z,Inf),labels=F)]) res1 # #-5 -4 -3 -2 -1  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 # 0  0  0  0  0  0  0  0  0  0  2  1  0  3  1  1  0  1  0  0  0  0  0  0  1  3 #21 22 23 24 25 26 27 28 29 30 31 32

[R] counting matched elements in two vectors

2014-01-23 Thread M.Bezabih
Hi all, I have the following reproducible example z<-c(-5:40) w<-c(11, 11, 12, 14, 14, 14, 15, 16, 18, 25, 26, 26, 26, 27, 27, 30) r<-z %in% w now r gives me the presence or absence of elements in z that are in w but I am interested in getting the number of times each element in z appears (o

[R] [R-pkgs] TAQMNGR

2014-01-23 Thread Cipollini Fabrizio
Dear R users Some days ago we released the package 'TAQMNGR'. The package manages tick-by-tick transaction data, performing 'cleaning', 'aggregation' and 'import' in an efficient and fast way (the package engine is in C++). Cleaning and Aggregation are performed according to Brownlees and Gallo (20

Re: [R] R-3.0.2 installation breaks up with error

2014-01-23 Thread Prof Brian Ripley
That is not a question for R-help (see the posting guide), not a default build of R (and you show nothing about how you did this) and so not reproducible. z_abs looks like a Fortran symbol, so my guess is that libRblas was not linked correctly. On a Linux system it should be dynamically linke

[R] R-3.0.2 installation breaks up with error

2014-01-23 Thread Claus . Neumayer
Dear all, I tried to install R-3.0.2 Source on a SUSE SLES11 Version and after the ./configure the make command breaks up with error: gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I../../src/extra -I../../src/extra/xz/api -I. -I../../src/include -I../

[R] direct AUC maximization in R

2014-01-23 Thread Ilya Novikov
It is known that logistic regression does not provide maximum of AUC. There are various approaches to direct AUC optimization but I did not find any of them in R. Can anybody help me to do AUC maximization in R? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/d