Say I have data.frame a
I use
m.fit <- lm(col2 ~ col3 * col4, na.action = na.exclude)
col2
has some NA
values, col3
and col4
have values less than 1.
I keep getting
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in foreign function call (arg 1)
I’ve checked the mailing list and it appears that it is because of the NA
s in col2
but I tried using na.action=na.exclude/omit/pass
but none of them seem to work. I’ve tested lm
again on first 10 entries, definitely not because of the NA
s. Problem with this warning is every google results seem to be pointing at NA
.
Did I misinterpret the error or am I using lm
wrongly?
Data is at kaggle. I’m modelling MonthlyIncome data using linear regression (as I couldn’t get a certain glm
family to work). I’ve created my own variables to use but if you try to model MonthlyIncome with variables already present it fails.
Related Posts:
- Emulate ggplot2 default color palette
- ggplot wrong color assignment
- How to rename a single column in a data.frame?
- Could not find function “%<>%” with dplyr loaded
- R Error in x$ed : $ operator is invalid for atomic vectors
- 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”?
- Error: could not find function “%>%”
- What does na.rm=TRUE actually means?
- Error in if/while (condition) {: missing Value where TRUE/FALSE needed
- How to change legend title in ggplot
- Changing column names of a data frame
- Counting the number of elements with the values of x in a vector
- Non-numeric Argument to Binary Operator Error in R
- Non-numeric Argument to Binary Operator Error in R
- Error in Confusion Matrix : the data and reference factors must have the same number of levels
- Error in file(file, “rt”) : invalid ‘description’ argument in complete.cases program
- 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?
- Extracting value specific rows in R
- “Error: Mapping should be created with `aes()` or `aes_()`.”
- Principal Components Analysis:Error in colMeans(x, na.rm = TRUE) : ‘x’ must be numeric
- plot.new has not been called yet
- Error in lm.fit(x,y,offset = offset, singular.ok,…) 0 non-NA cases with boxcox formula
- Persistent invalid graphics state error when using ggplot2
- 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]
- Why am I getting “algorithm did not converge” and “fitted prob numerically 0 or 1” warnings with glm?
- Add text to ggplot
- Rotating and spacing axis labels in ggplot2
- Opposite of %in%: exclude rows with values specified in a vector
- Using Caret Package but Getting Error in library(e1071)
- Reading PSV (pipe-separated) file or string
- plot.new has not been called yet
- Subscript out of bounds – general definition and solution?
- 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
- Function to clear the console in R and RStudio
- Adding a regression line on a ggplot
- Invalid factor level, NA generated warning
- invalid type (list) for variable
- Error: unexpected ‘}’ in “}” in R [duplicate]
- Error in table “all arguments must have the same length”
- How to not run an example using roxygen2?
- Add empty columns to a dataframe with specified names from a vector
- Error with apply function
- `fread` with headers with special characters (latin1) and unusual nested quotes
- Generate a set of random unique integers from an interval
- How to move or position a legend in ggplot2
- Rotating and spacing axis labels in ggplot2
- “installation of package ‘FILE_PATH’ had non-zero exit status” in R
- Plot multiple lines (data series) each with unique color in R
- reshape2 melt warning message
- Replace all particular values in a data frame
- Plot a legend outside of the plotting area in base graphics?
- Still getting error in dev.off() : cannot shut down device 1 (the null device)
- How to sum a variable by group
- lme4 error: boundary (singular) fit: see ?isSingular
- dcast warning: ‘Aggregation function missing: defaulting to length’
- How to get summary statistics by group
- Non-conformable arrays error in code
- object of type ‘builtin’ is not subsettable
- What causes an R script to get Killed?
- Combine two data frames by rows (rbind) when they have different sets of columns
- Function to calculate R2 (R-squared) in R
- dplyr mutate with conditional values
- `Error in file(con, “r”) : cannot open the connection` from running BRugsFit()
- Getting invalid model formula in ExtractVars when using rpart function in R
- Too few periods for decompose()
- How to solve prcomp.default(): cannot rescale a constant/zero column to unit variance
- incorrect number of subscripts on matrix in R
- How Do You Compare Two Strings in R?
- changing title in multiplot ggplot2 using grid.arrange
- How to split data into training/testing sets using sample function
- Correct syntax for mutate_if
- Creating a Plot Window of a Particular Size
- 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
- Error in eval(predvars, data, env) : object ‘Rm’ not found
- How to initialize a vector with fixed length in R
- Efficiently sum across multiple columns in R
- How do I clean up R memory without restarting my PC?
- Side-by-side plots with ggplot2
- lib unspecified & Error in loadNamespace
- How to convert data.frame column from Factor to numeric [duplicate]
- Merge data frames based on rownames in R
- What do these R glm error messages mean: “Error: no valid set of coefficients has been found: please supply starting values”
- Remove columns from dataframe where some of values are NA
- why nrow(dataframe) and length(dataframe) in r give different results?
- how to add dashed horizontal line with label in ggplot
- cbind warnings : row names were found from a short variable and have been discarded
- What is the meaning of the dollar sign “$” in R function()?
- Filter rows which contain a certain string
- How can I change the name of a data frame
- How to calculate combination and permutation in R?