Create event frequency graph from a datetime column in google spreadsheet - datetime

I have a google spreadsheet containing a column of datetime values. There can be as many as 10 values that occur on a common date (at different times). Is it possible to create a graph that shows frequency of "events per day" such that the x axis is a date and the y axis is a numerical value from 0 to 10? There doesn't appear to be anything in the chart wizard that resembles this idea and my knowledge of spreadsheets is just about nil...

It is possible but I can't say I'm impressed by the results. If your column of datetime values starts in A2, please insert in B2 =int(A2) and in C2:
=if(B1=B2,1+C1,1)
and copy both down to suit. You might want to add an earlier date in B1.

Related

Adding a secondary axis in ggplot corresponding to date when plotting Latitude and Longitude of an individual

I have data containing Latitude and Longitude of an individual. An example of a subset of my data can be found here: https://drive.google.com/file/d/1NWYr8GOwf8WFqfeFf7mUPU2Jt5rkCUYs/view?usp=share_link
The data includes the Latitude and Longitude of locations (approx. every three hours depending on error in fix rates) over a year. There are multiple points per day for the individual. There is also a column corresponding to the elevation of that location.
I am trying to plot the Longitude and Latitude by time (either month or date). So for I have the following code to create this plot:
#read data and format columns;
##month and day as factor for ease of graphing but might need to change to continuous
d<-read.csv("Sample_Data.csv") %>%
mutate(Month=as.factor(Month), ##creates month as factor
Day=as.factor(Day))%>%##create day as factor
arrange(DateTime)##arrange dates
##Plot lat and long- connected by path of travel
trial1<-ggplot(data=d,aes(x=Longitude,y=Latitude))+
geom_path()+
geom_point(size=0.5)+
coord_cartesian()+
theme_bw()
Which results in the following figure:
What I would like to do is add a second axis corresponding to Date or month (pulled from these respective columns in my dataframe), depending on which subsets I will be working with. Essentially I want to create the same figure as above but have the Date (month) as a secondary x-axis so I can visualize paths on a temporal scale as well. I have been using ggplot and am aware I can add a secondary axis through this code, with will duplicate my longitude axis:
Trial1+scale_x_continuous(sec.axis = (~.))
There are lots of resources out there for adding secondary axes, as well as the facet_wrap() feature, however I would like one figure that shows both the temporal and spatial aspects of my data.
Is there a way that I can tell the secondary axis to pull data from the Month Column of my dataset and plot the Lat and Long versus the Month using ggplot?
I am also willing to look into other option in various packages, but want to try and avoid needing to create different data types (move objects for example, or trajectories) as I will need to work further with my data outside of these movement specific packages.
Thanks in advance!

Calculate mean value of date dependent variable for a certain end and start date taking into consideration groups in R

I have two CSV data sets. The first on is monthly data or a certain variable(PM_2.5) given by spacial constrains (latitude and longitude) which can be seen as the place variables. The second data frame contains different start and end dates for the observation. Also, those are given under the same spacial constraint and for each individual v1. You can see the data structure in the pictures. enter image description here enter image description here
I want to sum all observations of (PM_2.5) for one individual (ID) over the observation period (start date to end date) given the constraint that the geospatial identification (latitude, longitude) is the same.
Thanks a lot for your help.
Best,
Luise

Making a stacked bar using different columns in PowerBI

Hi I'm Trying to take data in PowerBI that looks like this
It basically has several columns with reason for call and the length of time in each one - the time varies
Reason1 Reason2 Reason3
-- 30 secs 30 secs
60 secs 1 min ----
--- 2 min ----
I need a graph that shows each of these reason split by the length of calls
thank you (I am also an amateur at PBI so be gentle)
You need to flatten your table into a two column layout. Edit the data source in the Query editor. Starting out, it may look like this:
Select all columns and click the Unpivot Columns command in the Transform ribbon. Now your data looks like this:
Rename "Attribute" to "Category" and rename "Value" to "Time Frame". Filter the Time Frame column and untick Blanks.
Close and apply the query.
Now you can build a stacked horizontal bar chart. Put "Category" on the Axis and drag "Time Frame" into the values. Since it is text, it will be aggregated with a Count. Drag "Time Frame" into the legend to give each time frame its own colour. Viola!

Create a plot showing the number of items released by year

Trying to create a plot showing the number of items (ex. pop_songs) released by year from a dataframe I have (ex. Music_Charts).
I have a year released column in my dataframe and can use that as the x-variable, but I don't know what I would use for the y-variable to show the boxplot since I have the Top 500 Ranked songs on the dataframe.
Well, based on your very general question, if you have a data frame column with the years for each song, you can easily get the count for that column using table.
table(dataframe$year_released)
That should give you the number of entries for every year, then you can plot them (i'm guessing that's what you need)

Excel overlaping intervals with a type of vlookup

This is a snipet of the data, of which there is a ton, with explanation of what I want to do:
File
Basically I have a number of subsets (marked out by 1, 2 ... in a seperate column) of data which have intervals. I need to know if the intervals in the same two subsets overlap and if yes then I need the value (column C) which is associated with the set in columns E-G to be pasted next to the interval in column J-K that overlaps with the interval in F-G. The problem is that the interval in column F-G overlaps with multiple intervals in columns J-K.
I've been trying to solve this with
=if(or(and(x>=a,x<=b),and(a>=x,a<=y)),"Overlap","Do not overlap")
But the problem is I can't find a way to do this for multiple overlaps. If you think this can't be done in excel and know how else to do it (e.g. R) please let me know.
Thank you
In Excel try this formula in L4 copied down
=IFERROR(INDEX(C$4:C$100,MATCH(1,INDEX((J4<=G$4:G$100)*(K4>=F$4:F$100)*(I4=E$4:E$100),0),0)),"No overlap")
This will find the first row within each subset (if any) where the F/G interval overlaps with the current row J/K interval, if no such row exists you get "no overlap"

Resources