What is the use of the function I() ?
Change the class of an object to indicate that it should be treated ‘as is’.

Function I has two main uses.

In function data.frame. Protecting an object by enclosing it in I() in a call to data.frame inhibits the conversion of character vectors to factors and the dropping of names, and ensures that matrices are inserted as single columns. I can also be used to protect objects which are to be added to a data frame, or converted to a data frame via as.data.frame.

It achieves this by prepending the class “AsIs” to the object’s classes. Class “AsIs” has a few of its own methods, including for [, as.data.frame, print and format.

In function formula. There it is used to inhibit the interpretation of operators such as “+”, “-”, “*” and “^” as formula operators, so they are used as arithmetical operators. This is interpreted as a symbol by terms.formula.

What is the use of the function offset() ?

An offset is a term to be added to a linear predictor, such as in a generalised linear model, with known coefficient 1 rather than an estimated coefficient.