User Tools

Site Tools


en:data_import_r

This is an old revision of the document!


Data types and import into R

R functions

  • read.table - reads table in a plain text with cells delimited by some symbol (default setting for delimiter is sep = “”, i.e. one or more white spaces, tabs, newlines or returns).
  • read.delim - reads table delimited by tabulators.
  • read.csv - reads table delimited by commas (,), with decimals being dots (.).
  • read.csv2 - reads table delimited by semicolons (;) and decimals being commas (,).
  • read.cep (library vegan) - reads legacy canoco condensed files (usually with extension *.cep or *.cc!); the function can get quite slow for large datasets - if the speed is an issue, consider using readCEP from cepreader package (also maintained by Jari Oksanen)
  • read.CEP (library rioja) the same as read.cep from vegan and readCEP from cepreader; the package rioja has also function write.CEP producing cep files.

Note that by default, functions like read.table, read.delim, read.csv and read.csv2 import the columns containing characters strings into R as factors. If you don't like this behaviour, change the setting of stringsAsFactors argument into FALSE. If you want to know why this behaviour is set to default, read this blog post.

en/data_import_r.1549181114.txt.gz · Last modified: 2019/02/03 16:05 by David Zelený