Useful R commands and techniques

A collection of some frequently used R commands.

Creating column for categorical group assignment. Shown below is to assign A/B/C according to some existing values.

Similarly for new column for derived values from existing column.

Sampling using the sampling package with strata.

With R Studio, view command can be invoked from clicking the variable under the Environment tab, and the frame will then be listed nicely in a tabular format in the data frame window.

Data frame at a glance – head, str, summary.R-Technique3-head-str-summary


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s