title: Compare column types between two tables
body: <p>If I have two tables (File1) and (File2)</p>
  
  <pre><code>&gt; dput(File1)
  structure(list(Column.1 = structure(1:3, .Label = c("Row 1", 
  "Row 2", "Row 3"), class = "factor"), Column.2 = c(NA, NA, NA
  ), Column.3 = c(NA, NA, NA), colNames = c(TRUE, TRUE, TRUE)), class = "data.frame", row.names = c(NA, 
  -3L))
  &gt; dput(File2)
  structure(list(Column.1 = structure(1:3, .Label = c("Row 1", 
  "Row 2", "Row 3"), class = "factor"), Column.2 = c(1, 2, 34), 
      Column.3 = c(NA, NA, NA), colNames = c(TRUE, TRUE, TRUE)), class = "data.frame", row.names = c(NA, 
  -3L))
  </code></pre>
  
  <p>and I want to confirm that the Column Names, Column Types, and Number of Rows and Columns between File 1 and File 2, returning a TRUE if they are all the same and a FALSE if not, how can I add on to this code that I have written?</p>
  
  <p>I tried some of the answers in <a href="https://stackoverflow.com/questions/45743991/r-compare-column-types-between-two-dataframes">Compare column types between two data frames</a>, but I am only looking for a TRUE or FALSE answer.  Here's my current code.</p>
  
  <pre><code>check_file &lt;- function(File1 , File2) {
    if (!nrow(File1) == nrow(File2)) {
      print("Non matching number of rows")
      return(FALSE)
  
    } else if (!ncol(File1) == ncol(File2)) {
      print("non matching number of columns")
      return(FALSE)
    } else if (length(grep("FALSE", names(File1) == names(File2)))&gt;0){
      print("Non matching names of columns")
      return(FALSE)
    }else if (!class(File1)==class(File2)){
        print("Non matching column types")
      }
    return(TRUE)
  }
  
  
  check &lt;- check_file(File1, File2)
  
  
  if (check) {
    return(TRUE)
  } else{
    return(FALSE)
  }
  </code></pre>
  
  <p>I think all that´s left is the types.  For example, in the dput File 2 Column 2 has numbers while File 1 has NA. They don´t have to be the same numbers, but it needs to return false since it´s NA. If File 1 had 3,2,564, it should return TRUE.</p>