You have some problems in your syntax.
Note that you have converted gender to a factor
variable with values of “1” and “2” instead of “M” and “F”. If you run your code line-by-line, I’ll guess that it should work up to your last set of histograms.
Change those lines to:
hist(d$received[d$negotiated == TRUE & d$gender == 2], main = 'Male Employees Who Negotiated Raises' ) hist(d$received[d$negotiated == TRUE & d$gender == 1], main = 'Female Employees Who Negotiated Raises' )
Also, notice that I changed &&
to &
. Run d$negotiated == TRUE & d$gender == 2
and d$negotiated == TRUE && d$gender == 2
to see how they are different from each other.
Related Posts:
- R Hex to RGB converter
- Counting the number of elements with the values of x in a vector
- Non-numeric Argument to Binary Operator Error in R
- Error in ggplot.data.frame : Mapping should be created with aes or aes_string
- Error in file(file, “rt”) : invalid ‘description’ argument in complete.cases program
- SummarySE (Rmisc package) to produce a barplot with error bars (ggplot2)
- Editing legend (text) labels in ggplot
- Logistic Regression on factor: Error in eval(family$initialize) : y values must be 0 <= y <= 1
- R – longer object length is not a multiple of shorter object length
- Error: attempt to use zero-length variable name
- “non-numeric argument to binary operator” error in R
- Replace all particular values in a data frame
- How can I convert Json to data frame in R
- Error in xj[i] : invalid subscript type ‘list’
- How do you specifically order ggplot2 x axis instead of alphabetical order?
- Sample random rows in dataframe
- Batch convert columns to numeric type
- Deleting rows that are duplicated in one column based on the conditions of another column
- Replace all 0 values to NA
- What is the meaning of the dollar sign “$” in R function()?
- How can I change the name of a data frame
- In R, dealing with Error: ggplot2 doesn’t know how to deal with data of class numeric
- Poker hand range chart visualization in R
- Emulate ggplot2 default color palette
- ggplot wrong color assignment
- How to rename a single column in a data.frame?
- How to coerce a list object to type ‘double’
- $ operator is invalid for atomic vectors for dataframe R
- ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”
- How to open CSV file in R when R says “no such file or directory”?
- What does na.rm=TRUE actually means?
- Remove legend ggplot 2.2
- How to change legend title in ggplot
- Changing column names of a data frame
- Update R using RStudio
- ‘x’ and ‘y’ lengths differ ERROR when plotting
- Difference between paste() and paste0()
- Drop data frame columns by name
- Error in Confusion Matrix : the data and reference factors must have the same number of levels
- Error in colMeans(x, na.rm = TRUE) : ‘x’ must be numeric, What should I do in this situation?
- “Error: Mapping should be created with `aes()` or `aes_()`.”
- Principal Components Analysis:Error in colMeans(x, na.rm = TRUE) : ‘x’ must be numeric
- “Error: Continuous value supplied to discrete scale” in default data set example mtcars and ggplot2
- cannot coerce type ‘closure’ to vector of type ‘character’
- Logistic regression – eval(family$initialize) : y values must be 0 <= y <= 1
- Opposite of %in%: exclude rows with values specified in a vector
- What does %*% mean in R [duplicate]
- Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, …) 0 non-na cases
- plot.new has not been called yet
- R: need finite ‘ylim’ values in function
- How to save a data frame as CSV to a user selected location using tcltk
- Convert a list to a data frame
- Error: unexpected symbol/input/string constant/numeric constant/SPECIAL in my code
- Remove NA values from a vector
- character string is not in a standard unambiguous format
- Remove rows with all or some NAs (missing values) in data.frame
- duplicate ‘row.names’ are not allowed error
- Adding a regression line on a ggplot
- What does the double percentage sign (%%) mean?
- Error: unexpected ‘}’ in “}” in R [duplicate]
- Mean of a column in a data frame, given the column’s name
- Subscript out of bounds – general definition and solution?
- How to not run an example using roxygen2?
- file.path function in R
- Increase number of axis ticks
- Reshaping data.frame from wide to long format
- Converting data frame column from character to numeric
- How to assign colors to categorical variables in ggplot2 that have stable mapping?
- How to set limits for axes in ggplot2 R plots?
- duplicate ‘row.names’ are not allowed error
- Error: invalid subscript type ‘list’ in R
- What does “The following object is masked from ‘package:xxx'” mean?
- install.packages fails in knitr document: “trying to use CRAN without setting a mirror”
- Non-conformable arrays error in code
- How to convert a data frame column to numeric type?
- Boxplot dplyr: Error: non-numeric argument to binary operator
- Function to calculate R2 (R-squared) in R
- lmer error: grouping factor must be < number of observations
- Aggregate multiple columns at once
- installing data.table results in “there is no package”
- R histogram range error: some ‘x’ not counted; maybe ‘breaks’ do not span range of ‘x
- Error in eval(expr, envir, enclos) : object not found
- What is the meaning of the dollar sign “$” in R function()?
- How to split data into training/testing sets using sample function
- r random forest error – type of predictors in new data do not match
- env=baseenv() in R
- R4DS error comparison (1) is possible only for atomic and list types
- How to initialize a vector with fixed length in R
- Efficiently sum across multiple columns in R
- Gradient of n colors ranging from color 1 and color 2
- lib unspecified & Error in loadNamespace
- Suppress output of a function
- Error Error in storage.mode(x) <- "double" : 'list' object cannot be coerced to type 'double'
- Warning: non-integer #successes in a binomial glm! (survey packages)
- r function unzip error 1 in extracting from zip file
- Remove columns from dataframe where some of values are NA
- Colour points in a plot differently depending on a vector of values
- How To Create Vector of Vector In R
- invalid (do_set) left-hand side to assignment in R
- Does the c command create a row vector or a column vector by default in R