Skip to content

Commit

Permalink
Fix plog_traj_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
caesar0301 committed Mar 31, 2022
1 parent 97e1cff commit 5225c01
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 14 deletions.
20 changes: 11 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
Package: movr
Type: Package
Version: 0.1.5
Version: 0.2.1
Title: Analyzing and Visualizing Human Mobility Data
Description: A set of functions and utilities to analyze and visualize
spatio-temporal mobility data.
Author: Xiaming Chen <chen@xiaming.me>
Maintainer: Xiaming Chen <chen@xiaming.me>
URL: https://github.com/caesar0301/movr
BugReports: https://github.com/caesar0301/movr/issues
Language: en-US
Depends:
R (>= 3.0.0),
dplyr,
tidyr,
data.table,
geosphere,
deldir,
RColorBrewer,
igraph
dplyr (>= 0.7.0),
tidyr (>= 0.6.1),
data.table (>= 1.10.2),
geosphere (>= 1.5-5),
deldir (>= 0.1-14),
RColorBrewer (>= 1.0-5),
igraph (>= 1.1.1),
assertr (>= 2.5)
Suggests:
knitr
LazyData: yes
License: MIT + file LICENSE
SystemRequirements: GNU CMake
VignetteBuilder: knitr
RoxygenNote: 7.1.2
RoxygenNote: 7.1.2
6 changes: 5 additions & 1 deletion R/plot_mobility.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ traj3d.close <- function() {
#' transition between stay points and its width indicates the (log)
#' transition frequencies.
#' @export
#' @examples
#' data(movement)
#'
#' user <- subset(movement, id==20)
#' plot_traj_graph(user$loc, user$time)
plot_traj_graph <- function(loc, time, ...) {
library(igraph)
user <- data.frame(loc=loc, time=time)
stays <- cal_place_dwelling(user$loc, user$time)
print(head(stays))
cut.off <- sqrt(median(stays$dwelling))
stays.cut <- stays[stays$dwelling > cut.off, ]
user.cut <- subset(user, user$loc %in% stays.cut$loc)
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Human mobility data analysis and visualization in R.

On Ubuntu

> sudo apt-get install cmake pkg-config libglib2.0-dev
> sudo apt-get install cmake pkg-config libglib2.0-dev libglpk-dev libgmp-dev libopengl-dev

On Mac OS X

> brew install cmake pkg-config glib
> brew install cmake pkg-config glib glpk

## Install

Expand All @@ -21,7 +21,7 @@ On Mac OS X
install.packages('devtools')

# for movr
install.packages(c('dplyr', 'tidyr', 'data.table', 'geosphere', 'deldir', 'RColorBrewer', 'igraph'))
install.packages(c('dplyr', 'tidyr', 'data.table', 'geosphere', 'deldir', 'RColorBrewer', 'igraph', 'rgl'))
```

2. Install movr
Expand All @@ -42,8 +42,11 @@ b. From source code
# Check package compliance
R CMD check .

# Run examples
R --no-save -e "library(devtools);run_examples()"

# Install
echo "library(devtools); run_examples(); install()" | R --no-save
R --no-save -e "library(devtools);install()"
```

## Visualization
Expand Down
6 changes: 6 additions & 0 deletions man/plot_traj_graph.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
echo "Building native code"
./configure

echo "Check package"
R CMD check .

echo "Regenerate documents"
R --no-save -e "library(devtools);document(roclets=c('collate','namespace','rd'))"

echo "Build package"
R CMD build .

echo "Do release to CRAN"
R --no-save -e "library(devtools);spell_check();release()"

0 comments on commit 5225c01

Please sign in to comment.