playEpGame: Generate either a widget or video to view zoid behavior over...

Description Usage Arguments Value Examples

Description

Generate either a widget or video to view zoid behavior over the course of a game.

Usage

1
2
3
playEpGame(g, game, episode.col, game.col, board_rep.col, zoid_rep.col,
  time.col = NULL, video = F, suffix = NULL, .interval = 0.1,
  justTime = F)

Arguments

g

A data object or string location. Used to form an object of class "data.table" that holds zoid_rep and board_rep information.

game

A numeric. Used to select which game you are interested in.

episode.col

A string. Used to designate the name of the column from the object g that contains Episode Numbers.

game.col

A string. Used to designate the name of the column from the object g that contains Game Numbers.

board_rep.col

A string. Used to designate the name of the column from the object g that contains Board Representations.

zoid_rep.col

A string. Used to designate the name of the column from the object g that contains Zoid Representations.

time.col

A string. Used to designate the name of the column from the object g that contains Time stamp information. Setting this alters the behavior of the manipulate version of the function, uses time instead of "frame" as the second slider.

video

Baoolean (default FALSE). Used to determine whether the output will be a widget or a video.

suffix

A string used if video is TRUE. The suffix is added to the end of the video file name for clarity. Defaults to NULL, and if NULL the suffix will be the current datestamp.

.interval

A numeric set to determine the duration of a frame for video playback (when video is TRUE). Defaults to 0.1. When time.col is provided, and video is False, sets the increment the slider will move at.

justTime

A boolean. Used in conjunction with time.col such that when time.col is provided changes manipulate widget functionality to only use one slider for time.

Value

Either a Shiny widget or Video depending on the designation of video (and whether the "animation" package loads).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
rda <- fread("data.txt") ## load in the file, or use sample data
data(MetaTWO)
rda <- MetaTWO

#option one, do not include "time.col". This has episodes as the top slider, and frames as the bottom slider.
playEpGame(g=rda, game = 3,game.col="V7",episode.col="V8",board_rep.col = "V24",zoid_rep.col="V25")

#option two, do include "time.col", justTime default to F. This has episodes as the top slider, and time in the episode as the bottom slider. .interval defaults to 0.1
playEpGame(g=rda, game = 3,game.col="V7",episode.col="V8",board_rep.col = "V24",zoid_rep.col="V25", time.col ="V1")

#option three, do include "time.col", set justTime to T. This has only one slider which is time.  .interval defaults to 0.1
playEpGame(g=rda, game = 3,game.col="V7",episode.col="V8",board_rep.col = "V24",zoid_rep.col="V25", time.col ="V1", justTime = T, .interval = .1)

## The following results in a video. However, it requires the Animation package (and will download it if it is not installed).
##      Further, requires that you externally install FFmpeg (not an R package) as that is the software animation requires to create a video
##      using the function install.ffmpeg() will provide steps on how to do so.  Note that creating a video takes a long time
##      about as long as the game would've taken in realtime. Also note that the interval refers to how long each frame should stay on, which means that
##      you're not actually getting the actual time between each frame.
playEpGame(g=rda, game = 3,game.col="V7",episode.col="V8",board_rep.col = "V24",zoid_rep.col="V25", time.col ="V1", video=T, suffix= "003", .interval = 0.1)

# Additional Example with Built-in Data
data(MetaT) ## loads in example Meta-T complete file, unaltered
playEpGame(g=MetaT, game = 2, game.col = "game_number", episode.col = "episode_number",
           board_rep.col = "board_rep", zoid_rep.col = "zoid_rep")

data(MetaTWO) ## loads in example Meta-TWO game data file, unaltered
playEpGame(g=MetaTWO, game = 2, game.col = "V7", episode.col = "V8",
           board_rep.col = "V24", zoid_rep.col = "V25")

CogWorks/TetrisViewer documentation built on May 6, 2019, 4:30 p.m.