Tutorial by Examples: sin

Pre-processing in caret is done through the preProcess() function. Given a matrix or data frame type object x, preProcess() applies transformations on the training data which can then be applied to testing data. The heart of the preProcess() function is the method argument. Method operations are ap...
In C, character constants and string literals are different things. A character surrounded by single quotes like 'a' is a character constant. A character constant is an integer whose value is the character code that stands for the character. How to interpret character constants with multiple charac...
Interface declaration for downloading a file public interface ApiInterface { @GET("movie/now_playing") Call<MovieResponse> getNowPlayingMovies(@Query("api_key") String apiKey, @Query("page") int page); // option 1: a resource relative to your bas...
There are two ways to get singleton class of an object singleton_class method. Reopening singleton class of an object and returning self. object.singleton_class singleton_class = class << object self end
Singleton classes share their instance/class variables with their object. class Example @@foo = :example end def Example.foo class_variable_get :@@foo end Example.foo #=> :example class Example def initialize @foo = 1 end def foo @foo end end e = Ex...
In Normal, type the following to delete a range of lines into a named register :10,20d a This will delete lines 10,20 in register "a. We can verify this by typing :reg This will show the text that was delete in register "a. To paste the contents in "a, just type "ap ...
$ gunzip -c input.fastq.gz | paste - - - - | head @IL31_4368:1:1:996:8507/2 TCCCTTACCCCCAAGCTCCATACCCTCCTAATGCCCACACCTCTTACCTTAGGA + FFCEFFFEEFFFFFFFEFFEFFFEFCFC<EEFEFFFCEFF<;EEFF=FEE?FCE @IL31_4368:1:1:996:21421/2 CAAAAACTTTCACTTTACCTGCCGGGTTTCCCAGTTTACATTCCACTGTTTGAC + ...
$ gunzip -c input.fastq.gz | awk '{printf("%s%s",$0,((NR+1)%4==1?"\n":"\t"));}' | head @IL31_4368:1:1:996:8507/2 TCCCTTACCCCCAAGCTCCATACCCTCCTAATGCCCACACCTCTTACCTTAGGA + FFCEFFFEEFFFFFFFEFFEFFFEFCFC<EEFEFFFCEFF<;EEFF=FEE?FCE @IL31_4368:1:1:996:21421/2...
with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (Fruit'Image (X)); end Main; Result ORANGE
with Ada.Text_IO; procedure Main is X : Integer := 17; begin Ada.Text_IO.Put_Line (Integer'Image (X)); end Main; Result 17
with Ada.Text_IO; procedure Main is X : Float := 2.71; begin Ada.Text_IO.Put_Line (Float'Image (X)); end Main; Result 2.71000E+00
If a static constructor throws an exception, it is never retried. The type is unusable for the lifetime of the AppDomain. Any further usages of the type will raise a TypeInitializationException wrapped around the original exception. public class Animal { static Animal() { Consol...
For the sake of this example, let us assume that we have a server for handling the POST requests that we will be making from our Android app: // User input data. String email = "[email protected]"; String password = "123"; // Our server URL for handling POST requests. String UR...
Casting: The Basics Casting is used to transform data from long to wide format. Starting with a long data set: DT = data.table(ID = rep(letters[1:3],3), Age = rep(20:22,3), Test = rep(c("OB_A","OB_B","OB_C"), each = 3), Result = 1:9) We can cast our data using the...
Manually open and close a file. # Using new method f = File.new("test.txt", "r") # reading f = File.new("test.txt", "w") # writing f = File.new("test.txt", "a") # appending # Using open method f = open("test.txt", "r&...
One approach that is employed often is to use bootstrap's gridded framework in order to define the area that the chart will exist in. Using this in conjunction with clientWidth variable and the window.onresize event, it is very easy to create responsive d3 SVGs. Let's first create a row and a colum...
Icicle uses Awaitables and Generators to create Coroutines. require __DIR__ . '/vendor/autoload.php'; use Icicle\Awaitable; use Icicle\Coroutine\Coroutine; use Icicle\Loop; $generator = function (float $time) { try { // Sets $start to the value returned by microtime() after ap...
A common refrain in R goes along these lines: You should not have a bunch of related tables with names like DT1, DT2, ..., DT11. Iteratively reading and assigning to objects by name is messy. The solution is a list of tables of data! Such a list looks like set.seed(1) DT_list = lapply(setNam...
Listing files in a zip archive is done with unzip function from the utils package (which is included in base R). unzip(zipfile = "bar.zip", list = TRUE) This will list all files in "bar.zip" and extract none. Tilde expansion is done automatically from your working directory. ...
Listing files in a tar archive is done with untar function from the utils package (which is included in base R). untar(zipfile = "bar.tar", list = TRUE) This will list all files in "bar.tar" and extract none. Tilde expansion is done automatically from your working directory. ...

Page 69 of 161