Git Product home page Git Product logo

cma-week3's People

Contributors

thereallinusrg avatar

Watchers

 avatar

cma-week3's Issues

Task 5 _ plot not complete

cma-week3/ex3_md.Rmd

Lines 141 to 148 in aa1e24e

pedestrian%>%
ggplot(aes(x= E, y= N)) +
geom_path(aes(colour=TrajID)) +
geom_point(aes(colour=TrajID)) +
facet_wrap(~TrajID, nrow = 2) +
coord_equal(1) +
theme_set(theme_minimal()) +


You correctly created the six different plots based on every of the available trajectories. In order to come up with a plot which resembles even more the one we have in the gitbook (https://computationalmovementanalysis.github.io/W03_04_tasks_and_inputs.html), you have to add also once more the dataset (pedestrians.csv), without including this time the TrajID info. Below I attach how I did it:

ggplot(pedestrians, aes(E,N)) +                                                                                   
  geom_point(data = dplyr::select(pedestrians, -TrajID),alpha = 0.1) +  # here I am adding the dataset once 
                                                                        # more, without the TrajID column                                          
  geom_point(aes(color = as.factor(TrajID)), size = 2) +                                                          
  geom_path(aes(color = as.factor(TrajID))) +                                                                     
  facet_wrap(~TrajID,labeller = label_both) +                                                                    
  coord_equal() +                                                                                                 
  theme_minimal() +                                                                                               
  labs(title = "Visual comparison of the 6 trajectories", subtitle = "Each subplot highlights a trajectory") +
  theme(legend.position = "none")     

Task 4 _ segments < 5

cma-week3/ex3_md.Rmd

Lines 118 to 121 in aa1e24e

caro5plus <- caro %>%
group_by(segment_id) %>%
mutate(n = length(TierID)) %>%
filter(n >= 5)


This is an accepted way to go, since there is the assumption that everything is sampled in a 1min interval.
You could also filter out the segments with duration < 5 mins, by cmputing the actual duration and then performing the filtering based on the newly created column. You could use the following expression to do it:

mutate(duration = as.integer(difftime(max(DatetimeUTC),min(DatetimeUTC),"mins")))

Something like this:

caro60_moves %>%                                                                   
  group_by(segment_id) %>%                                                              
  mutate(duration = as.integer(difftime(max(DatetimeUTC),min(DatetimeUTC),"mins"))) %>%
  filter(duration > 5) %>%                                                               
  ggplot(aes(E, N, color = segment_id)) +                                                
  geom_point() +                                                                         
  geom_path() +                                                                         
  coord_equal() +                                                                        
  theme(legend.position = "none") +                                                    
  labs(subtitle = "Long segments (removed segements <5 minutes)")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.