Consider the following data frame about the final four teams in FIFA world cup 2
ID: 3301772 • Letter: C
Question
Consider the following data frame about the final four teams in FIFA world cup 2014: Use the function data.frame to reproduce this table as a data frame in R. Note there are 4 observations and 7 variables with column/row names (the first column in above table is used as row names and the first row is used as column names). After you have created this new object, assign it to final4. Use the function write.table to export the object final4 to a xxx.txt file (xxx can be whatever name you like). You also need to submit this file on Canvas.Explanation / Answer
r codes ...
country<-c("germany","argentina","natherlands","brazil")
continent<-c("europe","south america","europe","south america")
W<-c(5,6,5,5)
D<-c(1,0,0,0)
Scored<-c(17,8,12,11)
conceded<-c(4,3,4,11)
star<-c("ozil","messi","robben","neymar")
final4<-data.frame(country,continent,W,D,Scored,conceded,star)
final4
write.table(final4, "xxx.txt", sep=" ")
output
country continent W D Scored conceded star
1 germany europe 5 1 17 4 ozil
2 argentina south america 6 0 8 3 messi
3 natherlands europe 5 0 12 4 robben
4 brazil south america 5 0 11 11 neymar
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.