Data.Frames in R

Errors:

> Names <- c("Jeb", "Donald", "Ted" "Marco", "Carly", "Hillary", "Berine")
Error: unexpected string constant in "Names <- c("Jeb", "Donald", "Ted" "Marco""
> Names <- c("Jeb", "Donald", "Ted", "Marco", "Carly", "Hillary", "Berine")
> ABC <- c(4, 62, 51, 21, 2, 14, 15)
> CBS <- c(12, 75, 43, 19, 1, 21, 19) 
Error: object 'name' not found
> df <- data.frame(Names, ABC, CBS)
> df
    Names ABC CBS
1     Jeb   4  12
2  Donald  62  75
3     Ted  51  43
4   Marco  21  19
5   Carly   2   1
6 Hillary  14  21
7  Berine  15  19

Good Program:


> Names <- c("Jeb", "Donald", "Ted", "Marco", "Carly", "Hillary", "Berine")

> ABC <- c(4, 62, 51, 21, 2, 14, 15)
> CBS <- c(12, 75, 43, 19, 1, 21, 19) 
> df <- data.frame(Names, ABC, CBS)
> df
    Names ABC CBS
1     Jeb   4  12
2  Donald  62  75
3     Ted  51  43
4   Marco  21  19
5   Carly   2   1
6 Hillary  14  21
7  Berine  15  19


In this data frame compose for module 3 data frames I had numerous errors, stemming from arbitrary issues related o improper commas or sequencing and I basically had to do over the names column. I reduced the name of the results columns from ABC/CBS poll results t just ABC and CBS I think this would make the table look better.

Comments

Popular posts from this blog

R secure coding

Mod 11 debugging

Final Project-R Package