I am trying to label the projected years from 2016 to 2045 in 3 decades i.e. (2016-25, 2026-35, 2036-45)
This is what I have tried:
Projperiod <- paste(201:203, 6, “-“, substr(201:203,3,3),5,sep=“”)
The result is
2016-15 2026-25 2036-35
The last two digits do not appear correctly. This labeling is important as it defines the projection period in next steps.
Any help will be highly appreciated.
Related
I have community dataset for macrofauna associated with corals that I am struggling to analyze it in vegan package.
Coral colonies were imaged in 2015 (for two coral species at five sites) and we counted macrofauna species found on each colony. In 2016 and 2017, we revisited the same coral colonies to count associated fauna. So far, this is a repeated measure experiment (Year/colonyID), but I have two problems:
1- some of the revisited colonies in 2016 and 2017 had no fauna (143 out of 686 total colonies) meaning we have zero samples (n=143). This caused a problem in adonis function to test the dissimilarity.
adonis(F_Mat ~ Species+Site+Year, data = F_Meta, permutations = 9999)
you have empty rows: their dissimilarities may be meaningless in method �bray�missing values in results
I understand this message, but I must account for zero samples as they represent the dynamic of fauna community over time. I tried "bray" and "Jaccard" methods but both give me the same error message as above.
I used log1p (1+F_Mat ) to replace zeros to transform my values and replace zeros, but it did not work to calculate alpha diversity; Chaol diversity index, but worked for adonis function. To cope with that, I used dist.zeroes function in BiodiversityR package to deal with adonis, and use abundance matrix for the alpha diversity. Not sure if it the right approach though
2- Some colonies in 2015 could not be found in later years (2016 and 2017), and instead, we took images for new colonies in 2016 and 2017 that have not been visited previously. So, it is not really repeated measure and I think we should account for colony ID as a random effect instead, but this is not doable in vegan to my knowledge.
Any advice on how to analyze this dataset and troubleshoot my experimental problems? Your help is really appreciated.
From: https://rdrr.io/cran/vegan/man/vegdist.html
In principle, you cannot study species composition without species and you should remove empty sites from community data. Since vegdist is passed to adonis I believe this statement carries through.
A potential solution might be adding a dummy species that has a constant value for each site.
If you end up needing to remove these rows or columns that sum to 0 you can reference this question How to remove columns and rows that sum to 0 while preserving non-numeric columns
df <- df[rowSums(df[-(1:7)]) !=0, ]
I have my graph set up, so that a sum total is in rows, and month is in columns. I would like to see the last three years as separately colored bars or lines in the same graph. I created sets for 2014,2015, and 2016, but for some reason can not get it to do what I have described above.
Thank you.
One way would be to create a calculated field that "groups" those 3 years into one value/label, then use that in the colors card.
The calculated field may look something like:
IF [YearField] >= 2014 AND [YearField] <= 2016 THEN 'Last 3 Years' ELSE STR([YearField]) END
I have daily river flow data for 1975-2009 and I am asked to find the 7 consecutive days within each year that have the smallest flows.
Any advice how to start this? I've only been using MATLAB for a couple weeks.
Thanks!
You could convolve the data with ones(1,7) and look for the minimum, which will yield the starting day of your dry period:
[~,startingDay] = min(conv(flow,ones(1,7),'valid'))
(This is basically a moving average filter without the normalization).
Loop through the years to get each year's result.
Start by finding cumulative sum with cumsum. The difference between cumulative sums 7 days apart will give you the total for those 7 days. Then pick the minimum of those.
a = cumsum(flow);
b = a(8:end) - a(1:end-7);
[m,i] = min(b);
Here m holds the smallest total over 7 consecutive days, and i is a vector of indices telling you when they occurred.
I have built a bar chart visualization with Spotfire that includes the use of the Over function to give a running total. Months are on the X axis and counts are on the Y axis.
My data set contains months where there were no values. When I graph that there is no bar although a running total should still contain a value although zero was added for that month.
How do I get a month with no value to still show a bar for that month?
Yes, You can try Count() OVER (AllPrevious([Axis.X])), this will work for bar chart and line chart. or if you r using 55.0 and above version you can use Cummulative function which is inbulit is recent versions.
Hope this help :)
Here is my data set (note the 2 missing values):
Month Value
Jan-14 1
Feb-14 2
Mar-14
Apr-14
May-14 5
Jun-14 6
Jul-14 7
Aug-14 8
Sep-14 9
Oct-14 10
Nov-14 11
Dec-14 12
Here is my expression (taken from the built in Cumulative function):
Sum([Value]) THEN Sum([Value]) OVER (AllPrevious([Axis.X]))
Here is my result:
So it looks like your expression is wrong.
since I saw this old topic and didn´t find a solution at first, there it is:
the formula is good, but displaying the months with no values is an option of the bar chart itself.
Go to the bar chart "Properties", then "Appearance", then at the bottom of the window: tick the box "Compensate for missing values".
Hope this will prevent next users from searching in the future :)
This relates to my How do I achieve a pivot report in Crystal Reports for Visual Studio? The data is the same, but they want a line chart as well.
So, my data is {datetime}, {car-id}. The X -axis of the chart must show the hour of {datetime}, the Y axis the number of cars that entered the park at that hour, and I must have seven data series, lines, one for each day of the week. So, e.g. the x/y point on the green line shows that on Wednesday, at hour x, y cars entered the car park.
Common sense tells me that I can kludge this by transforming the data source so that each day has its own column in a table, a table like this:
DateTime
WeekDay
CarCount
Yet the Crystal line chart doesn't seem to support more than one column, so there must be a different and better way of doing this. The weekday is part of {datetime} after all.
How can I achieve this chart? I am a rank amateur at charting, and Crystal's idiosyncrasies really aggravate my lack of skills and experience in this area.
It's not obvious how to get multiple series to show up properly.
First, create a formula that will extract the day of week from the datetime: dayofweek({datetime}) and then create another that will extract just the hour: hour({datetime}).
From there, insert a chart from scratch and make the following settings in the Chart Expert
Select "Line" under the Type tab
Under the Data tab, select "On change of" and select your {#HourOfDay} formula first. This will create each hour as a point on the X-axis.
In that same spot, also insert the {#DayofWeek} formula. This will create a new line
for each day of the week. This is, in my opinion, the non-obvious part.
Finally, to pick your Y-axis values,
select {car-id} where it says "Show value(s)". It should default to
the count summary of that field.
(Note: in the screenshot below, you would just replace {Customer.Customer_Name} with {car-id}
I had this issue for 5 years and finally solved it. I have a XY chart with multiple series.
Everything needs to be in a formula.
The graph should be in the report header section of a subreport. The sub report generates the X Y data like this:
Series X Y
Ser1 2020 1
Ser1 2021 2
Ser2 2020 0
Ser2 2021 1
For me I have as series "Energy" ie 6, 9, 12 etc.
Then I have a date/time and a measurement.
On change of (Energy formula)
Show Values
#1 DateTime (convert this to int ie 2000.9 for 9/2000) - dont summerize
#2 Measurement (number) - dont' summerize
Then you can do the color highlighter to capture your series (6 is red etc).
The legend won't work - can't figure out that yet.