Learn R Programming

autoharp (version 0.2.0)

Semi-Automatic Grading of R and Rmd Scripts

Description

A customisable set of tools for assessing and grading R or R-markdown scripts from students. It allows for checking correctness of code output, runtime statistics and static code analysis. The latter feature is made possible by representing R expressions using a tree structure.

Copy Link

Version

Install

install.packages('autoharp')

Monthly Downloads

509

Version

0.2.0

License

MIT + file LICENSE

Maintainer

Agrawal Naman

Last Published

February 19th, 2026

Functions in autoharp (0.2.0)

forestharp-helpers

Forestharp helpers
find_branch_num

Find the branch that leads from one node to another.
lang_2_tree

Convert language object to tree.
rmd_to_forestharp

Convert to TreeHarp objects
get_node_types

Generic for Getting Node Types
get_next_subtree

Generate the next sub-tree.
reset_path

Reset search path of current R session
log_summary

Generate a dataframe from the log file.
get_adj_list

Generic for Getting Adjacency List
env_size

Calculates the Total Memory Used
is_subtree_rooted_at

Checks if a tree is rooted at a node of another tree.
get_child_ids

Generic for Getting Child Node Ids
jaccard_treeharp

Computes Jaccard Index
get_parent_id

Generic for Getting Parent Node Id.
get_parent_call_id

Get Node Id of Parent Call
get_child_ids2

Get the children node ids
rmd_to_token_count

Count tokens in R/Rmd
keep_branches

Keep only branches specified by node numbers
subtree_at

Extract a sub-tree.
join_treeharps

Root a list of trees.
is_connected

Checks if a graph is connected.
get_next_depth_id

Get the id and depth of a child node.
get_libraries

Extracts the Packages Used in An Rmd File.
%>%

Pipe operator
get_levels

Obtains the node levels from a tree.
rbind_to_nodes_info

Update node information.
path_to_root

Extract a path from node to root.
generate_all_subtrees

Generate all subtrees from a tree.
render_one

Run a single Rmd file through autoharp.
generate_thumbnails

Generate a html of thumbnails
get_parent_id2

Get the parent node id
is_cyclic_r

Checks if a graph contains any cycles.
pipe_can_improve_this

Identify if use of pipe operator can improve a code section
update_adj_list

Update adjacency list.
replace_sp_chars_filename

Replace Special Characters in File Name
plot,TreeHarp-method

TreeHarp Plotting TreeHarp Objects
render_prechecks

Conducts checks before rendering file
prune_depth

Prune a tree up to a specified depth.
only_actual_args_differ

Checks if two expressions differ only in terms of actual arguments
populate_soln_env

Returns solution environment and test code from template.
get_recursive_index

Obtain an index to extract out a sub-call
matrix_2_adj_list

Convert adjacency matrix to a list.
to_BFS

Function to rearrage nodes in BFS
tree_sim

Compute tree similarity
autoharp

autoharp: Semi-Automatic Grading of R and Rmd Scripts
K2

Compute tree similarity
carve_subtree

Carve out branches to form a new tree.
as.matrix

TreeHarp Cast a TreeHarp to Matrix.
carve_mst

Carve a Minimal Spanning Tree Out
adj_list_2_matrix

Convert adjacency list to a matrix
TreeHarp-class

An R expression as a tree.
apply_can_improve_this

Identifies if an apply function can improve the code
check_runtime

Calculate Run-time Statistics
count_lints_one

File lint counter
check_rmd

Check if a File is Rmd
check_correctness

Check correctness of student solution rmd.
fapply

Apply a function to a forest of trees.
extract_section_text

Extract section text from Rmd
clean_dir

Removes md Files when no HTML Present
extract_chunks

Extract chunks that match a pattern.
extract_non_chunks

Extract non-chunks from an Rmd file.
copy_e2e

Copy an object from one env to another.
count_lints_all

Lint counter