gen_ag_csv: Autograde Autoformat CSV File Format

Description Usage Arguments Value Examples

View source: R/gen_agfile.R

Description

Creates a valid autograde file when supplied with predictions

Usage

1
gen_ag_csv(yhat, prob, prob.dir = getwd())

Arguments

yhat

A vector, matrix, data.frame of predicted y values.

prob

A string that indicates the name of the problem the data should conform to. This name must match a value available via ....

prob.dir

A string containing the path to where the problem directory is found

Value

A .csv named by the problem name alongside the date and time the predictions were made where the observations are aligned on each new line written to the working directory given by getwd().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Set seed for reproducibility
set.seed(1337)

# Simulate values
n = 100
beta = 2.5
x = beta*rnorm(n, 0, 1)
y = x + rnorm(n, 1, 2)

# Create a regression model
mod = lm(y~x)

## Predict under model
yhat = predict(mod)

gen_ag_csv(yhat, "test-proj")

## Predict under new data
new = data.frame(x = seq(-3, 3, 0.5))
yhat2 = predict(mod, new)

gen_ag_csv(yhat2, "test-proj")

coatless/autograde documentation built on May 13, 2019, 8:45 p.m.