![]() ![]() ![]() # id female ses schtyp prog read write math science socst honors View(dat_csv)įor large data files, use head() and tail() to look at a specified number of rows at the begininning or end of a dataset, respectively. In RStuido, clicking on a dataset in the Environment pane will View() it. Use View() on a dataset to open a spreadsheet-style view of a dataset. Viewing data as a spreadsheet with View(), head() and tail() Try creating the vector (2,2,1,1) in at least two different ways. # the second argument is number of repetitionsĬreate the vector (4,5,6) in three different ways using c(), seq(), and the : operator. The expression m:n will generate a vector of integers from m to n # first argument to rep is what to repeate To create vectors with a predictable sequence of elements, use rep() for repeating elements and seq() for sequential elements. The c() function combines values of common type together to form a vector. Unless otherwise specified, all coding instructions for this seminar should be entered into the script editor. Save your R script with the name mycode.R. Make sure to periodically save your scripts. This will advance the cursor to the next command, where you can hit Ctrl-Enter again to run it, advancing the cursor to the next command…Įxecute the two commands in the script editor using the keyboard shortcuts. #Difference between r and r studio codeTo execute code directly from the script editor, place the cursor inside the command (or highlight the entire command), and then hit Ctrl-Enter (on PCs, use Command-Enter on Macs). When the tab-completion window appears with a list of possible commands, hit Tab to choose log(). Write the code 1 + 2 in the script editor. If you do not see the script editor already open, open it now by selecting File > New File > R Script. The script editor features the same tab-code-completion and function help as the console, as well as syntax highlighting. We can also issue R commands directly from the editor. Instead, we use the script editor to save our commands as a record of the steps we took to analyze our data. ![]() Most R programs written for data analysis consists of many commands, making entering code line-by-line into the console inefficient. Descriptive statistics for continuous variables.Adding data columns by merging on a key variable *.Appending observations (appending by rows).Subsetting rows of a data frame with filter().Viewing data as a spreadsheet with View(), head() and tail().Conditional selection - subsetting by value.R programming 2: Functions and help files. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |