Tables in R: Expand a header title across 4 cells - r

I have a table in R that has four columns of temperatures. I want the title of all 4 rows to be "Temperature"
I currently have them as 'Temperature.1" "Temperature.2" and so on. This is my first time using R and I believe it will affect a chi-test that I want to run.
Thanks

Related

Transform multiple entries in cell into new columns in R

I have a messy dataset with multiple entries in some cells. The numbers in paranthesis refer to the specific columns "(1)", "(2)", and "(3)". In this example
multiple entries in cell 30 refers to column (2) and 20 refers to column (1). No information for column (3).
I would like to split up/extract the values in the cells and create 3 additional columns.
Several hundred cells are affected in several columns.
Dataset
In the end I would like to have 3 new columns for each column affected. Any idea how I do that? I'm still a rookie so help is much appreciated!

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!

R studio table formatting - how to fit all columns on 1 page

I have a table that contains 15 columns. How can I fit all columns in one page?
Right now the first 12 columns are printed first. The other 3 columns are printed below the first 12 columns.
I need all columns names show on the same row.
I am using R-markdown in Rstudio.
Thank you.

Displaying datatable column values in dollars in Shiny r

I have a datatable where one of the columns should be expressed in dollars and some as percentages. I've been looking around and I'm still not sure how to do it - seems like it would be easy?
The trickier part is I have another data table where only certain entries need to be expressed as dollars (i.e. not whole rows or whole columns) - is there a way to handle this?
Imagine your datatable (myData) is 2 columns by 10 rows.
You want the second row to be in dollars:
myData[,2]<-sapply(myData[,2],function(x) paste0("$",x))
Or, you want rows 6 to 10 in the first column to be percentages:
myData[6:10,1]<-sapply(myData[6:10,1],function(x) paste0(x,"%"))
Or, you want rows 1 to 5 in the second column to be in dollars, you can do:
myData[1:5,2]<-sapply(myData[1:5,2],function(x) paste0("$",x))

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