& and | (2)
Like relational operators, logical operators work perfectly fine with vectors and matrices.
Both the vectors linkedin
and facebook
are available again. Also a matrix - views
- has been defined; its first and second row correspond to the linkedin
and facebook
vectors, respectively. Ready for some advanced queries to gain more insights into your social outreach?
This exercise is part of the course
Intermediate R
Exercise instructions
- When did LinkedIn views exceed 10 and did Facebook views fail to reach 10 for a particular day? Use the
linkedin
andfacebook
vectors. - When were one or both of your LinkedIn and Facebook profiles visited at least 12 times?
- When is the
views
matrix equal to a number between 11 and 14, excluding 11 and including 14?
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# The social data (linkedin, facebook, views) has been created for you
# linkedin exceeds 10 but facebook below 10
# When were one or both visited at least 12 times?
# When is views between 11 (exclusive) and 14 (inclusive)?