Dividing two parameters from string in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Dividing two parameters from string in R

korosig
I want to make a function in r which will divide two parameters from an undefined long string. The input parameter will be smothing like this: a <- "1-2931.0356917386653/2-5329.690008269986/4-857.0836085854653" b <- "1-56455.0/2-70413.0/4-4247.0" the numbers with hyphen ("1-","2-","4-") and divide sign ("/")help us to find unique data and the correlation with two parameters, and it is not counted while I will divide the numbers. Output has to be: C <- a/b where I will divide 2931.0356917386653 / 56455.0 , 5329.690008269986 / 70413.0, 857.0836085854653 / 4247.0 which give this results: C = 1-0.051918/2-0.0756918/4-0.2018091 The length of the string is not fixed, and the numbers (1- , 2- , 3-, etc.) could more or less, depend on the data. I want to use this function to divide two csv table, with the cell by cell.