Julia: pcaeig(X) yields "UndefVarError: fliplr not defined" - julia

I am trying to get the eigenvector to do pca (principal component analysis). The package, DimensionalityReduction.jl offers a command that should do that very thing, pcaeig(X) where X is some matrix. My code is as follows
using DataFrames
using DimensionalityReduction
data = readtable("Midterm Data.csv")
T=size(data)[1]
n=size(data)[2]
erates = convert(Array,data[1:T,2:n])
eigvec = pcaeig(erates)
I do apologize that the formatting is bad, I don't quite remember how to put the code in a quote. Anyways, when I try to run this code, I get the following error: "UndefVarError: fliplr not defined". Now, to my knowledge, fliplr is a command used to flip a matrix (not a variable). It is also saying that the error is happening in the code for the package (not my code). Does this mean that I am out of luck and cannot use this package until it gets patched? If so, does anyone else know another method to get the eigenvector for pca?

As it says in the README of DimensionalityReduction, the package is deprecated:
The DimensionalityReduction package is deprecated. It is superseded by a new package MultivariateStats.
The package does not work on recent versions of Julia and will not be updated to do so in the future. Use MultivariateStats instead.

Related

ts_backtesting function from TSstudio is not showing in the list of functions in TSstudio package in R

I have been trying to perform the horse approach for finding the best model to run on the time series data but when I run ts_backtesting function, there is a message in console that
Error in ts_backtesting(x) : could not find function "ts_backtesting"
Can anyone please help me know why I am getting such error and how to avoid that.
I checked the latest version of the package, didn't find this function anymore
https://cran.r-project.org/web/packages/TSstudio/index.html,
instead, a function called 'train_model' can be used to do a similar thing.

R CMD check: no visible binding for global variable (when using a data/ dataset in the package)

Slightly different versions of this question have been asked before but I haven't seen a good answer yet.
I have a very simple repro using the very good source code of ggplot2:
Go into any file in ggplot2/R/ and add a line that references the "diamonds" dataset included in ggplot2/data/diamonds.r.
Then attempt to build/check the package, (ie: R CMD build .; R CMD check --as-cran ggplot2_3.0.0.9000.tar.gz)
In my arbitrary example I added diamonds to line 436 in theme.r and got this note when trying to check:
* checking R code for possible problems ... NOTE
plot_theme: no visible binding for global variable ‘diamonds’
Undefined global functions or variables:
diamonds
I run into this problem in our package which we want to submit to CRAN. AFAIK we are following best practices by using data/ourdataset.r and then "ourdataset" in our R/ code. And yet, we get this NOTE failure.
What are we doing wrong? If this NOTE comes up for a package like ggplot2, I am at a loss as to whether we are doing something wrong or this is something that should be fixed in CHECK. CHECK has been fantastic so far but I am stumped on this one.
Thanks!
Usually, to get rid of that Note you just have to add a reference like this:
ggplot2::diamonds

kerasR giving error

I am trying to use kerasR for deep learning in R. I am trying to reproduce the examples in the package. Trying the following code produces error:
library(kerasR)
mod <- Sequential()
The error is:
Error in Sequential() : attempt to apply non-function
I'd suggest to look at this issue in KerasR Github repo:
https://github.com/statsmaths/kerasR/issues/1
Basically you should check where is located your version of python and then use reticulate::use_python("PATH_TO_PYTHON") to tell the system where to find Python.
Watch Out!
You can load just one Python interpreter per session and the use_python() function doesn't warn you if there already is a loaded interpreter.
Moreover if you run py_config() it automatically loads the first interpreter that he finds (which, in your case, seems to be the wrong one!), thus you'd better call reticulate::use_python("PATH_TO_PYTHON") before anything else.

How to use/install merge method for data.sets from memisc package?

I have two data.sets (from the memisc package) all set for merge, and the merge goes through without error or warning, but the output is a data.frame, not a data.set. The command is:
datTS <- merge(datT1, datT2, by.x="ryear", by.y="ryear")
(Sorry I don't have a more convenient example with toy data handy.) The following pages seem to make it very clear that there should be a method built into memisc that properly merges the data.sets into one data.set:
http://rpackages.ianhowson.com/rforge/memisc/man/dataset-manip.html
https://github.com/melff/memisc/blob/master/pkg/R/dataset-methods.R
...but it just doesn't seem to be properly triggering on my machine (sorry also for my clumsy lingo). Note the similarity of my code and the example code from the very end of the first page I linked:
ds6 <- merge(ds1,ds5,by.x="a",by.y="c")
I've verified that I have the most recent versions of R, RStudio, memisc, and all dependencies. I've used a number of other memisc methods so far (within, transform, missing.values, etc.) without issue.
So my question is: what else does one need to do to get the merge function to properly produce a data.set when the source data are in data.set form, as per the memisc package? (There's no explicit addressing of this merge capability in the official package documentation.) Since the code in the second link above seems to provide the method for this, is there some workaround, at least, for installing and utilizing that code? Maybe there's just some separate "methods installation" I'm not aware of (but why would it be separate from the main package?).
The help page for pkg:memisc in the released version 0.97 does not describe a merge function method for data.sets. You are pointing us to the github version which may not be the one that has been released. You need to install the github version. See: https://github.com/melff/memisc/releases

Building R package: no visible global function definition for 'subject'

I'm building an R package for the first time and am having some trouble. I am doing an R CMD Check and am getting the following error:
get.AlignedPositions: no visible global function definition for 'subject'
I am not sure what is causing this. I don't even have a "subject" variable in my code. The code is rather lengthy so I rather not paste all of it unless someone asks in a comment. Is there something specific I should look for? The only thing I can think of is that I have a line like this:
alignment <-pairwiseAlignment(pattern = canonical.protein, subject=protein.extracted, patternQuality=patternQuality,
subjectQuality=subjectQuality,type = type, substitutionMatrix= substitutionMatrix,
fuzzyMatrix=fuzzyMatrix,gapOpening=gapOpening,gapExtension=gapExtension,
scoreOnly=scoreOnly)
but subject is defined by the pairwiseAlignment function in the Biostrings package. Thank you for your help!
R spotted a function, subject, being used without a function called subject being available. One possible reason for this is explained in this discussion on R-devel. In that case code is used conditionally, e.g. if a certain package is installed we use its functionality. When checking the package on a system which does not have this package installed, we run in to these kinds of warnings. So please check if this might be the case. Alternatively, you might have made a mistake by calling subject while no function existed, e.g. subject was not a function but just an object.

Resources