Hi,

Thanks again for your help with this. I would like to use a variation of
this function in a similar dataset (numeric) with elements separated by a
comma e.g. 

dat <- read.table(tc <- textConnection(
'0,1 1,3 40,10 0,0
20,5 4,2 10,40 10,0
0,11 1,2 120,10 0,0'), sep="")

to simply calculate the frequency of the first number divided by the total
number, i.e. x[1]/sum(x).

to produce:

   [,1]  [,2]  [,3]  [,4]
[1,] 0   0.25  0.8  NaN
[2,] 0.8  0.33  0.2  1
[3,] 0  0.33  0.92  NaN


My actual dataset is an enormous file (800,000 rows and 100 columns). Any
advice on how I can do this, maybe using gsubfn?

Thank you very much!


-- 
View this message in context: 
http://r.789695.n4.nabble.com/function-using-values-separated-by-a-comma-tp2967870p2999723.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to