Tutorial by Examples: f

To copy a data.frame as a data.table, use as.data.table or data.table: DF = data.frame(x = letters[1:5], y = 1:5, z = (1:5) > 3) DT <- as.data.table(DF) # or DT <- data.table(DF) This is rarely necessary. One exception is when using built-in datasets like mtcars, which must be copi...
It is generally not considered 'best practice' to re-purpose the reserved names of Properties or Methods as the name(s) of your own procedures and variables. Bad Form - While the following is (strictly speaking) legal, working code the re-purposing of the Find method as well as the Row, Column and ...
Basic syntax DT[where, select|update|do, by] syntax is used to work with columns of a data.table. The "where" part is the i argument The "select|update|do" part is the j argument These two arguments are usually passed by position instead of by name. A sequence of steps c...
Just as the random forest algorithm may be applied to regression and classification tasks, it can also be extended to survival analysis. In the example below a survival model is fit and used for prediction, scoring, and performance analysis using the package randomForestSRC from CRAN. require(rand...
survival is the most commonly used package for survival analysis in R. Using the built-in lung dataset we can get started with Survival Analysis by fitting a regression model with the survreg() function, creating a curve with survfit(), and plotting predicted survival curves by calling the predict m...
Open a terminal and run: sudo dnf install arduino Open the Arduino application, or type arduino into the terminal
:set foldmethod={method} sets the fold method for the current window. This determines how folds are manipulated within that window. Valid options for "method" are: manual (folds are manually created and destroyed by the user) indent (folds are created for lines of equal indentation) m...
zf{motion} creates a fold that covers the text that "motion" would cover. {count}zF creates a fold that covers "count" lines. {range}fo[ld] creates a fold for the lines in the provided range. All three commands are valid only when foldmethod is set to manual or marker. In ...
zo opens a fold underneath the cursor. zO opens all folds underneath the cursor, recursively. zc closes a fold underneath the cursor. zC closes all folds underneath the cursor, recursively. za toggles a fold under the cursor (a closed fold is opened, an opened fold is closed). zM closes all f...
ExampleScript script = GameObject.FindObjectOfType<ExampleScript>(); GameObject go = script.gameObject; FindObjectOfType() returns null if none is found. ProsConsStrongly typedPerformance degrades along the number of gameobjects needed to evaluatePossible to search both single objects...
Early on a Flash developer uses frames, as they are natively available in Flash player, to host various screens of their application (most often it's a game). Eventually they might stumble upon an issue that something goes wrong exactly because they have used frames, and overlooked the difficulties ...
Preparation $ mkdir globbing $ cd globbing $ mkdir -p folder/{sub,another}folder/content/deepfolder/ touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile $ shopt -u nullglob $ shopt -u failglob $ shopt -u dotglob $ shopt -u nocaseg...
Two important things to note when adding fields to a Pivot Table are Orientation and Position. Sometimes a developer may assume where a field is placed, so it's always clearer to explicitly define these parameters. These actions only affect the given Pivot Table, not the Pivot Cache. Dim thisPivot ...
This example changes/sets several formats in the data range area (DataBodyRange) of the given Pivot Table. All formattable parameters in a standard Range are available. Formatting the data only affects the Pivot Table itself, not the Pivot Cache. NOTE: the property is named TableStyle2 because the ...
Maybe Maybe is a Functor containing a possibly-absent value: instance Functor Maybe where fmap f Nothing = Nothing fmap f (Just x) = Just (f x) Maybe's instance of Functor applies a function to a value wrapped in a Just. If the computation has previously failed (so the Maybe value is ...
The __import__() function can be used to import modules where the name is only known at runtime if user_input == "os": os = __import__("os") # equivalent to import os This function can also be used to specify the file path to a module mod = __import__(r"C:/path/...
Until recently, using android.support.v4.app.FragmentPagerAdapter would prevent the usage of a PreferenceFragment as one of the Fragments used in the FragmentPagerAdapter. The latest versions of the support v7 library now include the PreferenceFragmentCompat class, which will work with a ViewPager ...
Conditions are a fundamental part of almost any part of code. They are used to execute some parts of the code only in some situations, but not other. Let's look at the basic syntax: a = 5; if a > 10 % this condition is not fulfilled, so nothing will happen disp('OK') end if a < 1...
In some cases we want to run an alternative code if the condition is false, for this we use the optional else part: a = 20; if a < 10 disp('a smaller than 10') else disp('a bigger than 10') end Here we see that because a is not smaller than 10 the second part of the code, after t...
C++14 Those following duration user literals are declared in the namespace std::literals::chrono_literals, where both literals and chrono_literals are inline namespaces. Access to these operators can be gained with using namespace std::literals, using namespace std::chrono_literals, and using names...

Page 166 of 457