rpivotTable- hiddenFromAggregators and hiddenFromDragDrop options are not working - r

I tried to find any example related to this topic but didn't find any clear answer. Issue related to this was asked and closed a year ago. Sorry, I didn't find anything useful on that blog.
Firstly, I'm trying to hide a specific variable from drag and drop panels while constructing a pivot table. Secondly, I want to use a specific variable as an aggregator and remove all rest of the variables from the aggregator list.
Note: I don't want to remove that variable from the data frame. Options for example rows, cols, vals, aggregatorName, rendererName are working perfectly. But hiddenFromDragDrop and hiddenFromAggregators are not working, or I'm using them in wrong way.
My data is too big. An example code to clear my question is given here. This data has 4 variables, Eye, Sex, Hair, and Freq. I want to hide "Freq" from the DragDrop list and "Eye","Hair","Sex" from aggregator attribute list. I'm looking for a working example. I'll appreciate your help. Thank you.
library(rpivotTable)
data(HairEyeColor)
rpivotTable(data = HairEyeColor, rows = "Hair",cols="Eye", vals = "Freq",
aggregatorName = "Sum", rendererName = "Table",
hiddenFromDragDrop="Freq",hiddenFromAggregators=c("Eye","Hair","Sex"), width="100%", height="400px")

Related

phyloseq: Discrepancies in otu counts before and after using tax_glom

Maybe I missed something in how tax_glom works but as I did not find any info here nor elsewhere on the web, maybe someone here can help.
I do not provide data but I can on request. Here is the code highlighting the issue I have
colSums(CYANO%>%otu_table())
CYANO_gen <- CYANO %>%
tax_glom(taxrank = "Genus")
colSums(CYANO_gen%>%otu_table())
CYANO is a phyloseq object that I wanted to agglomerate at the Genus rank but I noticed that a sample (named 100) was not present in a dataviz. This led me to check where the issue happened. 7 samples out of 54 present discrepancies as shown in the last line of the attached image, weird isn't it?
Results given by the code above and 2 additional lines which highlight the importance of discrepancies and the fact that this is not always the case
Thank, Guillaume
The NArm term in the tax_glom function is, by default, set as TRUE. To avoid losing observations with NA cells you need to set the NArm = FALSE.
Cheers

R Stargazer data frame table sum of relative share

First of all I am quite new to all of this, please excuse any inaccuracies. I am struggling to find a way to include a line that adds up the percentage share of each category in a stargazer html table. The line is supposed to be located below the bottom of the table, so to say in the notes section. Unfortunately, since I set summary to FALSE, there seems to be no way to access/change the notes section as it appears to solely be available in regression table outputs of stargazer, not for tables that solely display the contents of the dataframe. I tried notes.label to name the notes section to "sum" in order to manually enter "100" below the line of the column "Relative share". That did not work.
If I add a row with the summed up relative share to the data frame, stargazer will include it into the regular table and not separately reveal it below the table line (possibly I just have not figured out how to do so).
Distribution table with relative share:
H1_Industry_dist <- H1_Industry_dist %>%
mutate("Relative share" = (Count/sum(Count)*100))
stargazer(H1_Industry_dist, type = "html",
summary = FALSE, rownames = FALSE,
out = "Table 2 - H1 Industry Distribution.html")
I hope to find some help here. Many thanks!

Print newly created value for one specific string in the data frame (president's name)

I'm trying to pull the standardized height for a specific president by name (Ronald Reagan).
I'm currently having issues doing this because I unfortunately can't find the syntax for pulling a value for one president's name (I know this is likely very simple but I for some reason cant find it anywhere)
Also if I call the dataset I only see the original columns, not the new one I created called "stand_height".
Any help would be hugely appreciated!
Try this:
heights <- heights %>% mutate(stand_height = scale(mean(parse_number(height)))))
To pull the height for a specific president:
with(heights, height[Name == "Ronald Reaganz"])

How do I recode character variable?

I am a beginner in R so this is a very basic question. I do not find a specific answer to it so I would like to ask you here.
I'm confronted with the following challenge; I'd like to recode a character variable and create one out of this.
Specifically, the variable in my data frame(data) is called "driver", with the categories "market", "legislation", "technology", and "mixed".
Now I would simply like to create a new variable, "driverrec", with the values "market" and "others". In "others" the three remaining variables shall be summarized.
I tried it with this page: http://rprogramming.net/recode-data-in-r/
Basically, I tried the following code to adopt on mine, but it won't work for more than one category.
#Create a new field called NewGrade
SchoolData$NewGrade <- recode(SchoolData$Grade,"5='Elementary'")
# my attempt
driverrec <- data$driver
recode(driverrec, "'Mixed'='others'") This is working.
But the whole recode is not working:
recode(driverrec, "'Mixed'='others'", "'Technology'='others'",
"'Legislation'='others'", "'Market'='market'" )
I am looking forward to and thank you for your help.
I found a solution not using the replace command:
data$driverrec[dataframe$driver=='Market'] <- 'market'
data$driverrec[is.na(dataframe$driver)==TRUE] <- 'others'
This worked fine; in order, someone is looking for a solution ;)!

Groupping in Gauge Panel, possible?

i am currently trying to Group Values given to Pointers in a Gauge Panel.
The Scenario Looks like this:
Now i have a dataset with the following Fields:
KPIName
KPIValue
I have all the Values in KPIValue, and I Group them with the field KPIName since i currently have 4 different KPIValues.
What i want to accomplish now is to put in 4 different Pointers in my GaugePanel and let them Show each KPIValue, meaning I want them to be Grouped, or at least let each pointer individually be Filtered to the KPIName it is supposed to Show.
I am working with GaugePanels for the first time, but it doesn't really seem possible to me for now,
Is there a solution ?
Is there a way ?
Or at least a Workaround ? (like adding custom fields to the Data Set, which are filtered by KPIName, or something similiar ?)
Thanks a lot for your Help!
Set the expression for the pointers to
=Sum(IIf(Fields!KPI.Value = "KPI1", Fields!Value.Value, 0))
=Sum(IIf(Fields!KPI.Value = "KPI2", Fields!Value.Value, 0))
=Sum(IIf(Fields!KPI.Value = "KPI3", Fields!Value.Value, 0))
...

Resources