BE-proff
●    

2015-09-04 01:03
(3576 d 15:49 ago)

Posting: # 15378
Views: 5,911
 

 How to write R codes? [🇷 for BE/BA]

Dear All,

R seems to be interesting for me so I try to learn to write R-codes ;-)
I know there are a lot of different scripts in the internet but my question is.
If I want to make a function which returns script result in format

mean1 xx
mean2 yy,

where xx and yy are computed values; mean 1 and mean 2 are fixed expessions.

How should a script be written? :confused:
yjlee168
★★★
avatar
Homepage
Kaohsiung, Taiwan,
2015-09-04 09:55
(3576 d 06:58 ago)

@ BE-proff
Posting: # 15379
Views: 4,892
 

 How to write R codes?

Dear BE-proff,

I am not sure if this is what you want (a function)?
BE.proff.mean<-function(){
xx<-c(1,2,3,4,5,6,7,8,9,10,11)
yy<-c(11,12,13,14,15,16,17,18)
cat("mean1:",mean(xx),"\n")
cat("mean2:",mean(yy),"\n")}
BE.proff.mean()


or you can write the script this way:

BE.proff.mean<-function(xx,yy){
cat("mean1:",mean(xx),"\n")
cat("mean2:",mean(yy),"\n")}
aa<-c(1,2,3,4,5,6,7,8,9,10,11)
bb<-c(11,12,13,14,15,16,17,18)
BE.proff.mean(aa,bb)

All the best,
-- Yung-jin Lee
bear v2.9.2:- created by Hsin-ya Lee & Yung-jin Lee
Kaohsiung, Taiwan https://www.pkpd168.com/bear
Download link (updated) -> here
BE-proff
●    

2015-09-04 12:28
(3576 d 04:25 ago)

@ yjlee168
Posting: # 15380
Views: 4,862
 

 How to write R codes?

Dear yjlee168,

Thank you very much - both codes work as I wish :ok:!
UA Flag
Activity
 Admin contact
23,424 posts in 4,927 threads, 1,676 registered users;
37 visitors (0 registered, 37 guests [including 9 identified bots]).
Forum time: 16:53 CEST (Europe/Vienna)

Philosophy, like medicine, has plenty of drugs, few good remedies,
and hardly any specific cures.    Sebastien-Roch Nicolas de Chamfort

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5