formula

short formula call for many variables when building a model [duplicate]

做~自己de王妃 提交于 2019-11-26 22:06:04
This question already has an answer here: Formula with dynamic number of variables 5 answers I am trying to build a regression model with lm(...). My dataset has lots of features(>50). I do not want to write my code as lm(output~feature1+feature2+feature3+...+feature70) . I was wondering what is the short hand notation to write this code. You can use . as described in the help page for formula . The . stands for "all columns not otherwise in the formula". lm(output ~ ., data = myData) . Alternatively, construct the formula manually with paste . This example is from the as.formula() help page:

Fill formula down till last row in column

蓝咒 提交于 2019-11-26 20:00:40
问题 I'm trying to draw down the formula that's in cell M3 to the end of the data set. I'm using column L as my base to determine the last cell with data. My formula is a concatenation of two cells with a text comma in-between them. My formula is =G3&","&L3 I want Excel to draw down this formula so Cell M4 would be =G4&","&L4 Cell M5 would be =G5&","&L5 and so on. My code: Range("$M$3").Formula = Range("G3") & (",") & Range("L3") Dim Lastrow As Long Application.ScreenUpdating = False Lastrow =

Optimizing Excel formulas - SUMPRODUCT vs SUMIFS/COUNTIFS

房东的猫 提交于 2019-11-26 17:29:51
问题 According to a couple of web sites, SUMIFS and COUNTIFS are faster than SUMPRODUCT (for example: http://exceluser.com/blog/483/excels-sumifs-or-sumproduct-which-is-faster.html). I have a worksheet with an unknown number of rows (around 200 000) and I'm calculating performance reports with the numbers. I have over 6000 times almost identical SUMPRODUCT formulas with a couple of difference each times (only the conditions change). Here is an example of what I got: =IF(AFO4>0, (SUMPRODUCT((Sheet1

Making Excel functions affect 'other' cells

帅比萌擦擦* 提交于 2019-11-26 16:47:48
问题 Let's say that I create a Sub (not a function) whose mission in life is to take the active cell (i.e. Selection) and set an adjacent cell to some value. This works fine. When you try to convert that Sub to a Function and try to evaluate it from from spreadsheet (i.e. setting it's formula to "=MyFunction()") Excel will bark at the fact that you are trying to affect the value of the non-active cell, and simply force the function to return #VALUE without touching the adjacent cell. Is it

Count Unique values with a condition

随声附和 提交于 2019-11-26 16:47:15
In column A I have list of different names. In column B, I have values either 0 or 1. I want to get a count of all the unique names from column A which have 1 in column B. Using below array formula I am able count unique names but not able to apply condition on column B. =SUM(1/COUNTIF(A:A,A:A)) Assuming no more than 100 rows try this "array formula" to count the different names in A2:A100 where there is a 1 in the same row in B2:B100: =SUM(IF(FREQUENCY(IF(B2:B100=1,IF(A2:A100<>"",MATCH(A2:A100,A2:A100,0))),ROW(A2:A100)-ROW(A2)+1),1)) confirmed with CTRL+SHIFT+ENTER Note that I say different

Object not found error when passing model formula to another function

旧巷老猫 提交于 2019-11-26 16:36:57
问题 I have a weird problem with R that I can't seem to work out. I've tried to write a function that performs K-fold cross validation for a model chosen by the stepwise procedure in R. (I'm aware of the issues with stepwise procedures, it's purely for comparison purposes) :) Now the issue is, that if I define the function parameters (linmod,k,direction) and run the contents of the function, it works flawlessly. BUT, if I run it as a function, I get an error saying the datas.train object can't be

How to do a fractional power on BigDecimal in Java?

。_饼干妹妹 提交于 2019-11-26 15:28:22
In my little project I need to do something like Math.pow(7777.66, 5555.44) only with VERY big numbers. I came across a few solutions: Use double - but the numbers are too big Use BigDecimal.pow but no support for fractional Use the X^(A+B)=X^A*X^B formula (B is the remainder of the second num), but again no support for big X or big A because I still convert to double Use some kind of Taylor series algorithm or something like that - I'm not very good at math so this one is my last option if I don't find any solutions (some libraries or a formula for (A+B)^(C+D)). Anyone knows of a library or

In R formulas, why do I have to use the I() function on power terms, like y ~ I(x^3)

若如初见. 提交于 2019-11-26 15:24:10
问题 I'm trying to get my head around the use of the tilde operator, and associated functions. My 1st question is why does I() need to be used to specify arithmetic operators? For example, these 2 plots generate different results (the former having a straight line, and the latter the expected curve) x <- c(1:100) y <- seq(0.1,10,0.1) plot(y~x^3) plot(y~I(x^3)) further, both of the following plots also generate the expected result plot(x^3, y) plot(I(x^3), y) My second question is, perhaps the

Base64 length calculation?

心已入冬 提交于 2019-11-26 15:01:35
After reading the base64 wiki ... I'm trying to figure out how's the formula working : Given a string with length of n , the base64 length will be Which is : 4*Math.Ceiling(((double)s.Length/3))) I already know that base64 length must be %4==0 to allow the decoder know what was the original text length. The max number of padding for a sequence can be = or == . wiki :The number of output bytes per input byte is approximately 4 / 3 (33% overhead) Question: How does the information above settle with the output length ? Each character is used to represent 6 bits ( log2(64) = 6 ). Therefore 4 chars

Too many &#39;if&#39; statements?

心不动则不痛 提交于 2019-11-26 14:58:11
问题 The following code does work how I need it to, but it's ugly, excessive or a number of other things. I've looked at formulas and attempted to write a few solutions, but I end up with a similar amount of statements. Is there a type of math formula that would benefit me in this instance or are 16 if statements acceptable? To explain the code, it's for a kind of simultaneous-turn-based game.. two players have four action buttons each and the results come from an array (0-3), but the variables