1. Homepage
  2. Programming
  3. STAT605/STAT405 Data Science Computing Project - Homework 1: The Emacs Text Editor

STAT605/STAT405 Data Science Computing Project - Homework 1: The Emacs Text Editor

Engage in a Conversation
USWISCUniversity of Wisconsin-MadisonStatistics 405Statistics 605Data Science Computing ProjectRThe Emacs Text Editor

Data Science Computing Project CourseNana.COM

Homework 1: The Emacs Text Editor CourseNana.COM

This homework will give you practice with the emacs text editor. When doing these exercises, please use the commands on the reference sheet at CourseNana.COM

The goal is not just to get the specified tasks done, but rather to do so using the functionality available in emacs, so try to do the tasks elegantly, using the tools provided by the editor. CourseNana.COM

You may ask your classmates, TA or instructor for help with these exercises. If you collaborate with classmates, please include their names and their primary @wisc.edu email addresses on the line after your name in your submission files. CourseNana.COM

Editing text in emacs CourseNana.COM

  1. Start emacs on your Linux virtual machine.
  2. Use emacs to make a new directory, 1 (for “homework 1”), in your ~/Desktop directory. That

is, make the new directory ~/Desktop/1. CourseNana.COM

  1. There are about 65 commands listed on the reference sheet (linked above). Try every one of

them on tiny files you create. CourseNana.COM

This is an important step. It doesn’t take long. If you do it, you have a good chance of knowing which commands to consider for each of the exercises below. If you skip it, you may find the exercises below unnecessarily difficult and frustrating. CourseNana.COM

Delete the tiny files you created in this step. CourseNana.COM

  1. Download baby_T_Test.R and move it to your 1 directory.
    1. (a)  Read baby_T_Test.R into emacs.
    2. (b)  The code has four problems with parentheses. Indent the buffer. The first indenting irregularity indicates a parentheses problem on the previous line. Fix it by adding a parenthesis. Repeat until the whole file is indented correctly.
    3. (c)  Save the file as baby_t_test.R (note “T_Test” changed to “t_test”).
    4. (d)  Make these replacements in baby_t_test.R.

Inside the baby.t.test() function, replace each r (where r indicates the list being set up as a return value) with return.list.
Replace each occurrence of three newlines with two newlines. Hint: We can’t use
Enter to type a newline in the minibuffer, as it ends the minibuffer’s input. Use CourseNana.COM

C-q C-j to type a literal newline into the minibuffer. C-q runs quoted-insert, which allows inserting a literal newline in Linux (newline is C-j, the decimal ASCII CourseNana.COM

code 10), a control character, etc. There are still sequences of three newlines re- maining, so jump to the top of the buffer and do it again. (We will see a way to do these two steps in one step after we study regular expressions soon). CourseNana.COM

(e) Use the emacs R buffer to: CourseNana.COM

  1. Run the chunk of code consisting of the baby.t.test() function definition.
  2. Run the “test case” code one line at a time. Note that the p.value test fails. The bug is that I mistakenly used df=n instead of df=n-1 in my call to pt() in baby.t.test(). Fix this bug, run the baby.t.test() chunk again, and run the test code (one line at a time) again.
  3. Run the entire buffer.

(f) Kill the R buffer. Start it again. CourseNana.COM

  1. Find 3 + 4 (just type it at the R command prompt).
  2. Run source("baby_t_test.R") (just type it at the R command prompt).

(g) Kill the R buffer again and exit emacs. CourseNana.COM

  1. Download gettysburg1.txt and gettysburg2.txt to your 1 directory.
    1. (a)  Use Multiple Windows (in a single emacs session) to split emacs vertically (into halves) and vertically again (now you have one half and two quarters).
    2. (b)  Resize the windows so they all have the same size.
    3. (c)  Open gettysburg1.txt in the first window and gettysburg2.txt in the second. Open

(the new empty file) gettysburg_emacs.txt in the third window. CourseNana.COM

    1. (d)  Use cut, copy, and paste commands to reassemble the Gettysburg Address from its segments in the first two windows into a whole in the third window. Handle each block of lines in the downloaded files separately (e.g. lines 1-2 are a block, as is line 3, as are lines 4-6). Reassemble the Address’s paragraphs, by switching among the three windows as needed. Save gettysburg_emacs.txt when you are done. Close its buffer.
    2. (e)  Return to a single window. Open the Directory Editor on . (“dot”), the current direc- tory.

i. Rename gettysburg_emacs.txt to GettysburgAddress_emacs.txt. ii. Find (open) GettysburgAddress_emacs.txt again. CourseNana.COM

    1. (f)  Kill the rectangle consisting of the line numbers and spaces preceding each line of the address. Save GettysburgAddress_emacs.txt again.
  1. Download roster.txt to your 1 directory. Open it in emacs. Save it as password.txt. Con- vert password.txt so that each line contains the last four digits of a student’s ID number and each student’s NetID, separated by a space. For example, the first line,
    123456789 Brown,Joe jbrown@wisc.edu

should become CourseNana.COM

6789 jbrown CourseNana.COM

Use the following steps. CourseNana.COM

(a) Remove the rectangle consisting of the first 5 columns of digits. (Now the first line is “6789 Brown,Joe jbrown@wisc.edu ”.) CourseNana.COM

(b) Use a regular expression to trim the remaining text to the desired result. (The first line becomes “6789 jbrown”.) CourseNana.COM

(c) Save password.txt again. CourseNana.COM

Hint: roster.txt is a confusing file because it contains three whitespace characters, each invisible: SPACE, TAB, and NEWLINE. (To understand the file better, you might make a throw-away copy like roster2.txt in which you replace each TAB with a hyphen, -, and each SPACE with an underscore, _.) One way to handle whitespace within a line is to use a character class with square brackets, [], in which you type both a TAB and a SPACE. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
US代写,WISC代写,University of Wisconsin-Madison代写,Statistics 405代写,Statistics 605代写,Data Science Computing Project代写,R代写,The Emacs Text Editor代写,US代编,WISC代编,University of Wisconsin-Madison代编,Statistics 405代编,Statistics 605代编,Data Science Computing Project代编,R代编,The Emacs Text Editor代编,US代考,WISC代考,University of Wisconsin-Madison代考,Statistics 405代考,Statistics 605代考,Data Science Computing Project代考,R代考,The Emacs Text Editor代考,UShelp,WISChelp,University of Wisconsin-Madisonhelp,Statistics 405help,Statistics 605help,Data Science Computing Projecthelp,Rhelp,The Emacs Text Editorhelp,US作业代写,WISC作业代写,University of Wisconsin-Madison作业代写,Statistics 405作业代写,Statistics 605作业代写,Data Science Computing Project作业代写,R作业代写,The Emacs Text Editor作业代写,US编程代写,WISC编程代写,University of Wisconsin-Madison编程代写,Statistics 405编程代写,Statistics 605编程代写,Data Science Computing Project编程代写,R编程代写,The Emacs Text Editor编程代写,USprogramming help,WISCprogramming help,University of Wisconsin-Madisonprogramming help,Statistics 405programming help,Statistics 605programming help,Data Science Computing Projectprogramming help,Rprogramming help,The Emacs Text Editorprogramming help,USassignment help,WISCassignment help,University of Wisconsin-Madisonassignment help,Statistics 405assignment help,Statistics 605assignment help,Data Science Computing Projectassignment help,Rassignment help,The Emacs Text Editorassignment help,USsolution,WISCsolution,University of Wisconsin-Madisonsolution,Statistics 405solution,Statistics 605solution,Data Science Computing Projectsolution,Rsolution,The Emacs Text Editorsolution,