As @thijs van den bergh points you to,
dat <- data.frame(x=c("NaN","2"),y=c("NaN","3"),stringsAsFactors=FALSE) dat <- as.data.frame(sapply(dat, as.numeric)) #<- sapply is here dat[complete.cases(dat), ] # x y #2 2 3
Is one way to do this.
Your error comes from trying to make a data.fr
Related Posts:
- Convert data.frame column to a vector?
- Create empty data frame with column names by assigning a string vector?
- How to remove outliers from a dataset
- Insert a blank column in dataframe
- Convert data.frame columns from factors to characters
- dplyr: “Error in n(): function should not be called directly”
- Error in eval(expr, envir, enclos) : object not found
- How do I convert a factor into date format?
- Write lines of text to a file in R
- scale_fill_discrete and scale_fill_manual – legend options confusion
- ‘Incomplete final line’ warning when trying to read a .csv file into R
- Conditional mean statement
- R error: “New Column would leave holes after existing columns”
- Warning in GLM analysis
- What does ‘length of ‘dimnames’ [1] not equal to array extent’ mean?
- How do I flip rows and columns in R
- How to catch integer(0)?
- “no function to return from, jumping to top level”
- r random forest error – type of predictors in new data do not match
- env=baseenv() in R
- Sample random rows in dataframe
- Removing punctuations from text using R
- How to find out which package version is loaded in R?
- How to solve it. error:Error in data[[rowvar]] : attempt to select less than one element
- Gradient of n colors ranging from color 1 and color 2
- How to prevent scientific notation in R?
- What is the difference between require() and library()?
- How to declare a vector of zeros in R
- R Sweave: NO TeX installation detected
- ERROR: [on_request_read] connection reset by peer in R shiny
- Error in as.vector(x, mode) : cannot coerce type ‘closure’ to vector of type ‘any’
- Suppress output of a function
- Error in G * t(hat) : non-conformable arrays
- Error: isTRUE(gpclibPermitStatus()) is not TRUE
- How to counter the ‘non-numeric matrix extent’ error in R?
- What does is.na() applied to non-(list or vector) of type ‘NULL’ mean?
- error r: invalid subscript type “closure” in a simple regression
- Merge two rows in data.frame
- r function unzip error 1 in extracting from zip file
- Get the list of installed packages by user in R
- Colour points in a plot differently depending on a vector of values
- How to access the last value in a vector?
- increase legend font size ggplot2
- Mask output of `The following objects are masked from….:` after calling attach() function
- How To Create Vector of Vector In R
- Use of ~ (tilde) in R programming Language
- Construct a manual legend for a complicated plot
- Code to clear all plots in RStudio
- Error: x must be atomic for ‘sort.list’
- How can I change the name of a data frame
- Installing R on Android
- Transposing in dplyr
- Does the c command create a row vector or a column vector by default in R
- Error in summary.connection(connection) : invalid connection
- How to create lag variables
- When trying to replace values, “missing values are not allowed in subscripted assignments of data frames”
- R Hex to RGB converter
- Renaming column names in Pandas
- Delete a column from a Pandas DataFrame
- Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
- Get statistics for each group (such as count, mean, etc) using pandas GroupBy?
- Adding new column to existing DataFrame in Python pandas
- How to change the order of DataFrame columns?
- How do I select rows from a DataFrame based on column values?
- How do I get the row count of a Pandas DataFrame?
- Convert pandas dataframe to NumPy array
- Editing legend (text) labels in ggplot
- How do I get the row count of a Pandas DataFrame?
- ‘DataFrame’ object has no attribute ‘sort’
- Rename Pandas DataFrame Index
- Convert DataFrame column type from string to datetime, dd/mm/yyyy format
- Get a list from Pandas DataFrame column headers
- Replace a value in a data frame based on a conditional (`if`) statement
- Shuffle DataFrame rows
- How to randomize ggplot factor color scheme, keeping same default distances on color wheel?
- Count number of occurences for each unique value
- Python: create a pandas data frame from a list
- Mean per group in a data.frame
- Error in dev.off() : cannot shut down device 1 (the null device)
- Selecting/excluding sets of columns in pandas
- What is the difference between = and ==?
- Merge r brings error “‘by’ must specify uniquely valid columns”
- What does the error “arguments imply differing number of rows: x, y” mean?
- Non-numeric argument to mathematical function
- pandas dataframe convert column type to string or categorical
- R – Concatenate two dataframes?
- Pandas DataFrame: replace all values in a column, based on condition
- R multiple conditions in if statement
- Data type conversion error: ValueError: Cannot convert non-finite values (NA or inf) to integer
- Pandas – How to flatten a hierarchical index in columns
- Simple manual RMarkdown tables that look good in HTML, PDF and DOCX
- Select rows from a data frame based on values in a vector
- Filter data.frame rows by a logical condition
- How to plot 3D scatter diagram using ggplot?
- Groupby value counts on the dataframe pandas
- How to melt and cast dataframes using dplyr?
- use first row data as column names in r
- Boolean operators && and ||
- Getting the IP address of the current machine using Java
- Got continuous is not supported error in RandomForestRegressor