readStatsFile: Collect data from a standard world/stats directory

Description Usage Arguments Value Note See Also Examples

Description

codereadStatsFile is meant to parse the stats files located in a world/stats dir (since Minecraft 1.7). It reads a <UUID>.json file and returns it as a data.frame

Usage

1
readStatsFile(file, dropPrefixes = TRUE)

Arguments

file

The stats file (JSON) to parse, usually located in the server world directory, e.g. world/stats

dropPrefixes

Strips the stat. or achievement. prefixes from the variable names. Defaults to TRUE.

Value

A data.frame containing every stat contained in the file as a column name

Note

If you want to combine multiple data.frames imported with this function, you could do so using rbind.fill, since it is very unlikely that each data.frame will have the same columns present, hence rbind is likely to fail.

See Also

getNameFromUUID

Other res: stats2df

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
require(plyr) # For rbind.fill
playerstats <- data.frame()
for(file in dir("server/world/stats")){
 stat <- readStatsFile(paste0("server/world/stats", file))
 playerstats <<- rbind.fill(stat, playerstats)
}

## End(Not run)

jemus42/wurstmineR documentation built on May 19, 2019, 4:03 a.m.