Documente Academic
Documente Profesional
Documente Cultură
getwd()
typeof(objeoctname)
ncol(a dataframe) // nrow(a dataframe) // colnames(a dataframe)
dataframe[,c("column1", "column2",)]
dataframe[dataframe$columnName>=x,c("column1", "column2",)]
dataframe[order(dataframe$column),]
rbind(dataframe1, dataframe2)
write.csv(currentdataframe, file="newCSV.csv")
Twitter Commands
setup_twitter_oauth(
twListToDF(userTimeline("username", n= , includeRts = FALSE/TRUE, excludeReplies = FALSE/TRUE))
twListToDF(searchTwitter("#hashtag+#...", lang = "en/es/", n =, since = "year-month-day", until = "year, month, day", geocode
getUser("user")
user$created or user$favorites.
as.data.frame(value)
lookupUsers(c("user", "user2", "user3"))
availableTrendLocations()
getTrends(woeid="#####")
userTimeline("user", n=, maxID=NULL, sinceID=NULL, includeRts=FALSE, excludeReplies=FALSE)
Facebook Commands
fbOAuth('','', extended_permissions=TRUE, legacy_permissions=FALSE)
searchPages("search", token, n=)
getPage("pageIDnameor#", token, n=, since=, until=, reactions = TRUE)
getPost("postID_PageID", token, n=)
FBPost_Dataframe$comments or FBPost_Dataframe$likes
searchGroup("search", token)
getGroup(group_id="ID#", token, n=)
dataframe[is.na(dataframe)] <- 0
dataframe$NewColumnofMath <- apply(dataframe[,c("column1", "column3")], 1, sum/mean/etc)
TimeStamp Commands
ymd_hms(dataframe$created)
with_tz(dataframe$created, "America/New_York")
Cleaning Commands
str_replace_all(dataframe$text, "@\\w+", "")
Sentiment Commands
get_nrc_sentiment(dataframe$clean_text)
cbind(dataframe, sentimentsframe)
ggplot(data = dailysentiment, aes(x=day, y = meanvalue, group = sentiment)) + geom_line(size=1.5, alpha = 0.7, aes(color=senti
h1 <- hPlot(x = "day_show", y = "meanvalue", data = dailysentiment, type = "line", group = "sentiment")
h1$print("chart5",include_assets = TRUE)
h1
working directory
defines the object
number of columns // number of rows // names of columns
saves new dataframe of listed columns
munges the data to given parameters (more than, less than, equal to) in given columns (don't know how to do multiple column
orders the given column
binds dataframes together
writes to csv file
removes special objects from text; there are other codes for other effects apparently
produces new dataframe of JUST sentiments
make dataframe of data+sentiments
, 'LyvHf4qUgLKuAQfMGWlDBYgLxW8Ta1cCNtX92dOJ1Xblkgp7Jj', access_token='869231931380162561-PzIOMF9BJ2wsa5GbuNn2fEd2v11w