Organize data in excel

2

I have a file with 59 comments and 93 variables in Excel file and I have converted it to .csv. to create the table in R, however my 93 variables appear in the same column. How do I make them appear separate?

    
asked by anonymous 06.08.2016 / 22:28

3 answers

2

Try to run the command

read.table(file="nomedoarquivo.csv", header=T, sep=",") 

This command will work if your file has named columns. If the columns are not named, replace the header = T argument with header = F.

    
06.08.2016 / 22:59
1

If you saved .csv from excel in Portuguese, you should use read.csv2 . As for read.csv , it changes because it uses sep = ";" and dec = "," , which is the non-American standard.

It's also worth using stringsAsFactors = FALSE to avoid mess with non-numeric columns:

read.csv2("arquivo.csv", stringsAsFacotrs = FALSE)
    
07.08.2016 / 04:10
1

Read straight from Excel using the readxl package

read_excel("arquivo.xlsx")

You can still use the sheet argument if your spreadsheet has multiple tabs. Read the help using ?read_excel . And before all this do not forget to install the package: install.packages("readxl") .

Reading Excel directly has the advantage of already reading numbers, dates, and strings correctly without having to save .csv .

    
08.08.2016 / 00:00