+1443 776-2705 panelessays@gmail.com
  

HIM 650 Topic 6 DQ 2
answer
Data structures or objects in R are used to organize and store your data. They can be as simple as something like a vector, or a complex collection of variables and functions like a list.
It is often useful to associate data with an object in R. Attributes can take different forms and are used for different purposes. In this chapter, we will discuss various types of attributes and when they are used.
R has data structures. R has three types of objects: scalars, vectors, and lists.
Every R object has an index that consists of two components—method and class. Every R object belongs to a class, with the exception of the NULL object, which is the only object without a class. Classes can be specified or can be assigned automatically by R. Attributes can be specified or can be assigned automatically by R, or they do not exist at all in the specific case of NULL objects.
Data structures are used in computer programs to store, modify, and retrieve data. They are called data structures because they are solely being used for storing data. In R, these data structures include but are not limited to, characters (character), factors (factor), strings (character), integer numbers (integer or double), logical numbers (logical or integer 0 and 1), doubles (numeric), complex numbers (complex), date object of class POSIXlt(POSIXt), time object of class POSIXct(POSIXct) and duration object of class POSIXlt.
Attributes are user-defined name-value pairs that can be attached to any R object. They provide a simple, flexible way to annotate objects in R and can be used to extend the range of information available from a function. Attributes have one of four attributes: “S3”, “S4”, “S5” or “S4S5”.
Objects are instances of classes. Classes are templates for objects: one class, called the child class, is a specialization of another class, called the parent class . An object contains a field for each attribute and has methods for accessing and/or setting each attribute. The values of the attributes can be retrieved and changed using language functions that operate on objects. Attributes are often themselves objects: for example, a vector (which is a list) has attributes like , which indicates its length.
An attribute is simply a piece of recorded information about an object. For example, we know from the documentation that class(x) returns an S3 object used to define classes. There is also an attribute attached to this object called methods which simply stores a character vector containing the names of all the methods that belong to the class x
A vector is a named list of objects that are all of the same type.
 
 
 
 
question
Consider R language definitions using resources provided in the study materials. Define the term data structures or objects in R and discuss several examples (e.g., vectors, lists, language objects, symbol objects, expression objects,function objects, NULL, etc.). All R objects have attributes. What is the purpose of attributes?