Functions always involve parentheses to enclose the relevant arguments, and function names make up the R language. In R, object names are arbitrary and will generally vary to fit a particular application or study. For example, the mean age of these 5 infants can be calculated using the ' mean( )' function: We can use this object name in later analyses. The ' ' the R gives at the start of the line is a counter – this line starts with the first value in the object (this is helpful with larger data sets when the print out extends over several lines). Here, agemos is the name we are giving to the object that we will be creating. > agemos ' is the ready prompt given by R, indicating that R is ready for our input (R typed the >, I typed the rest of the line). To enter these data into R and give the name 'agemos' to these data, we can use the command: In R, these values can be represented as a column vector (as a data set, these values would be arranged in one column for the variable age, with 5 rows). For example, suppose we have a sample of 5 infants with ages (in months) of 6, 10, 12, 7, 15. The 'assign operator' in R is used to assign a name to an object. The methods in this handout are not the only way to perform these analyses through R, and you should feel free to experiment and explore.ġ.2 The assign operator and inputting a data vector into R
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |