Function readLAS not found - r

In spite of having the packages "rLiDAR" and "lidR" already installed in my computer, and having R Studio updated, when I use the function readLAS(), it doesn´t work. What could be the problem?
My line of code:
LAS<-readLAS(lasfile,short=TRUE)
Error: could not find function "readLAS"

Looks like the package is probably not installed properly and/or the required magrittr package is missing (if you are using lidR).
install.packages("lidR")
install.packages("magrittr")
library(lidR)
las = readLAS("yourpath/yourfile.las")
summary(las)
I'm pretty sure the short=TRUE option is only available in the rLidar package, not lidR.
https://cran.r-project.org/web/packages/lidR/lidR.pdf
https://cran.r-project.org/web/packages/rLiDAR/rLiDAR.pdf

Related

Why can R not find function "getStates"

I am trying to create a character map and was recommended to use Phylotools and Ape packages in R.
I have installed the packages but when I try to do function getStates it comes up with an error message:
x<-getStates(nexdata,"tips")
Error in getStates(nexdata, "tips") : could not find function "getStates"
I have installed the right packages (so I think) and I am quite stuck. Any help would be really appreciated. If you need me to explain anything in more detail let me know.
The function library() loads and attaches add-on packages. You are using phytools and ape, so you should have in your code
library(phytools)
library(ape)
You can read more in the documentation, e.g. at rdocumentation.org/packages/base/versions/3.6.1/topics/library.

R package choroplethr says use zip_choroplethr instead of zip_map, but function not available

I did install.packages("choroplethr"), followed by library(choroplethr). I want to find out how to do a zip code choropleth, so I start typing in RStudio,
"?choroplethr::zip..." The only function that RStudio finds is zip_map. I go to its help file and see the following documentation:
This function is deprecated as of choroplethr version 3.0.0. Please
use ?zip_choropleth instead. The last version of choroplethr in which
this function worked was version 2.1.1, which can be downloaded from
CRAN here:
http://cran.r-project.org/web/packages/choroplethr/index.html
Okay, I guess I'll find out about this zip_choroplethr function then.
?choroplethr::zip_choroplethr
# No documentation for ‘zip_choroplethr’ in specified packages and libraries:
# you could try ‘??zip_choroplethr’
Wut.
Thank you for using choroplethr.
zip_map is, indeed, deprecated. It used scatterplots, which wasn't the best way to visualize zip codes, especially because they are so small.
Within choroplethr, Zip code choropleths are managed by a new, separate package: choroplethrZip. You can see the installation instructions and documentation here.
CRAN rejected choroplethrZip due to the size of the map, which is why it is in separate package and on github.

Error: isTRUE(gpclibPermitStatus()) is not TRUE when using fortify function, rgdal package

I am trying to work with spatial data that I downloaded here in order to make a map in ggplot2.
library(rgdal)
library(ggplot2)
library(rgeos)
df <- readOGR(mydirectory, layer = 'gem_2013_v1')
df.fort <- fortify(df, region = "AANT_INW")
I keep on getting this error when using the function fortify:
Error: isTRUE(gpclibPermitStatus()) is not TRUE
Has anyone an idea about what's going wrong here? Most appreciated!
EDIT:
As mentioned in the comments a possible duplicate of this question can be found here. It is stated that the solution of the problem can be found in installing package gpclib. I am not sure if that's the case, this package has been removed from CRAN.
I had this issue after upgrading R. I reinstalled rgdal and all was good.
I had the same problem, I had to install gpclib. I'm not sure if when you made the update it was removed from CRAN, but it's there now. It must be installed from source so you'll have to use the following code:
install.packages("gpclib", type = "source")
Note that to install with this code you'll need to have the appropriate version of Rtools installed.

R Package tm.plugin.webmining does not work with R 3.1.0 (but does with R 2.1.5)

I am using R 3.1.0, along with the tm.plugin.webmining package (within RStudio). Packages are installed fine (along with all dependencies) and I can load the library.
When I try to run a basic test however:
yahoocorpus<-WebCorpus(YahooNewsSource("Microsoft"))
I get:
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object '.Source' not found
This does not occur if I point RStudio to R 2.1.5
I have looked online but not found any resolution of the issue (though somebody did suggest a hack of the source code). It would be great to understand exactly what is causing the problem (and what has changed between versions to make this happen (I also tried 3.0.1, and that also does not work)
Thanks again,
Alan
I think that function WebCorpus does not exist in last version of TM package. Check the doc here!
You have 3 possibilities : DirSource, VectorSource, or DataframeSource.
You can check the source on R with:
{r}
library(tm)
getSources()
Which should give you :
[1] "DataframeSource" "DirSource" "URISource" "VectorSource" "XMLSource"
Cyrille

How to specify the package when looking up a help reference page for a function?

How does one look up the help manual page for a function and specify the package in R? For example, count appears in both seqinr and plyr. If I want to look up count in plyr, what's the command? I've tried a few obvious (but wrong) guesses such as "?plyr::count"
EDIT:
When I do ?count, I get the following message:
Help on topic 'count' was found in the following packages:
Package Library
plyr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
seqinr /Library/Frameworks/R.framework/Versions/2.15/Resources/library
When I do ?plyr::count, I get:
No documentation for 'plyr::count' in specified packages and libraries:
you could try '??plyr::count'
When I do ?plyr:::count, I get:
No documentation for 'plyr:::count' in specified packages and libraries:
you could try '??plyr:::count'
Adding two question marks also gets me a no documentation found error as well. Looking up help for non-ambiguous funcitons is working fine (e.g. ?plot)
This is with R 2.15.0 on OSX running in emacs + ESS.
Use the package= argument to help:
help("count", package="plyr")
The correct way to do this is:
?plyr::count
?plyr:::count
See ?"?" for details - both examples are shown.
Both work for me with both packages loaded and even without the package loaded. That begs the question if you have the packages installed?
You were close, you need three : :::
?seqinr:::count # for seqinr
?plyr:::count # for plyr

Resources