-1

I am trying to import the data from the CSV file. The code I used is below

New <- read.table("New.csv", fill="TRUE") 

and below is the CSV file data:

Name    Sex Age Score   Aspirations
Rhea    F   18  98  Doctor
John    M   17  90  Engineer
Rads    F   21  87  Air Hostess

The R console is sending me an error and I am not sure how to deal with this. I am a beginner in R.

Error in fill && length(col.names) > cols : invalid 'x' type in 'x && y'

Fatemeh Abdollahei
  • 3,040
  • 1
  • 20
  • 25

2 Answers2

0

Remove the quotation marks from TRUE, so it reads

New <- read.table("New.csv", fill=TRUE) 
JeffR
  • 524
  • 3
  • 10
0

Try specifying the file path, and ensuring the file type is a CSV. Note an Excel file is not the same thing as a CSV file. You must open the Excel workbook, click File > Save As > CSV, to create the CSV file.

Also, unless you've specified a working directory or saved the CSV to your desktop, you must do so by the following:

New <- read.csv("C:/Users/YOUR-USERNAME/Desktop/New.csv")

Note, you must use forward slashes instead of backslashes. You can find the file path by right-clicking and selecting properties.

Let me know if this works.