Plot Times Series of Sentiment by Company in R -


i make sentiment analysis in r. in have dataset column "svolume" values 1,5,41,... column different names of company. last column dates yyyy-mm-dd.

i plot times series dates each company, if have 3 company, have 3 lines, on x axis dates, , y axis svolumes.

i wrote :

data2=data[order(as.date(data$date, format="%d/%m/%y")),] 

in order order data dates.

plot.ts(data2$svolume) axis(1,1:40,data2$date) 

and plot time serie of svolumes , put dates on x axis. have 2 problems: have 1 line can't see difference between 3 company (i love have line of total if possible), , second problem it's impossible read dates there horizontal , wrote 1 on each others. there way write dates verticaly example in order read it?

i have plot this: times series plot 1 instead of "websites" have "volumes" , instead of "shoes,socks,lace" have name of companies/subjects

or svolumes time series plot 2

that's how data looks like:

> head(data)             date time subject  sscore  smean svscore sdispersion svolume  sbuzz    last close 1 2015-07-08 09:10:00     mmm -0.2280 0.2593 -0.2795       0.375       8 0.6026 155.430000000 2 2015-07-08 09:10:00     ace -0.4415 0.3521 -0.0374       0.500       4 0.7200 104.460000000 3 2015-07-07 09:10:00     aes  1.9821 0.0233  1.1743       1.000       1 1.9445  13.200000000 4 2015-07-04 09:10:00     afl -2.9335 0.0035 -0.2975       1.000       1 0.8321  61.960000000 5 2015-07-07 09:10:00     mmm  0.2977 0.2713 -0.7436       0.400       5 0.4895 155.080000000 6 2015-07-07 09:10:00     ace -0.2331 0.3519 -0.1118       1.000       3 0.7196 103.330000000          company name       date 1          3m company 2015-07-08 2         ace limited 2015-07-08 3 aes corporation 2015-07-07 4          aflac inc. 2015-07-04 5          3m company 2015-07-07 6         ace limited 2015-07-07 

thank , sorry english.

i found how it, if can else:

library(ggplot2) ggplot(data)+geom_line(aes(x=data$date, y=data$svolume, + group=data$subject, color=data$subject)) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -