Question

Read in flag.csv and save it in d. Choose the records in d so that the...

Read in flag.csv and save it in d. Choose the records in d so that the color in columns 8, 9 and 10 are all the same and save them in d1.

(IN R PROGRAMMING)

I have d<-read.csv('flag.csv') but I don't know how to compute d1. please help

you don't need flag.csv file for this (can't post csv file) , I just need to know how to compute color in columns 8, 9 and 10 are all the same column

8: Color, 9: TopL, 10: BotR

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

d1<-d[d$Color==d$TopL & d$Color==d$BotR,]

#selecting based on logical vector

Add a comment
Know the answer?
Add Answer to:
Read in flag.csv and save it in d. Choose the records in d so that the...
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
  • Question 2 If you read in a csv file using read.csv() function into R, what is the resulting datastructure in which R st...

    Question 2 If you read in a csv file using read.csv() function into R, what is the resulting datastructure in which R stores the read-in data? A. numeric B. matrix    C. data.frame    D. vector    Question 3 Suppose you have 4 integers, 4 characters, and 4 logical values. Which datastructure can you use to store all 12 values? Choose one or more options. A. a vector B. a matrix C. a list D. a data frame Question 4 Suppose you have...

  • Here are the data needed for the program. SanFrancisco.csv station_id,name,lat,long,dockcount,landmark,installation 41,Clay at Battery,37.795001,-122.39997,15,San Francisco,8/19/2013 42,Davis at Jac...

    Here are the data needed for the program. SanFrancisco.csv station_id,name,lat,long,dockcount,landmark,installation 41,Clay at Battery,37.795001,-122.39997,15,San Francisco,8/19/2013 42,Davis at Jackson,37.79728,-122.398436,15,San Francisco,8/19/2013 45,Commercial at Montgomery,37.794231,-122.402923,15,San Francisco,8/19/2013 46,Washington at Kearney,37.795425,-122.404767,15,San Francisco,8/19/2013 47,Post at Kearney,37.788975,-122.403452,19,San Francisco,8/19/2013 48,Embarcadero at Vallejo,37.799953,-122.398525,15,San Francisco,8/19/2013 49,Spear at Folsom,37.790302,-122.390637,19,San Francisco,8/20/2013 50,Harry Bridges Plaza (Ferry Building),37.795392,-122.394203,23,San Francisco,8/20/2013 SanJose.csv station_id,name,lat,long,dockcount,landmark,installation 2,San Jose Diridon Caltrain Station,37.329732,-121.901782,27,San Jose,8/6/2013 3,San Jose Civic Center,37.330698,-121.888979,15,San Jose,8/5/2013 4,Santa Clara at Almaden,37.333988,-121.894902,11,San Jose,8/6/2013 5,Adobe on Almaden,37.331415,-121.8932,19,San Jose,8/5/2013 6,San Pedro Square,37.336721,-121.894074,15,San Jose,8/7/2013 7,Paseo de San Antonio,37.333798,-121.886943,15,San Jose,8/7/2013 8,San Salvador at 1st,37.330165,-121.885831,15,San Jose,8/5/2013...

  • Note: This is the only question for this star and only the age range will change. Save and test your code in repl.it so you can paste it for credit in case you don't get it right on the first try....

    Note: This is the only question for this star and only the age range will change. Save and test your code in repl.it so you can paste it for credit in case you don't get it right on the first try. You are analyzing the results of a survey about the Internet and you want to know how often a specific age range of people use the Internet. You will be given a file containing a subset of the source...

  • Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in...

    Create a program (Lab9_Act1_Write.py) that will read in data from the keyboard and store it in a file. Your program should prompt the user for the name of the file to use and then request values be entered until the user is done. This data should be written to two files: a text file, user_file_name.txt and a comma separated value file, user_file_name.csv. To help you with decision making, we suggest that you ask the user to input data representing students’...

  • Write a function named "loadStateDict(filename) that takes a filename and returns a dictionary of 2-character state...

    Write a function named "loadStateDict(filename) that takes a filename and returns a dictionary of 2-character state codes and state names. The file has four columns and they are separated by commas. The first column is the state full name and the second column is the state code. You don't have to worry about column 3 & 4. You should eliminate any row that is without a state code. Save the two columns into a dictionary with key = state code...

  • The way I understand it is i'm trying to link a list that I read into...

    The way I understand it is i'm trying to link a list that I read into python from a cvs file to json and xml and pass the doctest. Please refere the lines where I show what I did below. home / study / engineering / computer science / questions and answers / """this script converts a csv file with headers ... Question: """This script converts a CSV file with headers to... Bookmark """This script converts a CSV file with...

  • Python function: This is my code and I don't know how to add the column to...

    Python function: This is my code and I don't know how to add the column to the csv file: def write_with_averages(read,write): with open (read,'r') as f_in: header = f_in.readline() reader=csv.reader(f_in) with open (write,'w') as f_out: writer=csv.writer(f_out) New_data=[] for Name, Test1, Test2, Test3 in reader: Total=(float(Test1)+float(Test2)+float(Test3)) average=Total/3 New_data.append(average) Hint: Skip the first line of the file as it is a header line Hint: All values come in as strings, so convert to floats before mathematical comparisons and calculations. File Format Name,Test1,Test2,Test3...

  • --------__--------__Python--------__--------__ You will be reading in the data from the file SalesJan2009.csv. When you do, you...

    --------__--------__Python--------__--------__ You will be reading in the data from the file SalesJan2009.csv. When you do, you need to save all the items from the PRICE field into a list called amtCollected. After you get them all in that list, you will need to create a variable called total that holds the sum of all the numbers in the list. Then create a variable called avg that holds the average of the numbers in the list. Now, print the following strings:...

  • This is a c# assignment Please do not post just the code, I don't even know...

    This is a c# assignment Please do not post just the code, I don't even know how to start the project. Please explain step by step how I could complete this assignment. Thank you for your time! Create a database that stores baseball player information. You will have the following columns. You will need to have the ability to add rows and display the records. You may use LINQ or Given example using an access accdb file... Name string Batting...

  • How do I set up my read function? here's my code so far: int read_sudoku_board(const char file_name[], int board[9][9]) { FILE * fp = fopen("sudoku.txt", "r"); int a,i,j,c;...

    How do I set up my read function? here's my code so far: int read_sudoku_board(const char file_name[], int board[9][9]) { FILE * fp = fopen("sudoku.txt", "r"); int a,i,j,c; int count = 0; for(i = 0; i < a; i++){ for(j = 0;j < 9;j++){ c = fgetc(fp); if(c == '-'){ board[i][j] = 0; } else if(c >= 1 && c <= 9) printf(" %d"); else return -2; } count++; } if(count != a-1) return -1; else return 0; }12 Read...

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
ADVERTISEMENT