I need to write a function in R, since in other languages like c++ it works very slow. The function fills a 2d table with data, and then summarizes values of each row for further processing.
Asked
Active
Viewed 40 times
0
-
Welcome to SO! Please consider [taking the tour](https://stackoverflow.com/tour). Users are more likely to help if you (1) do some [research yourself](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users), (2) learn [how to ask](https://stackoverflow.com/help/how-to-ask) questions, and (3) provide a [minimal reproducible example/attempt](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), including sample data. – Maurits Evers Feb 18 '18 at 10:55
-
Please go through [Help Center](https://stackoverflow.com/help) and [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) before you ask. – Krzysztof Lach Feb 18 '18 at 10:58
1 Answers
0
I am not sure if it answers your question, but if you work with data you can put them into data frames to take a look at the statistical parameters and for further processing. For example:
df = data.frame("var1" = c(5,10,15), "var2" = c(20,40,60))
#the 'summary' command gives you some statistical parameters based on the column
summary(df)
#with the 'apply' command you can addresses the rows.
#in this example you get the mean of each row:
apply(df, 1,mean)

Carolus Fridericus
- 154
- 9