Re: [R] need help to generate an intersection matrix

2017-02-02 Thread Jim Lemon
Hi Ana, Here is one way: pathway1<-LETTERS[1:5] pathway2<-c("A","C","F") pathway3<-c("B","D","E") intersect.mat<-matrix(0,nrow=3,ncol=3) rownames(intersect.mat)<-paste("pathway",1:3,sep="") colnames(intersect.mat)<-paste("pathway",1:3,sep="") for(row in 1:3) { for(col in 1:3) intersect.mat[row,

[R] need help to generate an intersection matrix

2017-02-02 Thread Li, Aiguo (NIH/NCI) [E]
Dear all, I am new to r script and run into some difficulty with this simple task. Here is my data: I need to find out the number of mutual intersected elements as shown below data pathway1 A B C D E pathway2 A C

[R] nlsList (nlme) error

2017-02-02 Thread Laureano Gherardi
Hello Rick, This may be way to late but I had the same error and solved it just removing the “na.action=” argument. Since I had removed the NAs beforehand it did not affect my results. Best, Lau Laureano A. Gherardi PhD Sala Lab LSA 217A School of Life Scienc

Re: [R] princomp() output loadings component missing

2017-02-02 Thread Fix Ace via R-help
Thank you very much! Ace On Sunday, January 29, 2017 4:13 PM, Ben Tupper wrote: Hi, Check out the detailed explanation in the 'Value' section of ?princomp - in particular for 'loadings'.  It will send you to ?loadings where it explains why that one element appears to be missing. If y

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Martin Morgan
On 02/01/2017 02:46 PM, Ramiro Barrantes wrote: Hello, I have a function that applies to an S4 object which contains a slot called @analysis: function calculation(myObject) { tmp <- myObjects@analysis result <- ...operations on analysis... return result } I am writing a unit test for th

Re: [R] metafor rma.mv weights questions

2017-02-02 Thread Viechtbauer Wolfgang (SP)
Hi Laura, As far as I am concerned, you account for multiple effects sizes from the same study by setting up and fitting an appropriate model, not by fiddling with the weights. Several examples are described here: http://www.metafor-project.org/doku.php/analyses#multivariate_multilevel_meta-ana

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Jeff Newmiller
You seem like you have painted yourself into a corner... you want to access slots in an S4 object yet you don't want to create one. Are you going to do this test without the benefit of an operating system either? Beware of getting too meta... David didn't say you had to use an S4 object define

Re: [R] sub-setting rows based on dates in R

2017-02-02 Thread Jim Lemon
It looks to me as though the problem is in your input data. The following example works for me: df1<-data.frame(Date=paste(rep(6:8,each=20), c(sort(sample(1:30,20)),sort(sample(1:30,20)),sort(sample(1:30,20))), 2016,sep="/"), Rainfall_Duration=sample(c(10,20,30,40),60,TRUE)) df1$Date<-as.Date(d

Re: [R] need help in trying out sparklyr - spark_connect will not work on local copy of Spark

2017-02-02 Thread Taylor, Ronald C
> So this makes me wonder if you do not have a proper installation of java for > one of those other packages. David, You were right. I was using Java 1.6 instead of Java 1.7 or later. Mea culpa. I am now up and running, and looking to do many things with R and Spark. Thank you. Ron Ronal

Re: [R] beginner question: subset first entry (row) per week

2017-02-02 Thread Bert Gunter
new.df <- orig.df[!duplicated(df[["week"]]), ] See ?duplicated -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Feb 2, 2017 at 1:04 PM, Dagmar wro

[R] beginner question: subset first entry (row) per week

2017-02-02 Thread Dagmar
Dear knowing people, I have a data frame like this. exdatframe <- data.frame(Name=c("Ernie","Ernie","Ernie", "CookieMonster","CookieMonster","CookieMonster"), recordedTime=as.POSIXct(strptime(as.character("01.01.2017","02.01.2011","03.01.2011", "01.01.2011","02.01.2011","03.01.2011"),"%d.%m.%Y

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Ramiro Barrantes
Yes, so are you suggesting that I create an instance of my S4 class in order to test my function. My understanding is that ideally the test should not depend on any code besides the one that I am testing. I just thought that you could perhaps define a mock class so that I would not need to inv

Re: [R] How to do double (nested) parSapply in R?

2017-02-02 Thread Henrik Bengtsson
Quick comment: sapply() / parSapply() can behaves "unexpectedly". To troubleshoot this, use parLapply() instead to see if you at least get the individual results you think you should get. Henrik On Feb 2, 2017 08:03, "Art U" wrote: > Hello, > > I have a data orig.raw that contains 8 predictors

Re: [R] Help with implementing Whittaker-Henderson graduation for raw-data

2017-02-02 Thread Berend Hasselman
Why don't you just try the function whittaker from the pracma R package? There is an example which should be adequate for finding out what to do. Berend Hasselman > On 2 Feb 2017, at 03:44, Percival Bueser wrote: > > Good day everyone! > > I would appreciate if anyone can help me regarding th

Re: [R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread William Dunlap via R-help
When searching for the object referred to by a name, R looks first in the current environment, then in the environment's parent environment, then in that environment's parent environment, etc. It stops looking either when the name is found or when it hits .EmptyEnv, the ultimate ancestor of all en

Re: [R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Bert Gunter
OK. Try: nlWaldTest:::vectorize.args (3 colons) Your error message said it was *not* exported, so you need 3 colons (which, in general, is a bad idea.It's usually not exported for a reason). I presume vectorize.args is is in the environment of the function copied from the name space, because f

Re: [R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Marc Girondot via R-help
Thanks Bert for the explanation about identical. For the vectorize.args, note that vectorize.args is not a function but an variable that is unknown in the namespace nlWaldTest. > nlWaldTest::vectorize.args Erreur : 'vectorize.args' n'est pas un objet exporté depuis 'namespace:nlWaldTest' F

Re: [R] looping problem

2017-02-02 Thread greg holly
Thanks so much Peter. I do appreciate for this. Greg On Thu, Feb 2, 2017 at 10:28 AM, PIKAL Petr wrote: > Hi. > > Your messages are rather confusing. Well, if you could get correct final > data.frame in loop why not just add inside of loop new column(s) by > > psT$chr <- i > > Maybe it is time

Re: [R] Help with implementing Whittaker-Henderson graduation for raw-data

2017-02-02 Thread Bert Gunter
Percival: Please make at least a minimal effort to search before posting. A google search on "Whittaker-Henderson smoothing R" brought up what appeared to me to be several relevant links. If I am wrong about this, you should probably explain why in a further query. Of course, in general, we do

Re: [R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Bert Gunter
1. No they're not. e.g. > f <- function() NULL > g <- function()NULL > identical(f,g) [1] FALSE > str(f) function () - attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 6 1 20 6 20 1 1 .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' > str(g) function () - attr(*, "srcref")=Class

[R] installing Contfrac package gives a gcc error

2017-02-02 Thread Yeroslaviz, Assa
Hi everyone, I am trying to install the contra package on my Ubuntu server. Ich bekomme aber die folgende Fehlermeldung: But I keep getting this error: Installing contfrac '/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet \ CMD INSTALL '/tmp/Rtmp0ZStmN/devtools84a

[R] How to do double (nested) parSapply in R?

2017-02-02 Thread Art U
Hello, I have a data orig.raw that contains 8 predictors and 1 outcome variable. I'm trying to run simulation (bootstrap) and create, let's say, 10 confidence intervals for coefficients estimated by LASSO. I did it with regular function replicate, but now I want to do it by using parallel programm

[R] Help with implementing Whittaker-Henderson graduation for raw-data

2017-02-02 Thread Percival Bueser
Good day everyone! I would appreciate if anyone can help me regarding the following: I would like to implement the Whittaker-Henderson smoothing to the raw data on the attached .txt file, based on the description on this link: https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.

Re: [R] looping problem

2017-02-02 Thread PIKAL Petr
Hi. Your messages are rather confusing. Well, if you could get correct final data.frame in loop why not just add inside of loop new column(s) by psT$chr <- i Maybe it is time to read R intro as good source for starting with R. It has about 100 pages, but you can pick as start only pages 2-40 w

Re: [R] looping problem

2017-02-02 Thread greg holly
Thanks so much for this. Unfortunately, cbind did not work. Basically, I like to put an extra column named "chr" in the combined file from 22 chr. So chr colum will be "1" for the portion of chr1 in the combined file, 2 for the portion of chr2 in the combined file and so on. Regards, Greg On Thu

[R] Function that works within a package and not when copied in global environment. Why?

2017-02-02 Thread Marc Girondot via R-help
Dear experts, In the package nlWaldTest, there is an hidden function : .smartsub I can use it, for example: > getFromNamespace(".smartsub", ns="nlWaldTest")(pat="x", repl="b" , x="essai(b[1], b[2], x[1])") [1] "essai(b[1], b[2], b[1])" Now I try to create this function in my global environment

Re: [R] looping problem

2017-02-02 Thread Rui Barradas
Hello, If I understand correctly, just use ?cbind. Rui Barradas Em 02-02-2017 13:33, greg holly escreveu: Hi Rui; Is there any way to insert the chr ids in numeric as 1,2..,22 in the final output. Here is output from str(temp). So I need also chr ids in a column. 1 rs58108140 105

Re: [R] legend in ggplot2

2017-02-02 Thread Ivan Calandra
Thanks Thierry, I knew there had to be a simpler way, but just could not find it (facet_wrap() does the trick!). Just 2 other questions: - How do I remove the plot titles? I don't find any argument in facet_wrap() on that... - How can I add the legend for the outliers? Thanks again, Ivan -

Re: [R] legend in ggplot2

2017-02-02 Thread Thierry Onkelinx
Dear Ivan, You're making things too complicated. ggplot(mydata, aes(x = Spot, y = Value)) + geom_boxplot(aes(colour = Equipment), outlier.colour = "red") + geom_jitter() + facet_wrap(~Equipment, scales = "free_y") + scale_colour_manual(values = c(Leeb = "blue", Shore = "red")) Best regar

[R] legend in ggplot2

2017-02-02 Thread Ivan Calandra
Dear useRs, I have been using base graphics since a long time and I'm currently trying to switch to ggplot2. I'm struggling with the legend (which probably means that my graphic commands are not optimal). I have copied the output from dput(mydata) at the end of the email. Here is what I have

Re: [R] looping problem

2017-02-02 Thread greg holly
Hi Rui; Is there any way to insert the chr ids in numeric as 1,2..,22 in the final output. Here is output from str(temp). So I need also chr ids in a column. 1 rs58108140 10583 G A -0.070438 0.059903 2 rs189107123 10611 C G -0.044916 0.085853 Regards, Greg On Wed, Feb 1, 20

Re: [R] How to create 10 minute time series from hourly data

2017-02-02 Thread Joshua Ulrich
On Wed, Feb 1, 2017 at 10:41 AM, Mary Ann Middleton wrote: > Hello, > > Apologies if this is a duplicate. I think I sent it to the wrong list > yesterday. > > I would appreciate some direction/suggestions with a problem with a time > series. > > I have a regular time series dataframe with hourly

Re: [R] Export Forecasted output to a table (excel)

2017-02-02 Thread Rui Barradas
Hello, Objects of type mforecast are list with many members. In order to have a data.frame you need to tell us which members you want. Do not mistake the output of the print method with the object, to see what mforecast objects are try str(fcst) Rui Barradas Em 02-02-2017 01:55, Lal Prasad

Re: [R] sub-setting rows based on dates in R

2017-02-02 Thread Jim Lemon
Hi Md, What I have done is to use the most recent intervening date between the last set of dates if any are there, otherwise the last set of dates. That is what I understand from your description. Remember that this is a very clunky way to do something like this by adding rows to a data frame, and