Question

R language Please create a data frame. There two columns in the frame: one is instructors’...

R language

Please create a data frame. There two columns in the frame: one is instructors’ names and another is studentnumbers. There are 5 rows totally, and 2 instructors. Each instructor can have several student numbers and appear several times.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE IN R:

#Create a data frame using the inbuitlt function called data.frame()
#Data frame is basically serialized list of vectors having equal length,but can be hetrogenoues.

#We create 2 vectors that hold the Instructors' names and the student numbers
Instructor_name = c("Norman","Kendrick","Norman","Norman","Kendrick")
StudentNumbers = c(20,30,40,50,60)
#These two vectors now contain our data.

#Since these two vectors are of same length,we can easily combine them into a dataframe
#We need to pass Instructors_names and the StudentNumbers as arguments to the dataframe function
#We need to set stringsAsFactors tp false as by defalut it is true.
#This is done to prevent the data frame from converting string data type to factor type

DataFrame = data.frame(Instructor_name,StudentNumbers,stringsAsFactors=FALSE)

# Print the data frame.          
print(DataFrame)

OUTPUT:

CODE SNIPPET:

NOTE: You can set default values to the data frame by declaring the values in the argument itself.

Add a comment
Know the answer?
Add Answer to:
R language Please create a data frame. There two columns in the frame: one is instructors’...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program that creates a dictionary named rooms containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key-value pairs: Course Number (Key) Room Number (Value) CS101 3004 CS102 4501 CS103 6755 NT110 1244 CM241 1411 The program should also create a dictionary named instructors containing course numbers and the names of the instructors that teach...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a program that creates a dictionary named rooms containing course numbers and the room numbers of the rooms where the courses meet. The dictionary should have the following key-value pairs: Course Number (Key) Room Number (Value) CS101 3004 CS102 4501 CS103 6755 NT110 1244 CM241 1411 The program should also create a dictionary named instructors containing course numbers and the names of the instructors that teach...

  • Using dyplr for R: Create data frame where each student is represented once. Example of what...

    Using dyplr for R: Create data frame where each student is represented once. Example of what I have: student test score 1 1 4 1 2 5 1 3 6 What it should look like: Student score 1 score 2 score 3 score 4 1 4 5 6 8 2 1 5 6 8 3 4 3 6 9 4 2 3 4 5

  • Find all courses taught by Mozart. For each such course, output the title, semester, and year.

    Query 1 (2 pts)Find all courses taught by Mozart. For each such course, output the title, semester, and year.Query 2 (2 pts)Find the names of all students who took both “Intro. to Computer Science” and “Game Design”.Query 3 (2 pts)Find the names of all instructors in the computer science department who never taught “Intro. to Computer Science”.Query 4 (2 pts)For each student, find the number of courses taken by this student. Output a table consisting of two columns: name of...

  • Create a C# program that will first prompt the instructors to enter the number of students...

    Create a C# program that will first prompt the instructors to enter the number of students they currently have in their classes. Use this value for the size of the row dimension of your multidimensional array. Next, prompt the instructors to type in the number of scores they would like to enter. This variable will be used to designate the column size dimension of your multidimensional array. Then, use a loop to prompt the user to enter the number of...

  • �Martial Arts R Us� (MARU) needs a database. MARU is a martial arts school with hundreds of students. It is necessary to...

    �Martial Arts R Us� (MARU) needs a database. MARU is a martial arts school with hundreds of students. It is necessary to keep track of all the different classes that are being offered, who is assigned to teach each class, and which students attend each class. Also, it is important to track the progress of each student as they advance. Create a complete Crow�s Foot ERD for these requirements: Students are given a student number when they join the school....

  • Row and columns sum Create a java program that: Input: Receive as input in command line...

    Row and columns sum Create a java program that: Input: Receive as input in command line the sizes m and n of a two dimensional array Receive as input in command line the minValue and maxValue between which the random numbers will be generated for your two dimensional array Generate: Generate a two-dimensional with numbers between minValue and maxValue (inclusive) with the given size (m x n) Compute: Compute the sum for each row and store the results in a...

  • a. linearize that table’s V-r data. Create one or more new columns to the right of...

    a. linearize that table’s V-r data. Create one or more new columns to the right of that table. Put the proper label(s) (with correct unit) at the top of your new column(s).Also, let’s “square stuff” rather than “square-root stuff.” b.Graph your linearized data. c. Determine the slope of your graph r (m) V (V) 1 8.566 2 4.896 3 3.3 4 2.5 5 1.9 6 1.6 7 1.4 8 1.2

  • please use language R Question #1: (25 points) For this question, you will need to create...

    please use language R Question #1: (25 points) For this question, you will need to create several variables for use in later questions in this exam. Unless otherwise specified, you should provide summary statistics and interpret the mean, median, and range for each newly created variable. You should also comment on the normality (i.e., of the distribution of values) of each new variable. A) (6 points) Create a variable called subuse97 that is the sum of four other variables -...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT