getsingle | R Documentation |
getsingle splits up a text line and translates the first non-empty character string into a number. This function can be useful when parsing an input data file.
getsingle(inline, sep = ",")
inline |
the line of text, usually taken after using readLines to read in a text file |
sep |
the separator used to divide the numbers from descriptive text, defaults to a comma. |
a single number
x <- "12.3 , this is a number"
y <- "21.3 # 22.3 # here are two numbers"
getsingle(x)
getsingle(y,sep="#")
getsingle(y) # be sure to get the separator correct
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.