This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION shuffle(table_name TEXT, field_name TEXT) RETURNS void AS $$ | |
DECLARE entry RECORD; | |
DECLARE entry_to_swap RECORD; | |
BEGIN | |
FOR entry IN execute format('select * from %s', table_name) LOOP | |
drop table if exists tmp_entry_to_swap; | |
execute format('create temp table tmp_entry_to_swap as (select * from %s order by random() limit 1)', table_name); | |
select * into entry_to_swap from tmp_entry_to_swap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
inputFile=open('C:/tmp/input.blx', 'r') | |
outputFile=open('C:/tmp/output.csv', 'w+') | |
separator = ',' | |
def isDir(elem): | |
return elem.attrib.get('xsi:type') == 'business:Folder' | |
def isDimension(elem): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
best <- function(state, outcome) { | |
## Read outcome data | |
## Check that state and outcome are valid | |
## Return hospital name in that state with lowest 30-day death | |
## rate | |
source("sortHospitalsByOutcome.R") | |
head(sortHospitalsByOutcome(state, outcome), 1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Write a function that reads a directory full of files and reports the number of completely observed cases in each data file. | |
## The function should return a data frame where the first column is the name of the file and the second column is the number | |
## of complete cases. A prototype of this function follows | |
complete <- function(directory, id = 1:332) { | |
## 'directory' is a character vector of length 1 indicating | |
## the location of the CSV files | |
## 'id' is an integer vector indicating the monitor ID numbers | |
## to be used | |
## Return a data frame of the form: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
Take a look at the 'iris' dataset that comes with R. The data can be loaded with the code: | |
library(datasets) | |
data(iris) | |
A description of the dataset can be found by running | |
?iris |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | |
The R language is a dialect of which of the following programming languages? | |
S | |
2 | |
The definition of free software consists of four freedoms (freedoms 0 through 3). Which of the following is NOT one of the freedoms that are part of the definition? | |
The freedom to prevent users from using the software for undesirable purposes. | |
3 | |
In R the following are all atomic data types EXCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
java.util.Scanner is a great tool for parsing but it has some disadvantages. One of them is | |
unchangable buffer with length 1024. It means that working with strings bigger than 1024 will not | |
be correct - in fact only the first 1024 symbols will be scanned. Also java.util.Scanner class is final, | |
so overriding methods is not awailable. | |
Here is a draft implementation of solution when whole text is splitted to N parts on lexeme the nearest to | |
n*1024th symbol and each part is scanned seperately. In this example found lexeme is being replaced with upper case | |
and enclosed with "<>" | |
*/ |