Skip to main content

All Questions

Tagged with
2 votes
1 answer
51 views

Attaching infix operators

Benefit of attaching objects (you can skip this) In a sourced script, it can be convenient to define our helper funcs like this: f <- function() print('hi') e <- new.env() assign("f", ...
antonio's user avatar
  • 10.9k
1 vote
1 answer
36 views

Conditional negation of T/F vector

Can the ! operator, or its opposite, be assigned dynamically to a variable then serve as a calculation input? There is a set of data.frames whose subsets I switch depending on a T/F condition.  Here’s ...
InColorado's user avatar
0 votes
2 answers
44 views

Correct operator usage

I'm using IPUMS CPS data and created a binary variable for disability from the six different variables within IPUMS for disability (https://cps.ipums.org/cps-action/variables/group/core_dis) bias <-...
Hlb09d's user avatar
  • 5
0 votes
3 answers
466 views

"not like" operator

Is there a possibility to use filtering in dplyr and use negative of like operator? Something like (which does not work): my_df %>% filter(text !%like% "dirty talk")
Pawels's user avatar
  • 308
3 votes
2 answers
66 views

Escaping Custom Operators in R

One may define a new binary operator... `%my_op%` <- function(lhs, rhs) { # ... } ...and use it like so: 4 %my_op% 5 Experimentation shows that nearly any sequence of characters is valid, ...
Greg's user avatar
  • 3,286
1 vote
2 answers
615 views

Question about when to use "&" and "|" (OR) when using conditional operators "==" and "!=" in the dplyr::filter() function

I'm asking this question more out of curiosity. I was able to achieve my desired results using the filter() function but I'm interested in the explanation for the scenario below. I wanted to use ...
nps-randy's user avatar
0 votes
1 answer
66 views

What is the name of R Special Backtick and Parentheses Syntax?

I have recently encountered the following R syntax: (`::`("ggplot","aes"))() or (`$`(mylist,"column")) I understand what it does, but I struggle to find any ...
Pycruncher's user avatar
0 votes
1 answer
43 views

Why does ggplot change the position of the parameter values of data= and mapping= when using "pipe" operator?

hearted people who clicked in to see this question.I just started learning to use ggplot. ggplot(mpg) aes(x = displ) |> ggplot(mpg) The first command mpg is passed to ggplot as an argument to ...
Fengyang Han's user avatar
1 vote
1 answer
33 views

unexpected behabiour of operator $ in R [duplicate]

It seems that the R operator $ looks for a field name similar to the requested one if it does not exist, which seems to me to be a totally inexperienced and very dangerous behaviour. I have reproduced ...
vdebuen's user avatar
  • 31
2 votes
1 answer
38 views

Why logical operations in dataframe iteration doesn't return the right values?

I'm trying to perform a logic test on two dataframes. If zero is included in the delimited interval between dataframe elements, the label 'Not Significant' must be included, otherwise, if zero is not ...
cavalcantelucas's user avatar
0 votes
1 answer
52 views

HUGE processing speed difference in running apparently similar codes - resulted by using $ instead of a pipe?

R newbie here. So I'm running a big df (> 5.7m rows) in R. It has the following col_names() columns, and within day_of_week are values like "Fri", "Wed"...you know, the days. [...
Abooboo's user avatar
1 vote
1 answer
502 views

what does a colon (:) do in a linear mixed effects model analysis?

Let me clarify that I am a complete beginner at R. I'm working on a problem and having a bit of trouble understanding a formula I'm supposed to use in a linear mixed effects model analysis of a ...
lost student's user avatar
1 vote
1 answer
63 views

Print a matrix flattened by column using a separator

I have the following matrix made from a vector of vectors, which I want to print separated by the & operator. vec1 <- c(1, 2, 3, 4) vec2 <- c(5, 6, 7, 8) vec3 <- c(9, 10, 11, 12) ...
Daniel James's user avatar
  • 1,403
0 votes
0 answers
50 views

non-numeric argument to binary operator error while my data are numeric

I have following code to filter my data which is a large csv file. Running the following code, gives the error: Error in gedi_table[, col_index] - gedi_table$digital_elevation_model_srtm : non-...
user3713988's user avatar
0 votes
1 answer
46 views

Can I assign an ALIAS to a help option?

In R, the I believe the core features such as "+" or "?" are called "operators" (they are I believe in most programming languages: an operator as a symbol to perform a ...
mshaffer's user avatar
  • 973

15 30 50 per page
1
2 3 4 5
11