-3

$ date (fctr) 01-07-14 02:30, 01-07-14 02:30, 01-07-14 02:30, 01-07

$ author (fctr) techkennels, PreDraX, SeattleGOP, MrP.

$ body (fctr) @AC360 @JohnBerman @arwaCNN @Ali_H_Soufan @CNN , "@cn.

$ doclang (fctr) , en, en, en, en, , en, en, en, , en, en, en, en, en,.

$ docgeolocation (fctr) , , , , , , , , , , , , , , , , , , , , , , , , , , ,

$ authorgeolocation (fctr) , , A LeXopleX In The Nymaverse, Seattle, WA,

$ listoflinks (fctr) , http://cnn.it/1f7kFn, , http://bit.y/1r9hKj,

$ tags (fctr) , , , , , , , , , , , , , , , boom, , , , , , , , ,

$ retweet (lgl) FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,

I'm a newbie in Rstudio and I followed tutorials on Datacamp and varianceexplained. But it is unclear how I have to plot my dataset. How do I plot this data in Rstudio? I tried hist(tweets_english) But I get the error x must be numeric. So how can I plot this data in Rstudio? And how do I remove missing values? for example at the docgeolocation there are a lot of missing values.

Thank you very much! And if you have a useful website to learn more Rstudio that would be great!

C_Z_
  • 7,427
  • 5
  • 44
  • 81
F.Burbano
  • 13
  • 5
  • 4
    There is no one way to plot any given data set. What do you want your plot to look like? Try editing your question to focus on one, clear specific question. Include your data in a [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) format (what you have included is not useful). – MrFlick May 02 '16 at 15:11
  • Note that rstudio and R are distinct pieces of software. R is the statistical language that produces the figures. rstudio is a very nice integrated development environment (IDE) that (usually) makes working with R a lot easier. Every time you say rstudio in your post, you should say R. – lmo May 02 '16 at 17:19

1 Answers1

1

I'll try to help you. You asked,

How do I plot this data in Rstudio? I tried hist(tweets_english) But I get the error x must be numeric. So how can I plot this data in Rstudio?

If you want to try a histogram, you have to specify the column in your data that you want counted. So, if you have a data frame tweets_english and you want to know counts of retweets, you could try:

hist(tweets_english$retweets)

And how do I remove missing values? for example at the docgeolocation there are a lot of missing values.

Dealing with missing values is a topic in its own right, but for simplicity you can remove all rows with missing values from an R data frame by using na.omit(). Again, this will remove the ENTIRE ROW that contains a missing value, which may not be what you want.

tweets_english <- na.omit(tweets_english)

If you want to treat your missing values in a different way, or don't want to lose the entire row, I would suggest googling some lectures or articles on how to impute missing values.

This video by Roger Peng taught me a lot. There's tons of stuff on YouTube, just browse around.

Raphael K
  • 2,265
  • 1
  • 16
  • 23