Questions tagged [negate]
81 questions
5
votes
2 answers
select columns that do NOT start with a string using dplyr in R
I want to select columns from my tibble that end with the letter R AND do NOT start with a character string ("hc"). For instance, if I have a dataframe that looks like this:
name hc_1 hc_2 hc_3r hc_4r lw_1r lw_2 lw_3r lw_4
Joe 1 2 …
![](../../users/profiles/9877445.webp)
J.Sabree
- 683
- 6
- 21
5
votes
3 answers
How to negate bool inside function in JS?
I'm writing some script now and I have a problem when trying to negate boolean inside a function. I mean this:
var test = true;
function changeThisBoolPlease(asd){
asd=!asd;
}
alert(test);
changeThisBoolPlease(test);
alert(test);
alerts true,…
![](../../users/profiles/3103257.webp)
adam
- 365
- 1
- 2
- 11
4
votes
2 answers
Convert positive value to negative value in swift
I want to convert a positive value to a negative value, for example:
let a: Int = 10
turn it to -10, my current idea is just use it to multiple -1
a * -1
I'm not sure if this is proper, any idea?
![](../../users/profiles/291240.webp)
William Hu
- 12,918
- 8
- 85
- 98
4
votes
2 answers
Understanding function composition with negate
After reading through a page on Higher Order Functions from an awesome site I am still having trouble understanding the negate function paired with function composition.
to be more specific, take this piece of code:
ghci> map (negate . sum . tail)…
![](../../users/profiles/1409312.webp)
Syntactic Fructose
- 15,445
- 16
- 74
- 158
4
votes
1 answer
negating self invoking function? !function ($) { ... }(window.jQuery);
Possible Duplicate:
What does the exclamation mark do before the function?
I was looking through the Twitter Bootstrap JavaScript code and I noticed all their plugins are wrapped in negating self invoking functions.
I am aware that function ($) {…
![](../../users/profiles/383759.webp)
Hailwood
- 79,753
- 103
- 257
- 412
3
votes
1 answer
Perl regexp how to negate a part
I have to disjuncts
D= d1| d2|...|dn
and
F=f1|f2|...|fn
at the moment I check those two regexp with an if-statement looking like this:
if (($text_to_search =~ $D) && ($text_to_search !~ $F))
How can I negate F? Is it possible to use a negative…
![](../../users/profiles/231177.webp)
Tyzak
- 2,342
- 7
- 35
- 50
3
votes
4 answers
How to apply not operator to all matrix elements in Julia?
I need to apply "not" operator to matrix of zeros and ones in Julia.
In Matlab I would do this:
A=not(B);
In Julia I tried doing this:
A = .~ B;
and
A = .! B;
It should turn zeros to ones and ones to zeros but I get error as a result or all…
![](../../users/profiles/12281984.webp)
Vasilije Bursac
- 161
- 1
- 2
- 10
3
votes
6 answers
int reverse sign negate( ) java
Requirements
Assume the availability of an existing class, ICalculator, that models an integer arithmetic calculator and contains:
an instance variable currentValue that stores the current int value
of the calculator and can be accessed and…
![](../../users/profiles/1508134.webp)
edmejia
- 95
- 1
- 4
- 15
2
votes
3 answers
Negate boost is_directory in std algorithm
boost::filesystem::recursive_directory_iterator end, begin(directory);
auto num_of_files=std::count_if(begin, end,
std::not1(boost::filesystem::is_directory)));
I am trying to negate the function is_directory on the above directory…
![](../../users/profiles/401196.webp)
111111
- 14,528
- 6
- 38
- 58
2
votes
1 answer
How to negate boost::lambda:bind?
Let's say I have this type:
typedef boost::function filter_function;
And a vector of those "filter functions":
std::vector filters;
If want to call all the filter functions, one by one, and only the the last call…
![](../../users/profiles/279259.webp)
ereOn
- 48,328
- 33
- 147
- 228
2
votes
0 answers
negate a javascript regex to match all except ranges
I'm not very good with regex and I could use some help.
I'm trying to match all characters except the ones defined by those ranges (ranges that match most emoji). How would I negate the statement below?
var nonEmoji = new…
![](../../users/profiles/6914683.webp)
Victor Dragnea
- 21
- 3
2
votes
1 answer
Pyspark Function to Negate Column
Is there a built-in function to add a new column which is the negation of the original column?
Spark SQL has the function negative(). Pyspark does not seem to have inherited this function.
df_new = df.withColumn(negative("orginal"))
![](../../users/profiles/9080991.webp)
fermi
- 168
- 2
- 6
2
votes
1 answer
MySQL 5.x - Can you explain this weirdness?
Running the query ...
SELECT !(!0), ! !0, !!0 AS WTF;
in MySQL yields the following output ...
-------------------------
!(!0) | ! !0 | WTF
-------------------------
0 | 0 | 1 # <- What's going on here?
I can't seem to…
![](../../users/profiles/657916.webp)
famagusta
- 67
- 6
2
votes
1 answer
Prolog - ASP 'not' to Prolog negate
I have an example problem in Answer Set Programming (ASP). When I try to make the equivalent code in Prolog, I keep getting stuck with the not blocked.
This is the ASP…
![](../../users/profiles/6748664.webp)
becky
- 23
- 4
2
votes
2 answers
Suggestions on negating a regex expression/Lookaround search
Very new to regex and was hoping someone could help me with the syntax of negating a regex search. Let me elaborate. I want to look at a packet/information and trigger a positive alert if one (or more) of multiple criteria is not found.
For…
![](../../users/profiles/4694183.webp)
joseph
- 21
- 2