Var1 <- c(fieldName="Tweets",fieldLabel="",fieldStorage="string",įieldMeasure="",fieldFormat="",fieldRole="") ModelerData <- cbind(modelerData,data$text) Write.csv(data, file=paste(home.dir,"ModTweets.csv", sep=""), Tweets <- searchTwitter(as.character(q.col), n=n.col,Ĭainfo=paste(home.dir, "cacert.pem", sep=""))
Spss 16 code#
Even though Modeler has an output console that displays R code and any messages that result from running it, the R tools have a more robust interface for catching and resolving errors. It's important to debug any R code you will be embedding in IBM® SPSS® Modeler 16 using R or R Studio. ModelerData <- cbind(modelerData, data.output) Tmp.output <- t(apply(modelerData, 2, function(x, y) local.tweets(x, y))) Write.table(data, file=paste(home.dir,"ModTweets.csv", sep=""), Tweets <- searchTwitter(q.col, n=n.col, cainfo=paste(home.dir,ĭata <- ame(dataTweets$text, dataTweets$created, Load(file=paste(home.dir, "TermSearch.RData", sep="")) Home.dir <- 'c:/Users/mosemadl.ONEONTA/My Documents/BigData/R/' IMPORTANT: Since a Twitter App will only return a limited number of results during a 24 hour period, this file should not be shared for public use.
![spss 16 spss 16](https://www.macstats.org/web-photos/spss/data-view.gif)
In order to accommodate this, Twitter authentication can be run once and saved to a file for later use. Unfortunately IBM SPSS Modeler 16 does not allow a process to be paused to provide this PIN.
![spss 16 spss 16](https://i.ytimg.com/vi/n6RSqQCJXYM/hqdefault.jpg)
Save(twitCred, file="TwitterSearch.RData")Įach time your script is run to harvest data, Twitter directs you to a specific URL to acquire an authentication PIN. This process is referred to as a Twitter App.ĭownload.file(url="", destfile="cacert.pem")ĪpiSecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Ĭainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl") In order to gather any kind of Twitter data, you need to create a process by which to communicate with Twitter and tell it what information you are looking for. The last thing to do is click the 'Create my access token' button as shown in Figure C. Even though doing so is necessary to completing this process, these tokens won't be needed in this tutorial. Click the Keys and Access Tokens link ( Figure B) to view the keys you will need to use in the next step of writing the script to harvest tweets. The last part of the form is a Developer Agreement which you must agree to before your app can be created.Ī page will now appear verifying the creation of the app.It is best to leave this field blank and to explicitly specify the callback URL at authorization time. The Callback URL field can specify the URL were Twitter should redirect after successful authorization.As with Name and Description, this field is presented on user-facing authorization screens.
Spss 16 download#
In the Website field, give a URL that points the user back to your application, where they can download it or find out more information.Again, this is presented to users on authorization screens. In the Description field, describe your application in 10 to 200 characters. This name is presented to users when they are prompted to authorize your application to access their Twitter information. In the Name field, name your application in 32 characters or fewer.A new page with the Create an application form (Figure A) requires basic information about your application.
![spss 16 spss 16](https://images-na.ssl-images-amazon.com/images/I/41QpHoAodYL._SX392_BO1,204,203,200_.jpg)
Visit and sign in with your Twitter credentials.Ĭlick the ' Create New App' button near the top.