multiply_csv | R Documentation |
This function takes a character vector containing comma-separated numbers and
multiplies each number by 100. It handles missing values (NAs) by returning NA
for elements that cannot be converted to numeric.
multiply_csv(x, k = 100)
x |
A character vector containing comma-separated numbers. |
k |
The number to multiply by. Default |
A character vector with the same number of elements as x
,
where each element is the product of the original number and k
,
or NA if the original element could not be converted to numeric.
x <- c("0.1,0.2,NA,0.3", "0.4,0.5,NA,0.66")
multiply_csv(x)
# "10,20,NA,30" "40,50,NA,66"
y <- c("0.2,!!,0.9,NA", "*,NA,0.015")
multiply_csv(y)
# "20,NA,90,NA" "NA,NA,1.5,NA"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.