User Tools

Site Tools


en:data_import

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
en:data_import [2017/10/11 20:36]
127.0.0.1 external edit
en:data_import [2017/12/24 16:42]
David Zelený [Import of data into R]
Line 47: Line 47:
 Before importing the file into R, make sure that **all variable names are valid R names**. Valid name can contain letters, numbers, dots and underline characters; it should start with a letter (not a number) or dot not followed by a number. R is case sensitive, which means that uppercase and lowercase letters have a different meaning. Examples of **valid names**: ''​var_1'',​ ''​var.1'',​ ''​.var1'',​ ''​var_1.1'',​ ''​Var1''​. **Not valid names** include ''​1var'',​ ''​1_var'',​ ''​.1vars''​. There is also a list of **reserved words** which cannot be used as variable names, since they have fixed meaning in R: ''​if'',​ ''​else'',​ ''​repeat'',​ ''​while'',​ ''​function'',​ ''​for'',​ ''​in'',​ ''​next'',​ ''​break'',​ and also ''​TRUE'',​ ''​FALSE'',​ ''​NULL'',​ ''​Inf'',​ ''​NaN'',​ ''​NA'',​ ''​NA_integer_'',​ ''​NA_real_'',​ ''​NA_complex_'',​ ''​NA_character_''​. Before importing the file into R, make sure that **all variable names are valid R names**. Valid name can contain letters, numbers, dots and underline characters; it should start with a letter (not a number) or dot not followed by a number. R is case sensitive, which means that uppercase and lowercase letters have a different meaning. Examples of **valid names**: ''​var_1'',​ ''​var.1'',​ ''​.var1'',​ ''​var_1.1'',​ ''​Var1''​. **Not valid names** include ''​1var'',​ ''​1_var'',​ ''​.1vars''​. There is also a list of **reserved words** which cannot be used as variable names, since they have fixed meaning in R: ''​if'',​ ''​else'',​ ''​repeat'',​ ''​while'',​ ''​function'',​ ''​for'',​ ''​in'',​ ''​next'',​ ''​break'',​ and also ''​TRUE'',​ ''​FALSE'',​ ''​NULL'',​ ''​Inf'',​ ''​NaN'',​ ''​NA'',​ ''​NA_integer_'',​ ''​NA_real_'',​ ''​NA_complex_'',​ ''​NA_character_''​.
  
-Species names of taxa, consisting of genus, species and sometimes subspecific latin name, may need to be **abbreviated**. This is not because R cannot handle long names of variables (it can, up to 255 characters),​ but before ​long species names may be difficult to display, e.g. in ordination diagram. Library ''​vegan''​ contains handy function ''​make.cepnames'',​ which abbreviates species names into up to 8 letters abbreviations;​ it takes four first letters from genus name and merges them with first four letters from species names.+Species names of taxa, consisting of genus, species and sometimes subspecific latin name, may need to be **abbreviated**. This is not because R cannot handle long names of variables (it can, up to 255 characters),​ but because ​long species names may be difficult to display, e.g. in ordination diagram. Library ''​vegan''​ contains handy function ''​make.cepnames'',​ which abbreviates species names into up to 8 letters abbreviations;​ it takes four first letters from genus name and merges them with first four letters from species names.
  
 [[data_import_examples|Example section]] contains various examples how to import data from other sources and formats into R. [[data_import_examples|Example section]] contains various examples how to import data from other sources and formats into R.
  
en/data_import.txt · Last modified: 2019/02/09 19:44 by David Zelený