r - Non-continuous variable supplied to scale_x_continuous in ggplot2 geom_point graph -


i have table has 2 columns both of them continuous data. checked csv file make sure there numeric values in columns. however, when plot them 1 of them seems taken non-continuous data, , get: error: non-continuous variable supplied scale_x_continuous. small version of table

   budget    gross 1  234       4234 2  42342     2323 3  22165     346 4  290       452 ... 

i trying create scatter plot gross numbers in y axis , budget in x axis. tried fore-mentioned error.

p <- ggplot(test, aes(budget, gross))+geom_point(alpha=i(1/5), aes(colour=budget))+ opts(titles="movies per year", panel.grid.major = theme_blank(), panel.grid.minor = theme_blank())+scale_x_continuous() 

thank

try class(test$budget). odds r believes column factor. if that's so, can around problem using stringsasfactors option, either inside of read.csv():

test <- read.csv(file = "yourdata.csv", stringsasfactors = false) 

or set entire session:

options(stringsasfactors = false) 

from personal experience, i'd recommend latter. start of scripts way, - functions need factors coerce other vector types necessary, , if don't, then i'll manually specify it. having bunch of vectors lurking in data cause nothing headaches.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -