Cannot find function readDICOM, though oro.dicom is installed - r

I am struggeling with reading DICOM files in R. I have installed the oro.dicom package, using:
install.packages("oro.dicom", repos="https://cran.cnr.berkeley.edu/")
I have set the working directory to where the files are located.
When trying to read a dicom file, using...
slice=readDICOM("IM-0001-0011.dcm")
... I get the following error message:
Error: could not find function "readDICOM"
Can someone help?
Thank you,
Lena

You should load package with library(oro.dicom) fisrt before you will use functions from that package,

Related

Why is R library not loading in app.powerbi.com?

I keep getting the following error on app.powerbi.com:
"Error in pivot_wider(data, names_from=names,values_from=values): could not find function "pivot_wider""
I load the 'tidyr' package as a required library.
I get the same error when using "spread" instead of pivot_wider.
When I specify the function using:
tidyr::pivot_wider(data, names_from=names, values_from=values)
I get a different error:
"Error in loadNamespace(name): there is no package called 'tidyr'".
PowerBI Desktop everything works perfectly fine. It's only on the published PowerBI report that I get the error.
What can I do to resolve this issue?
Alternative library / function to 'pivot_wider' or 'spread'?
I was able to verify using print statements that the report on powerbi.com was not able to access the r packages that were installed.
I was using a .libPaths()[3] to point to the location where my libraries were installed, but this didn't work in powerbi.com.
I ended up re-installing R to a location where I could install packages to, since admin rights are necessary to write to the C:/users/program files location.

install.packages function does not recognize new library path in RStudio

I am connecting remotely to a work server and need to be able to install R packages via RStudio. I have read through other questions/answers on this topic, but haven't been able to solve this for myself. I think the following input and output shows my issues the best: (edit: I do not have admin powers, but can call IT as last resort)
>.libPaths("C:/RWorkSpace") #setting new file path
>.libpaths() #testing
[1] "C:/RWorkSpace" "C:/Program Files/R/R-3.4.1/library"
>install.packages("bibliometrix", dependencies = TRUE, lib="C:/RWorkSpace")
The downloaded source packages are in
‘C:\Users\cortiz\AppData\Local\Temp\7\RtmpOsVuTB\downloaded_packages’
>library(bibliometrix)
Error in library(bibliometrix) : There is no package called 'bibliometrix'
>installed.packages()["bibliometrix","C:/RWorkSpace"]
Error in installed.packages()["bibliometrix","C:/RWorkSpace"] : subscript out of bounds
I just need to download the package and dependencies, and I expected them to be downloaded to the folder I specified ("C:/RWorkSpace").
very new to working with R in general so please bear with me. Any help greatly appreciated!

How to troubleshoot Error: Could not find package root?

I am running the command: devtools::use_testthat()
and I get the error:
Error: Could not find package root.
Why this happens?
devtools appears now to require the user to setwd("~/path/to/package"), even if functions like devtools::release() have the pkg= parameter set correctly.
My problem was very similar, but running devtools::document(setwd(...)). The only thing that worked for me:
I copied the DESCRIPTION file from another package (https://github.com/filipezabala/voice);
I ran devtools::document(setwd(...)) again;
After that, I edited the DESCRIPTION file and ran again devtools::document(setwd(...)).

What is this error: File does not exist error with roxygenise?

I have been using roxygen2::roxygenise quite successfully with my package to build exported and imported functions. However, I recently ran into this error which I am unable to resolve:
> roxygen2::roxygenise()
First time using roxygen2. Upgrading automatically...
Error: File file does not exist
This is not the first time I have used roxygen2 with this package. In addition, I am not quite sure what "File file does not exist" means. Has anyone else seen this and been able to resolve it?
I think you have to set the working directory of R to be the package folder
I got the same error when using:
roxygen2::roxygenise("mypackage")
But, I didn't get the error when I instead used:
library(roxygen2)
roxygenise()
I know this is no explanation and I can't comment upon whether this works beyond my case.

Error reading a .nc4 file in R (ncdf4 package)

I am trying to use a data set of .nc4 files downloaded from NASA.
The format NCDF4 is confirmed by this source.
I used download .file in R to get the database and then a simple nc_open (ncdf4 package) to test the file. Unfortunately the result is an "Unknown file format" error.
Here my replication file and my script:
download.file (url=http://hydro1.gesdisc.eosdis.nasa.gov/.../url, destfile=destination_folder/file.nc4)
All fine till this point, but when testing the files:
library(ncdf4)
setwd('destination_folder')
data <- nc_open('file.nc4')
Error in R_nc4_open: NetCDF: Unknown file format
Error in nc_open("file.nc4") :
Error in nc_open trying to open file file.nc4
Am I missing something?
Thank you.
I do not know what is wrong, but I can add the information that the problem resides in the Windows implementation of the ncdf4 package. With the following statement:
catlg<-nc_open("http://opendap.deltares.nl/thredds/dodsC/opendap/rijkswaterstaat/waterbase/concentration_of_suspended_matter_in_water/catalog.nc")
I have the same problem as described in the question. However, it works perfectly in R under Linux
The file server is an OpenDAP server strictly following netcdf 4 conventions, but maybe some features are not correctly implemented in the ncdf4 package under Windows
for some reason I get the same error using [64-bit] C:\Program Files\R\R-3.4.2), but when using [64-bit] C:\Program Files\R\R-3.3.3 the ncdf4 package works fine.
not that this solves the problem, but it provides an easy work around for the time being.

Resources