How to install r package locally using devtools::install_local - r

I have the following R packages:
ubuntu#ip-111-31-16-140:~/storage1/homebrew_rpackages/mypackr$ pwd
/home/ubuntu/storage1/homebrew_rpackages/mypackr
The structure is:
ubuntu#ip-172-31-16-140:~/storage1/homebrew_rpackages/mypackr$ tree
.
|-- DESCRIPTION
|-- NAMESPACE
|-- R
| |-- hello.R
| `-- tsne_pca.R
|-- mypackr.Rproj
`-- man
|-- hello.Rd
`-- plot_tsne_pca.Rd
What I tried to do is to install locally this way, but gives error:
> devtools::install_local("/home/ubuntu/storage1/homebrew_rpackages/mypackr")
Installation failed: trying to get slot "name" from an object of a basic class ("NULL") with no slots
What's the right way to do it?

You have to do at least one commit in your git repository of your package.

Related

Angular cssSyntaxError in application

I have an error that comes from my css file.
The full error message is this:
ERROR in ./src/assets/all.css (./node_modules/#angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./src/assets/all.css)
Module Error (from ./node_modules/postcss-loader/src/index.js):
(Emitted value instead of an instance of Error) CssSyntaxError: myfolder\src\assets\all.css:5556:189: Can't resolve '../webfonts/fa-brands-400.ttf' in 'myfolder\src\assets'
This is how my folder structure looks like:
My project
`-- src
|-- app
| `-- components
`-- assets
`-- all.css
I tried putting my css code inside the assets folder didn't work. How can I fix this error, error occurs only with the fonts inside the css file.

Symfony 4 404 Page not found on all routes except root

I have installed symfony 4 on my shared hosting.
My structure is like this:
ROOT
|
|-- public_html
|
|-- tst
|-- tst
|
|-- bin
|-- config
|-- src
|-- translations
|-- var
|-- vendor
|-- composer.json
|-- composer.lock
|-- binsymfony.lock
I moved index.php from the public folder to the public_html/tst folder and changed the paths inside that file to match the new structure:
require __DIR__.'/../../tst/vendor/autoload.php';
Now, when running http://mysite/tst, I get the homepage of the site as expected. But when I try another route (other than "/"), I always receive a 404 page not found.
Does this have something to do with privileges of am I missing something?
I figured this one out myself, but if someone tell me how to deploy a Symfony 4 application to a shared hosting, please tell me! I think other people will like this too...
You can create symlik for Public. The method you try can lead to problems.
# Enter Directory Root
cd /root_dir
# Create Symlink
ln -s public_html tst/public

How to organize Rmarkdown files (with Shiny runtime) inside a package

Currently I have an analysis project which I treated as package.
So currently I have the following structure:
mycoolanalysispackage/
|-- .Rbuildignore
|-- .gitignore
|-- DESCRIPTION
|-- NAMESPACE
|-- inst
|-- vignettes
|-- R
`-- mycoolanalysispackage.Rproj
At the end I usually produce many Shiny applications as Rmarkdown-flexdashboard file with Shiny runtime.
-- app1/
|-- index.Rmd
-- app2/
|-- index.Rmd
My question is, in which package subdirectory should I put those application directories (along with their index.Rmd files)?
I also have local Shiny Server, what's the best way to link that Rmarkdown-flexdashboard app to that server?
As with everything else, you place them in a subfolder of the inst folder when developing the package. When the package is installed, all folders in the inst folder will be moved to the package folder, and hence can be used as subfolders. So
mycoolanalysispackage/
|-- .Rbuildignore
|-- .gitignore
|-- DESCRIPTION
|-- NAMESPACE
|-- inst
|-- app1/
|-- index.Rmd
|-- etc...
|-- R
`-- mycoolanalysispackage.Rproj
To access the files from within an R function, you can use system.file:
system.file("app1","index.Rmd",package = "mycoolanalysispackage")
will give you the exact path to the index.Rmd of app1. That result can then be used to deploy the app using the appropriate functions.
See also the manual Writing R Extensions (scroll down a bit)

node-sass script with multiple entry points

I have a project with a structure.scss as main entry point and then each platform a second entry point. Folder Structure:
scss/
|
|-- components/ # Modular Component Files
| |-- login.scss # Structure file for Login Module
|
|-- platforms/
| |-- globals/
| |-- components/
| |-- login.scss
| |-- global-imports.scss
| |-- base.scss
| |-- platform1.scss # Entrypoint for Platform 1
| |-- platform2.scss # Entrypoint for Platform 2
| |-- platform3.scss # Entrypoint for Platform 3
|
`-- structure.scss # Primary Entrypoint for all Platforms
My Npm Scripts:
"scripts": {
"platform": "node-sass --watch --recursive --output-style 'compressed' src/scss/platforms/ -o public_html/inc/assets/css/platforms",
"structure": "node-sass --watch --recursive --output-style 'compressed' src/scss/style.scss public_html/inc/assets/css/style.css",
"scss": "npm run platform & npm run structure"
},
I want that he watch ALL files and compile the files new after change on any file. He is creating at the moment with this Script the correct files... But the problem is, that he try to compile the file as entrypoint file on which one I make changes, that brings me a lot of console errors because he doesn't find any variables or any like that. And at last, I every time, need to make and useless change on the correct file, to get a correct working file...
Have anyone a fix for me for this problem?
And another problem is, that I can't overwrite default mixin vars in platforms > globals > components > login.scss from any platform.scss...
ok i got the solution! Just watch the whole scss folder with:
"scripts": {
"scss": "node-sass --watch --recursive --output-style 'compressed' src/scss/ -o public_html/css/"
},
And give all files that you dont want to use as entriepoint a underscore before the file name! Like _file.scss
_files will be imported but ignored from the watcher.

serverspec using environment variables in Rakefile

Serverspec is used to check on several servers. Therefore the recommend structure of roles is used:
|-- Rakefile
|-- spec
|-- app
| -- ruby_spec.rb
|-- base
| -- users_and_groups_spec.rb
|-- db
| -- mysql_spec.rb
|-- proxy
| -- nginx_spec.rb
|-- spec_helper.rb
To read the data and structure I use a yaml-file.
On the serverspec website is in the Rakefile inside the Raketask the following:
ENV['TARGET_HOST'] = host
Why should I set the host as an environment variable? Wouldn't a local one be enough?
The default spec helper uses it to target hosts for the net-ssh gem. You can refactor the host targeting code in the spec_helper to not even use it if you want and then just use host_inventory for the hostname.
Note the following:
https://github.com/mizzy/serverspec/blob/master/lib/serverspec/setup.rb#L276
https://github.com/mizzy/serverspec/blob/master/lib/serverspec/setup.rb#L292
Despite the anonymous downvote, this is absolutely the correct answer.

Resources