Re: [R] Error loading largeVis

2017-02-13 Thread Berend Hasselman
> On 13 Feb 2017, at 16:54, Algeri, Sara wrote: > > Dear all, > > I have been trying to load the package 'largeVis' but despite I do not > receive any error message when installing it, I keep getting the following > error when loading it in my working directory: > >> require("largeVis") > L

Re: [R] Query - Merging and conditional replacement of values in a data frame

2017-02-13 Thread MacQueen, Don
How about this? foo <- merge(df1, df2, all=TRUE) is.new <- !is.na(foo$v11) foo$v1[is.new] <- foo$v11[is.new] foo <- foo[, names(df1)] > foo time v1 v2 v3 11 2 3 4 22 5 6 4 33 112 3 4 44 112 3 4 55 2 3 4 66 2 3 4 -- Don MacQueen Lawrence Livermo

[R] Error loading largeVis

2017-02-13 Thread Algeri, Sara
Dear all, I have been trying to load the package 'largeVis' but despite I do not receive any error message when installing it, I keep getting the following error when loading it in my working directory: > require("largeVis") Loading required package: largeVis Loading required package: Matrix E

[R] How to output "0" after paste() ?

2017-02-13 Thread vod vos
Hi everyone, How to get "0" after init? aa<- seq(2,7,0.5) aa [1] 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 bb<- paste("why no dot zero",aa,"after init",sep="") bb the output are: [1] "why no dot zero2after init" "why no dot zero2.5after init" [3] "why no dot zero3afte

[R] Circular plot

