I am trying to use the rtweet package but get the following message when trying to use the search_tweets() function like so:
x <- search_tweets(q="football", n=100)
Searching for tweets...
Collected tweets!
Error: data is not a data frame
I couldn't find a lot of instruction on how to use the basic functions of the package, so maybe am I missing an intermediate step in between setting up the app token and grabbing tweets?
I'd currently recommend installing the development version on Github (https://github.com/mkearney/rtweet). Without seeing your session info and script, I wouldn't be able to tell you exactly what the problem is. My guess is something went wrong with your API token/oauth (see the Github link for token instructions) or you're missing a dependency. If it's the latter, you could make sure you have "dplyr" installed, but you're better off with the Github version anyway, which only has a few dependencies.
If that doesn't fix the problem, I'd be curious to know what's going on. The transition from twitteR to rtweet has sped bings up a bit, but the next CRAN release should include a few more functions and a lot more documentation and useful error messages. Until then, feel free to post any issues to Github (I'll try to check on here, too, but it probably won't be as frequent).
I would suggest trying x <- rtweet::search_tweets(q="football", n=100), resulting in:
>dim(x)
[1] 98 35
Additionally:
>class(x)
[1] "data.frame"
Related
Today I have tried to prepare a new CRAN update for a package and have come across a warning, while performing devtools::check().
Since this warning also occurs without my changes I made to the package, I am assuming this is a new check. Unfortunately I don't really get what I am supposed to do.
This is the error message:
A complete check needs the 'checkbashisms' script.
See section ‘Configure and cleanup’ in the ‘Writing R Extensions’
manual.
Of course I took a look at the section ‘Configure and cleanup’ as proposed in the warning. But still, I am not sure what to do exactly. I got, there is a checkbashisms Perl script I can download somewhere on the internet (but this alone won't make this message disappear). How shall I integrate this, that the message actually disappears.
Any hints or comments would be extremely helpful to me.
Here is a link to the repo of the package in case you want to clone it to reproduce the error.
I'm trying to work through some of the examples in this article around table generations using expss - https://cran.r-project.org/web/packages/expss/vignettes/tables-with-labels.html - however, I am consistently getting the error could not find function "setalloccol" using the most basic crosstab functions of cro and fre with two variables:
> cro(df$var1, df$var2)
Error in setalloccol(ans) : could not find function "setalloccol"
I'm using R Studio 1.2.1335 and I've re-installed the packages dplyr, data.table, tidyr and expss itself, but I still seem to get this error with all these libraries running. I've googled the exact error I'm coming up with and there is absolutely zilch on this, so appreciate any help...
Try to explicitly export setalloccol from data.table before running your code:
setalloccol = data.table::setalloccol
# further calculations
# cro(df$var1, df$var2)
'Setalloccol' is an experimental command in data.table used to allocate memory by reference to assure something more stable than a shallow copy is allocated by ':='. 'Expss' looks like a monster library. I won't load it now and track down your error. But since 'setalloccol' is an experimental command, you should find the 'expss' developers and file a defect. There is, however, already a whole gnarly open bug report on this exact issue here: https://github.com/gdemin/expss/issues/42. The developer of data.table ("Matt Dowle") has comment in that bug report. In practice setalloccol works like this:
help(setalloccol)
data.table::truelength(HMR)
[1] 1035
options(datatable.verbose=TRUE)
data.table::setalloccol(HMR,2 * 1035)
data.table::truelength(HMR)
[1] 2081
But it really isn't necessary for most data.table computations. Try to pour over the "expss" code and find why and when they use it. Sorry I am not more helpful.
Thanks to rferrisx for the thread from GitHub. The post from josie-athens from 3rd Nov 19 seems to fix this issue, though I didn't run R from Bash. So my process was:
Uninstall expss and data.table packages: remove.packages(c('expss','data.table'))
Reinstall above packages: install.packages(c('data.table','expss'))
This seems to bypass the error. Not entirely sure why though but hopefully helpful for somebody experiencing the same thing.
For what it's worth, I just ran into the same issue and wanted to give my two cents. This seems to be a matter of the order in which you load the packages, since the "expss" package masks several functions of the "data.table" package and vice versa. Try reversing the loading order. At least that solved the issue for me.
I am trying to use this library: 'stockPortfolio'
After several attempts, I just couldn't get it to install. I just found this.
https://cran.r-project.org/web/packages/stockPortfolio/index.html
Is it gone because Yahoo shut off it's finance API last year? Is that the bottom line here? I'm getting an error about 'Error in library(stockPortfolio) :
there is no package called ‘stockPortfolio’'. I'm asking, because I am trying to run the code from the link below:
http://economistatlarge.com/portfolio-theory/r-optimized-portfolio/r-code-graph-efficient-frontier
You'd have to email the maintainer to ask.
If you still want to use the last version of the package (no idea if a script using it will work, probably not if the API shut down), you can do remotes::install_version("stockPortfolio", version = "1.2").
My paths and files are as follows ...
E:R/R-2.15.1/library/Rcmdr/
E:R/R-2.15.1/library/RcmdrPlugin.Package/
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package.zip
E:R/R-2.15.1/MyLibrary/RcmdrPlugin.Package/
where, in the name RcmdrPlugin.Package, I've used the word 'Package' to represent the name of the actual package being used.
The installation is as described above because (i) I'm not an expert at installing packages, (ii) I couldn't do a direct install from Cran because I wanted to put the package onto a USB stick; and, (iii) at work the Cran server is blocked (sic).
When I start the package from the GUI the Cmdr opens once and quickly closes (I don't know if this is relevant or normal) and opens again. Once open, I can operate the package via the Cmdr interface. It's a very nice package, everything works really well until I want to save the work. Then I get the following error,
Error in obj[i] : object of type 'closure' is not subsettable
I've been in contact with the people who developed (and are still developing) the package and they cannot reproduce the bug.
I strongly suspect that the problem lies in my 'crappy' install and file configuration, rather than with the package.
Can anyone please help me by suggesting how I would undo what I've done and do it properly in view of the constraints list above?
I appreciate that I can use Remove to get rid of the package but I don't want to start tinkering with something without having a greater understanding of what I'm doing.
Lastly, note that is error has been discussed a number of times on this list but not within this particular context.
I've managed to get it to work by following the instructions from here stackoverflow.com/questions/12820189/… where I set repos=NULL after I'd put the package into /MyLibrary/
I tried to run a Bioconductor package (truncateCDF) that modify an environment(hgu133plus2cdf), to remove unwanted probesets, from an affymetrix chip.
Everything went fine, until I got the following message (translated from french):
> assign(cdfname, cdf.env, env=CDF.env)
Error in assign(cdfname, cdf.env, env = CDF.env) :
impossible to change the value of a locked link for 'hgu133plus2cdf'
The assign function is the ultimate function of the code, that save the changes made to the environment dataset CDF.env to the original environment (hgu133plus2cdf), before using it in analyses of affymetrix chip results; so, it is essential.
My question: what is this locked link to the hgu133plus2cdf environment, and how could I bypass it.
The author of this package successfully run its package around 2005; so I suppose it is a feature introduced since then in R (probably not related to Bioconductor, since assign is a basic R function, reason why I ask this question on this forum instead of Biostar).
I tried to read the docs, but I am overwhelmed, when it comes to environments.
Thanks in advance for any help.
I don't think truncateCDF is from a Bioconductor package; it is a at least not current. This sounds like this post and the next two from the same thread from the Bioconductor mailing list. It is a result of a change in R -- packages now have not-easily-modified name spaces, and these are implemented by locking the environment in which name space symbols are defined. Removing probes is not an essential part of a typical microarray work flow. Please ask on the Bioconductor mailing list (no subscription required) if you'd like more help.