similar to: There must be a smarter way

Displaying 20 results from an estimated 300 matches similar to: "There must be a smarter way"

2011 Jan 17
1
Log difference in a dataframe column
What am I doing wrong here ? And what's the right way to calculate the log differences in a column in a df ? # first 3 rows of 5000 rows y[1:3,] Date Open High Low Close 1 1983-03-30 29.96 30.51 29.96 30.35 2 1983-03-31 30.35 30.55 30.20 30.24 3 1983-04-04 30.25 30.65 30.24 30.39 #equation in question ...why is this giving zeros ? y1 <- 100*log(y[,5]/(lag(y[,5],1))) # first 10
2013 Mar 09
3
data.frame with variable-length list
Hello, I'm trying to create a data frame with three columns, one of which is a variable-length list. I tried: df <- data.frame(name = c("a", "b", "c"), type=c(1, 2, 3), rtn = c(list(1,2,3), list(4, 5,6), list(7,8,9, 10) ) ) This would be useful, for example, if the 'rtn' is a variable number of
2002 Dec 20
1
lower triangle
Hi, I want to compute the lower triangle of a square matrix (optionally, sans diagonal). With for() loops I can do something like this: ## 5 by 5 matrix rtn for (j in 1:5) { for (k in 1:j) { if (j != k) { ## optional rtn[j, k] <- my.func(j, k) } } } I'd like to do this with apply(). Is there some way I can do this kind of 'short-circuit'? Thanks, Mark Wilkinson
2005 Jun 20
1
TxFax: can't get a fax to destination (log inside)
Can someone explain me what's going on and why the receiver of this fax guives up saying communication error? Slow carrier up Slow carrier down Slow carrier up <<< CSI: 40 20 20 20 20 20 20 20 34 39 34 35 36 34 39 35 30 20 39 33 2b CSI without final frame tag Remote fax gave CSI as: "+39 059465494 " <<< DIS: 80 00 ee f8 c4 00 DIS with final frame tag In
2002 Dec 05
1
Passing options as lists
Hi, I apologize if this has previously been posted. I've just subscribed to the R-help digest. I'm writing a plotting function that uses layout() to plot several different plots on the same device. This function uses plot(), image(), and a custom function that uses text(). Each cell of the layout needs different par() parameters, so what I'd like to do is pass them as lists:
2018 Apr 09
1
llvm-dev Digest, Vol 166, Issue 22
Hi Krzysztof, Sure, please see below. DAG.dump.() before and after, annotated with what I believe the DAG means. I've spent some time debugging the method but it's proving difficult to determine where the logic is misfiring. Disabling the entire combine causes a lot of failing x86-64 tests - I may have to learn an upstream vector ISA to make progress on this. Thank you >From your
2012 Nov 30
3
[LLVMdev] Tablegen bug???
Should tablegen detect this as an error, or is it documented as a limitation somewhere that we've missed? In the tablegen-generated file AMDILGenIntrinsics.inc, we have a bunch of if statements comparing strings, many of which are dead, preventing correct recognition of some intrinsics in the their text form. I'm not quite sure what GET_FUNCTION_RECOGNIZER is used for, but if it's
2006 Apr 27
2
summary(lm(x~y)) difference between R-2.2.1 and R-2.3.0
Hi [macOSX 10.4.6; R-2.3.0] I have encountered a difference in behaviour between R-2.2.1 and R-2.3.0 when performing a linear model. Transcript follows for R-2.3.0 (R-2.2.1 worked as expected). How to make R-2.3.0 perform as R-2.2.1 did? > dput(x) c(29.13, 29.88, 30.09, 29.99, 29.74, 29.64, 29.65, 29.7, 30.04, 29.89, 29.96, 29.65, 28.76, 28.41, 28.38, 29.55, 29.76, 29.75, 29.84,
2012 Nov 30
2
[LLVMdev] Tablegen bug???
If the source being scanned has "llvm.AMDIL.barrier.global, it will match the first barrier test and return AMDIL_barrier, not AMDIL_barrier_global. On Nov 29, 2012, at 7:19 PM, Chris Lattner <clattner at apple.com> wrote: > Out of curiosity, what is wrong about that? It looks ok to me. > > -Chris > > On Nov 29, 2012, at 6:52 PM, "Relph, Richard"
2012 Nov 30
0
[LLVMdev] Tablegen bug???
Out of curiosity, what is wrong about that? It looks ok to me. -Chris On Nov 29, 2012, at 6:52 PM, "Relph, Richard" <Richard.Relph at amd.com> wrote: > Should tablegen detect this as an error, or is it documented as a limitation somewhere that we've missed? > > In the tablegen-generated file AMDILGenIntrinsics.inc, we have a bunch of if statements comparing
2010 Nov 10
0
Retrieve all names of nested list and index list based on these names
Hi all, I looked for a function that would retrieve all(!) names of an arbitrary deeply nested named list. Also, names should optionally be arranged in a way that reflects the list's hierarchy structure (i.e. 'a$a.1$a.1.1' etc.) Also, there should be a recursive index linked to a respective list branch that could be used to index a list by names (as you would do with named vectors,
2011 Nov 29
2
aggregate syntax for grouped column means
I am calculating the mean of each column grouped by the variable 'id'. I do this using aggregate, data.table, and plyr. My aggregate results do not match the other two, and I am trying to figure out what is incorrect with my syntax. Any suggestions? Thanks. Here is the data. myData <- structure(list(var1 = c(31.59, 32.21, 31.78, 31.34, 31.61, 31.61, 30.59, 30.84, 30.98, 30.79, 30.79,
2010 Nov 11
4
How to get a specific named element in a nested list
Hello, I have a nested named list structure, like the following: x <- list( list( list(df1,df2) list(df3, list(df4,df5)) list(df6,df7))) with df1...d7 as data frames. Every data frame is named. Is there a way to get a specific named element in x? so, for example, x[[c("df5")]] gives me the data frame 5? Thank you in advance! Best, Friedericksen
2012 Jul 12
0
HAR-RV-CJ Moedel
I am trying to write a loop to forecast realized volatility over successive days for the purpose of VaR prediction using the HAR-RV-CJ model which is as follows: log(RV_t+1) = ?_0 + ?_CD log(CV_t) + ?_CW log(CV_t-5) + ?_CM log(CV_t-22) + ?_JD log(J_t + 1) + ?_JW log(J_t-5 + 1) + ?_JM log(J_t-22 + 1) + e_t where RV is realized volatility, CV is continuous volatility and J is the jump which is
2014 Sep 01
1
Correlation Matrix with a Covariate
R Help - I'm trying to run a correlation matrix with a covariate of "age" and will at some point will also want to covary other variables concurrently. I'm using the "psych" package and have tried other methods such as writing a loop to extract semi-partial correlations, but it does not seem to be working. How can I accomplish this? library(psych) > set.cor(y =
2013 Jul 03
0
[LLVMdev] Tablegen bug???
Was a fix for this ever applied to trunk? On Fri, Nov 30, 2012 at 11:08 PM, Chris Lattner <clattner at apple.com> wrote: > Yes that definitely sounds like a bug, no intrinsically in mainline are a > prefix if another one, or we are getting lucky. > > -Chris > > On Nov 29, 2012, at 7:24 PM, "Relph, Richard" <Richard.Relph at amd.com> > wrote: > >
2012 Dec 01
0
[LLVMdev] Tablegen bug???
Yes that definitely sounds like a bug, no intrinsically in mainline are a prefix if another one, or we are getting lucky. -Chris On Nov 29, 2012, at 7:24 PM, "Relph, Richard" <Richard.Relph at amd.com> wrote: > If the source being scanned has "llvm.AMDIL.barrier.global, it will match the first barrier test and return AMDIL_barrier, not AMDIL_barrier_global. > >
2002 Nov 27
1
Contrast problem
Hi, I have a question regarding contrasts in linear models. I have a factor variable age with 4 levels, in the output of the linear model I want a coefficient for each level of age. I have made sure that age is a factor but am unsure how to put age into the model to ensure the model knows it is a factor an dto display all levels. I have tried doing fit<-lm(y~C(age)+sex.....) (the dot
2006 Oct 17
0
Blank page when sending faxes
Guys, I have been a trying to send a fax using spandsp/app_rtxfax/asterisk. I'm trying to send a (3 page) fax, and all I'm receiving is a single blank page (and I've tried it with 2 fax machines). As some background, I'm using asterisk with an E1 connection through a Sangoma WAN card -- all of this has been working with voice for over 6 months. The software is all working too
2006 Oct 18
1
Blank page when sending faxes (repost)
Guys, [Forgive this repost -- my original posting doesn't seem to have shown up in the list (yet)] I have been trying to send a fax using spandsp/app_rtxfax/asterisk. I'm trying to send a (3 page) fax, and all I'm receiving is a single blank page (and I've tried it with 2 fax machines). As some background, I'm using asterisk with an E1 connection through a Sangoma WAN card