Differences

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

Link to this comparison view

Last revision Both sides next revision
r_communication_utilities [2017/01/17 17:21]
romulo created
r_communication_utilities [2017/01/17 17:45]
romulo
Line 1: Line 1:
 ====== Helper functions for R -> Dinamica communication ====== ====== Helper functions for R -> Dinamica communication ======
 +
 +===== Access a table column by its name =====
 +Suppose there is a **Table** stored in the variable **myTable** and the user wants to access the column named **Data**:
 +<code rsplus>
 +myTable$Data
 +</​code>​
 +
 +===== Discover the type of a variable =====
 +<code rsplus>
 +typeof( variableName )
 +</​code>​
 +
 +===== Convert a variable to Character =====
 +Suppose there is a **Table** stored in the variable **myTable** and the column **Names** refer to a column of **Factors**
 +<code rsplus>
 +myTable$Names <- as.character( myTable$Names )
 +</​code>​
 +
 +===== Read a .CSV file to Table =====
 +Suppose the file to be read is located at C:/​Users/​Default/​Documents/​information.csv
 +<code rsplus>
 +newTable <- read.csv( "​C:/​Users/​Default/​Documents/​information.csv",​ stringsAsFactors = FALSE )
 +</​code>​
 +