What is the preferred data source for R programs?

Which of the data formats listed in this link is the easiest to load for processing in R? A few minutes with a text editor should be enough to turn the text version into literal data, but can one of the other forms be loaded in less than O (n) user effort?

I found this list of IO styles , but it does not seem particularly useful.


Ps I have never used R before and am trying to help a friend who needs to do this.

+3
source share
3 answers

, R / . Excel, .

:

x <- read.table("file.txt", header=TRUE, sep="\t")
# or
x <- read.delim("file.txt") # header=TRUE and sep="\t" are already defaults
+4

, , / ?

- diffcult - .

+4

Of the options available to you, text files with tab delimiters are easiest to import. The following are SPSS files, and then everything else. I agree with other posters, avoid files with .xls (or convert individual books to tsv, csv.

An external package can be used to open these SPSS files, which are just as simple:

install.packages("foreign")
library(foreign)

setwd("/Path/to/your/files")
read.spss("FILENAME.sav", to.data.frame=T)
+1
source

Source: https://habr.com/ru/post/1766631/


All Articles