For loop or Macro function available in R?

Has anyone made a loop or macro code with describe/describeby command?

all I want is change below into short codes, I have plenty of (dt,ft,ds,fs..)

describe(dt)
describe(ft)
describe(ds)
describe(fs)
describeBy(dt,group=sex)
describeBy(dt,list(ad,sex))
describeBy(dt,list(en,sex))
describeBy(ft,group=sex)
describeBy(ft,list(ad,sex))
describeBy(ft,list(en,sex))
describeBy(ds,group=sex)
describeBy(ds,list(ad,sex))
describeBy(ds,list(en,sex))
describeBy(fs,group=sex)
describeBy(fs,list(ad,sex))
describeBy(fs,list(en,sex))

I'm new to R-world and so much confused :frowning:

Hi,

if you are new to data manipulation with R, you could find this book useful

It also contains a chapter about iteration : https://r4ds.had.co.nz/iteration.html

Hope this helps.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.