r - Plotting a graph with multiple columns -
i have data set 20 years in first column (1990,1991,etc..) , each of next 5 columns different state (ca,co,pa,ny,tx). trying create plot year along x-axis, , totals each state along y-axis, each state being represented on plot different color line.
i can fine using matplot:
matplot(population$year,popamount,type="l")
where popamount variable containing 5 state columns. using matplot code above, can achieve looking for.
i wondering how using plot() though, because whenever try same code using plot(), receive error:
error in xy.coords(x, y, xlabel, ylabel, log) : 'x' , 'y' lengths differ
my population$year variable 20 years, , popamount has data each of 20 years. here snippet of data:
year ca co pa ny tx 1990 1234 1234 1234 1234 1234 1991 5678 5678 5678 5678 5678 1992 9876 9876 9876 9876 9876
why able in matplot not plot?
Comments
Post a Comment