2017-02-13 Thread swaraj basu
I want to plot segments deleted from mitochondrial DNA of patients with neuromuscular disorders. I generate the plot on a linear chromosome using a code similar to as shown below start<-c(1,5,600,820) end<-c(250,75,810,1200) score<-c(7,-1,4,-6.5) dat<-data.frame(start=start,end=end,score=score,col

[R] Wrap to 360

2017-02-13 Thread Peter Mills
Hi Is there an equivalent for R of the Matlab function wrapTo360? Many thanks Peter [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] How to output "0" after paste() ?

2017-02-13 Thread David L Carlson
First, use plain text emails. Look that what conversion from html did to your email: aa <- seq(2,7,0.5) became aa<- seq(2,7,0.5) You need to format your numeric values with sprintf(): paste("why no dot zero", sprintf("%3.1f", aa),"after init",sep="") ?sprintf for details -

Re: [R] How to output "0" after paste() ?

2017-02-13 Thread Rui Barradas
Hello, See the help page for ?sprintf. sprintf("why no dot zero %1.1f after init", aa) Hope this helps, Rui Barradas Em 13-02-2017 16:27, vod vos escreveu: Hi everyone, How to get "0" after init? aa<- seq(2,7,0.5) aa [1] 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 bb<- paste("

Re: [R] Wrap to 360

2017-02-13 Thread William Dunlap via R-help
The key function is '%%' (remainder), but its result needs to be tweaked at mulitplies of 360 because Matlab's definition of wrapTo360 is lonWrapped = wrapTo360(lon) wraps angles in lon, in degrees, to the interval [0 360] such that 0 maps to 0 and 360 maps to 360. (In general, positive multiples

Re: [R] Circular plot

2017-02-13 Thread David L Carlson
You can do this easily with the DrawCircle() function in package DescTools. It is easiest to use geometric coordinates (0 is at 3 o'clock and moves counterclockwise around the circle), but it could be converted to 12 o'clock and clockwise: library(DescTools) # Convert begin/stop to radians dat

Re: [R] Circular plot

2017-02-13 Thread Bert Gunter
If you don't get a reply here: 1. Search! (try rseek.org as an R search engine). 2. Try the Bioconductor list. As this appears to be closer to their realm, they may have what you're looking for. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and

Re: [R] get() return nothing

2017-02-13 Thread Fix Ace via R-help
Well, I am not trying to print anything. I just would like to get the dimension information for all the dataframes I created. Could you please help me to develop the script? Thanks. Ace On Saturday, February 11, 2017 7:53 PM, Duncan Murdoch wrote: On 11/02/2017 1:33 PM, Fix Ace via R-

Re: [R] object of type 'closure' is not subsettable

2017-02-13 Thread Allan Tanaka
Dang, i should notice that forecastS and forecast thingy. Now it works like a charm. ThANKS On Monday, 13 February 2017, 3:56, William Dunlap wrote: > Error in forecast[[d + 1]] = paste(index(lEJReturnsOffset[windowLength]),  : > object of type 'closure' is not subsettable A 'closure

[R] [Python] NameError: name 'hurst' is not defined

2017-02-13 Thread Allan Tanaka
Hi. Not sure why this code produces the error like this. This error appears when i run the code of print "Hurst(GBM):   %s" % hurst(gbm):  Traceback (most recent call last):  File "", line 1, in     print "Hurst(GBM):   %s" % hurst(gbm)NameError: name 'hurst' is not defined Here is the full code

[R] evaluating function over seq of values

2017-02-13 Thread Evan Cooch
The MWE (below) shows what I'm hoping to get some help with: step 1\ specify the likelihood expression I want to evaluate using a brute-force grid search (not that I would do this in practice, but it is a convenient approach to explain the idea in a class...). step 2\ want to evaluate the lik

Re: [R] [Python] NameError: name 'hurst' is not defined

2017-02-13 Thread Allan Tanaka
Correction, it should look like this:**def hurst(ts): lags = range(2, 100) tau = [np.sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags] poly = np.polyfit(log(lags), log(tau), 1) return poly[0]*2.0 On Tuesday, 14 February 2017, 0:06, Allan Tanaka wrote: Hi. Not sure why this cod

Re: [R] evaluating function over seq of values

2017-02-13 Thread Bert Gunter
The apply() family of functions **are** loops (at the interpreted level). They are **not vectorized** (looping at the C level). Their typical virtue is in code clarity and (sometimes) the utiity of the return structure, not greater efficiency. Sometimes they are a bit faster, sometimes a bit slower

Re: [R] evaluating function over seq of values

2017-02-13 Thread Evan Cooch
Note that in your likelihood function, N can be a vector of values, so you can compute the likelihood for all values of N and just access the value you want via subscripting rather than repeatedly computing it for different N's. OK -- that is the part I'm stuck at - pointers to how to do preci

Re: [R] evaluating function over seq of values

2017-02-13 Thread William Dunlap via R-help
The reason you are having trouble with using an *apply function is that f_like does not have an argument 'N', so the N it uses is the N from the environment in which f_like was defined, .GlobalEnv, not one you might set in *apply's FUN argument. Hence, make N an argument to f_like and use it in *ap

Re: [R] Circular plot

2017-02-13 Thread swaraj basu
Thank you David, I could get the circle at 12 and clockwise however I believe my solution is not the optimal one, could you help me out with the best way to generate the circle clockwise at 12 and then convert the begin/stop to radians Here is what I tried par(mar=c(2,2,2,2),xpd=TRUE); plot(c(1,8

Re: [R] Circular plot

2017-02-13 Thread Jim Lemon
Hi Swaraj, As David pointed out, you can get the arcs without too much trouble: library(plotrix) mdf<-data.frame(score=c(-1,7,4,-7),start=c(0,0,600,800), finish=c(100,200,800,1250)) par(mar=c(4,4,1,1)) plot(0,type="n",xlim=c(-20,20),ylim=c(-20,20),xlab="",ylab="", xaxt="n",yaxt="n") axis(1,at=c(

Re: [R] [Python] NameError: name 'hurst' is not defined

2017-02-13 Thread Jeff Newmiller
This question is off topic here. -- Sent from my phone. Please excuse my brevity. On February 13, 2017 9:08:18 AM PST, Allan Tanaka wrote: >Correction, it should look like this:**def hurst(ts): lags = range(2, >100) tau = [np.sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in >lags] poly = np

Re: [R] get() return nothing

2017-02-13 Thread David Winsemius
> On Feb 13, 2017, at 8:50 AM, Fix Ace via R-help wrote: > > Well, I am not trying to print anything. I just would like to get the > dimension information for all the dataframes I created. Could you please help > me to develop the script? You should post R code that builds objects of similar