The issue is because plot()
is looking for vectors, and you’re feeding it one data.frame and one vector. Below is an illustration of some of your options.
mydata <- seq(1,5) # generate some data sq <- seq(1,5) plot(sq, mydata) # Happy (two vectors) x <- data.frame(sq) # Put x into data.frame plot(x, mydata) # Unhappy (one data.frame, one vector) (using x$seq works) ##Error in stripchart.default(x1, ...) : invalid plotting method x2 <- data.frame(sq, mydata) # Put them in the same data.frame ##x2 ## sq mydata ##1 1 1 ##2 2 2 ##3 3 3 ##4 4 4 ##5 5 5 plot(x2) # Happy (uses plot.data.frame)
Related Posts:
- Error in plot.window(…) : need finite ‘xlim’ values
- How do I select the first row in an R data frame that meets certain criteria?
- Poker hand range chart visualization in R
- What is the difference between importing matplotlib and matplotlib.pyplot?
- Error in file(file, “rt”) : cannot open the connection [duplicate]
- What does %>% function mean in R?
- How to join (merge) data frames (inner, outer, left, right)
- rbind error: “names do not match previous names”
- rbind error: “names do not match previous names”
- R Error in x$ed : $ operator is invalid for atomic vectors
- Plotting with ggplot2: “Error: Discrete value supplied to continuous scale” on categorical y-axis
- ggplot2 error : Discrete value supplied to continuous scale
- ggplot2 line chart gives “geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?”
- How do you change the size of figures drawn with Matplotlib?
- Error in if/while (condition) {: missing Value where TRUE/FALSE needed
- How to change legend title in ggplot
- Counting the number of elements with the values of x in a vector
- What does “Error: object ‘
‘ not found” mean? - Non-numeric Argument to Binary Operator Error in R
- mean() warning: argument is not numeric or logical: returning NA
- How to find the statistical mode?
- Error in colMeans(x, na.rm = TRUE) : ‘x’ must be numeric in KNN classification
- Error in file(file, “rt”) : invalid ‘description’ argument in complete.cases program
- Logistic Regression on factor: Error in eval(family$initialize) : y values must be 0 <= y <= 1
- rmarkdown error “attempt to use zero-length variable name”
- Error in lm.fit(x,y,offset = offset, singular.ok,…) 0 non-NA cases with boxcox formula
- Extract year from date
- Basic – T-Test -> Grouping Factor Must have Exactly 2 Levels
- R – longer object length is not a multiple of shorter object length
- incorrect number of dimensions and incorrect number of subscripts in array
- Rotating and spacing axis labels in ggplot2
- How to debug “contrasts can be applied only to factors with 2 or more levels” error?
- R t-test Grouping factor must have exactly 2 levels error
- R: Using equation with natural logarithm in nls
- What does c do in R?
- Understanding the order() function
- Reading PSV (pipe-separated) file or string
- Manually colouring plots with `scale_fill_manual` in ggplot2 not working
- Calculate correlation for more than two variables?
- Convert a list to a data frame
- Function to clear the console in R and RStudio
- Sum rows in data.frame or matrix
- Invalid factor level, NA generated warning
- R: “Unary operator error” from multiline ggplot2 command
- not a Stata version 5-12 .dta file
- Can’t draw Histogram, ‘x’ must be numeric
- No non-missing arguments warning when using min or max in reshape2
- Having trouble setting working directory
- Add empty columns to a dataframe with specified names from a vector
- Convert date-time string to class Date
- Linear model function lm() error: NA/NaN/Inf in foreign function call (arg 1)
- Generate a set of random unique integers from an interval
- Modify the legend of pandas bar plot
- Changing the “tick frequency” on x or y axis in matplotlib
- Rotating and spacing axis labels in ggplot2
- Singularity in backsolve at level 0, block 1 in LME model
- “installation of package ‘FILE_PATH’ had non-zero exit status” in R
- When to use cla(), clf() or close() for clearing a plot in matplotlib?
- Convert categorical variables to numeric in R
- Remove xticks in a matplotlib plot?
- How do I get RSS from a linear model output
- Warning message: In `…` : invalid factor level, NA generated
- Plot two graphs in same plot in R
- Mean of a column in a data frame, given the column’s name
- Replace all particular values in a data frame
- Still getting error in dev.off() : cannot shut down device 1 (the null device)
- Set the intervals of x-axis using r
- How to get summary statistics by group
- Run R script from command line
- Matrix expression causes error “requires numeric/complex matrix/vector arguments”?
- ‘height’ must be a vector or a matrix. barplot error
- NAs are not allowed in subscripted assignments
- Non-conformable arrays error in code
- Unused arguments in R
- How do I install an R package from source?
- Error: ggplot2 doesn’t know how to deal with data of class matrix?
- What is integer overflow in R and how can it happen?
- Creating box plot on exercise
- changing title in multiplot ggplot2 using grid.arrange
- How to sort a data frame by alphabetic order of a character variable in R?
- Error in na.fail.default(as.ts(x)) : missing values in object in time series forecasting
- Plotting data in R; error: default method not implemented for type ‘list’
- Error in contrib.url(repos, “source”) in R trying to use CRAN without setting a mirror Calls: install.packages -> contrib.url Execution halted
- Changing fonts in ggplot2
- Geometric Mean: is there a built-in?
- Error in xj[i] : invalid subscript type ‘list’
- Error in eval(predvars, data, env) : invalid ‘envir’ argument of type ‘character’
- run a for loop in parallel in R
- Error in na.fail.default: missing values in object – but no missing values
- Batch convert columns to numeric type
- IF “OR” multiple conditions
- Convert the values in a column into row names in an existing data frame
- Merge data frames based on rownames in R
- The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe
- What do these R glm error messages mean: “Error: no valid set of coefficients has been found: please supply starting values”
- Subset and ggplot2
- How do I print a hexadecimal number with leading 0 to have width 2 using sprintf?
- XY Plotting with Java
- How to calculate combination and permutation in R?
- How to deal with “data of class uneval” error from ggplot2?