Which functions could I use in Web-IFC libraries that could let me edit ifcpropertysets, ifcproperties, ifctemplates after loading the IFC file? - ifc

Which functions could I use in Web-IFC libraries that could let me edit ifcpropertysets, ifcproperties, ifctemplates after loading the IFC file, before re-exporting it ?

Related

Best way to reference files outside directory in R

So I use a lot of custom built functions in R which I save in the documents folder in my pc. I would like to bring these functions into my R environment (I usually use source()). At the moment I use the entire file path, i.e. C:\Users\usename\documents\R functions\my_function.r and then create a quick access shortcut link in my project directory to these functions (for easy reference in case its needed). However I was wondering if there is a better way to reference these files. By better I basically mean shorter, or a way to source the files through the quick access shortcut. An alternative to this would be to create a secondary directory so I could just type source("&/my_function.r") (the "&" means secondary directory). This is just a minor inconvenience I think would make life easier if resolved. What do yo think? is this unnecessary complication? Is there anyone in a similar situation as me that has any tips for easily sourcing functions?
Thanks a lot!
If these are functions you often use, you could wrap them in a minimalistic package. Then your call would just be library("myhelpers") and you have all of them available.
Creating this package is quite easy. Assuming you use RStudio, you just:
Create a package: File -> New Project -> New Directory -> R Package
Give it the name you want e.g. "myhelpers"
Specify the folder it should be in
Then RStudio directly creates the package structure for you.
Now you have the package structure in your folder. It will look like this:
- DESCRIPTION
- man
- NAMESPACE
- R
- myhelpers.Rproj
You just have to put your .R files with the functions in the R folder. It does not matter, if the functions are in one file or in multiple files.
Then in R Studio go to the Tab "Build" and click "Install and and Restart". That's it!
Now in your other projects or R files you can just type and use all the functions you put in the R folder:
library("myhelpers")
var <- myfunction1(x)
If you later on want to edit your package functions or add new ones, you can just go to the package folder and click on myhelpers.Rproj and RStudio will open your package project for you. After your changes just click again Build -> Install and and Restart to update the package.
Here is also a short explanation with pictures. This is all you need to use your functions for yourself. The nice thing is, from there you can also go further if needed. E.g. add documentation to your functions. (then you could also have a help() page to your function).

How to load self-written package documentation with '?my_package_name'?

I made a package in R called "my_package_name". When I run ?my_package_name or ??_my_package_name, no results are found. I want a help file to be loaded in the same way that ?ggplot2 loads a package help file.
I can run ?my_function_name to obtain the help files for my functions. However, this does not work with my package name, even though the description file is complete. I found that help(package = my_package_name) loads a page that contains the description file and help pages, but I would like load a page with ?my_package_name.
I would say that the easiest way is probably to run the following from the usethis package. It will create the file needed to have your package documentation
usethis::use_package_doc()
I suggest reading the documentation of the function to understand what's going on under the hood.

Can I use an R library embedded in Scala with rscala?

I imported the org.ddahl.rscala class into my Scala project and have gotten the minimal example found here: https://dahl.byu.edu/software/rscala/scaladoc/org/ddahl/rscala/RClient.html to run. Now I would like to use an R library embedded in my Scala code if possible; however I cannot find what syntax I would use to import an external library from the rscala package.
Calling from RClient object is not supported, the below does not work:
val R = org.ddahl.rscala.RClient()
R.library("libraryname")
Is this something which is possible to do, or is rscala limited in scope to the methods listed on the scaladocs page?
R.eval("require {library_name}")

How to get two packages to handle the same file extension

I would like to know how to get two packages to compile the same file extension.
I am writing a package that compiles .jsx by looking for certain strings and replacing them. Inside this plugin, I am using isobuild:compiler-plugin#1.0.0:
Plugin.registerCompiler({
extensions: ['jsx']
}, function () {
...
});
The problem is that I cannot use this with mdg's jsx package because that package is also trying to compile .jsx.
Meteor gives me:
While determining active plugins:
error: conflict: two packages included in the app (jsx and my-plugin) are both trying to handle *.jsx
Ideally, I would like jsx plugin to compile the .jsx files first, and then my plugin to compile them again. Any suggestions on how to achieve this? Or can someone point me to any other directions?

Lazy package dependency in R

I'd like to write a R package. A small part of its functionality would be to save data into xlsx file. But this functionality would require a big and heavy dependency: library(xlsx). So I'd like to make this dependency somehow optional and lazy-loaded.
What is the Best Practice for it?
I guess I could simply library(xlsx) in the code of the function that need it, and handle possible failures of this command.
I believe the most robust way to do this is the add the following line to the NAMESPACE of your package:
importFrom(xlsx, the_function_you_need)
along with
Depends: xlsx
in the DESCRIPTION file. As far as I understand, this will give your package access to the function you want without loading the entire library. There is some discussion of importFrom here: What is the benefit of import in a namespace in R?

Resources