Using stargazer, I want to omit some of the control variables from the report. I want to label some of them, while not labeling the rest (or group them all under "Other control variables").
omit and omit.labels should be of the same length, so just ignoring some of the variables won't do. Is there any way to do that?
Found a way to do it. Use omit and omit.label for the omitted variables you want to state (FE etc.), use keep to state the only variable you wish to keep in the report. All other variable won't be mentioned in the exported report.
Related
I have a fairly large model with components grouped hierarchically about 3 levels deep. It would be useful for me to be able recursively iterate through my components and list inputs and outputs, as well as all the option values, and format all that data to my liking so I can make a nice report with it.
calling list_inputs() and list_outputs() on a given group sort of does what I want, in that it prints off the inputs and outputs, but if you call it on a large group you can't get the inputs and outputs of single component next to each other on the page.
I could probably reverse engineer how list_inputs() is working itself but was wondering if there is an easy way to do it.
As you noted, list_inputs and list_outputs are both methods defined on the System class. Thought these methods do group their print-outs by component, the challenge is that you get all the inputs first, then all the outputs. You can't easily see the inputs and outputs for a single component together.
Both of these methods can have their printing shut off by setting out_stream=None, and each of them returns a list of variable data that you can manually parse through. That may not give you the format you want though.
If you want to manually recurse over the hierarchy and write your own custom report method, then you should look at the following methods on System (i.e. components and groups):
get_io_metadata
system_iter
Those, combined with the data returned from list_inputs and list_outputs should give you what you need.
How can I make a dropdown menu that allows me to reference different columns and change the column reference of a data function in Spotfire's TERR/R?
I am creating 2D cross plots of data, using TERR data function to overlay the average profile line of the data on top of the individual profile lines. I am trying to add the ability to toggle between different normalizations. I want to be able to see data and the average of data over time normalization, pressure normalization, etc, etc. Without having to go into the data function and change the column name reference every time I want to change.
I know how to make the dropdown in the text area and reference each visualization, so those change automatically, but I still can't figure out how to make the TERR data input column to change dynamically with the dropdown menu selection so that the average line also changes.
There must be some way to simply say I want whatever is in the document property to be the "group by" column in the TERR data function to perform aggregations against. (I'm using the R package dplyr to do various simple statistical aggregations on data)
Thanks for the help!
In Azure Machine Learning studio I need to convert a column of data that has three categorical values 'yes', 'no' and 'maybe', and wish to combine the 'no' and 'maybe' values as just 'no'.
I can do this easily using SQL, R, or Python but for these purposes I need to show if it is possible to do this without using these languages. I can't seem to find a way to do this.
Does anyone have any ideas? I'm fine if the answer is no but I don't want to say it's not possible if it is.
It can be done! :)
You would just use the "Group Categorical Values" module. Choose the column that has the data you want to group, and you can set the values like the following:
What's going on here is that the default, which will get used if the other levels aren't caught, is set to "yes". Then when any values are "no", or "maybe", it gets grouped into a category of "no".
However, this will error unless you make that column a categorical type, so you would need to use the "Edit Metadata" module to do that.
The example I used is published to the gallery, if you need to reference it.
If you need more info, just let me know.
I cannot figure out how to assign the column headers from my imported xlsx sheet as variables. I have several column headers, for example DAY_CHNG and INPUT_CHG. So far, I can only run gls(DAY_CHG~INPUT_CHG) by first assigning the values as variables by X<-mydata$DAY_CHG. Is there some command to get these variables assigned automatically when I import?
I had horrible problems getting the program up and running, by the way, due to firewalls at the firm for which I'm working, wondering if that's causing some of the issue.
Any help is much appreciated. Thanks!
attach(mydata) will allow you to directly use the variable names. However, attach may cause problems, especially with more complex data/analyses (see Do you use attach() or call variables by name or slicing? for a discussion)
An alternative would be to use with, such as with(mydata, gls(DAY_CHG~INPUT_CHG)
I would suggest using the $ in order to use the headers as variables and still be able to use other data sets. All that needs to be done is assign the data to an object such as your mydata and by putting a $ immediately following, you will be able to refer to your headers as variables.
As an example for your case, instead of creating a new object x, simply take what you assigned x to and put it directly into your command.
gls(mydata$DAY_CHG ~ mydata$INPUT_CHG)
when it becomes more complicated with more data sets this will allow you to have access to all of them still while not limiting yourself to the data set you attach()
I am trying to figure out how to take a column name supplied by a user in response to a prompt in R and use that in the function factor. The idea is to create a script using ggplot2 that will allow users to easily select which variable from a table they would like coded by color and which by shape.
The line of code requesting user input would be:
> Color_Factor<-readline("What is the Column Heading of the Variable you would like separated by Color? ")
What is the Column Heading of the Variable you would like separated by Color? Reach
My problem is that I can't figure out how to use this input to call a particular column for graphing purposes. The code below creates a graph with one color and the single variable "Reach".
> qplot(d13C, d15N, data=InputFile, **col=factor(Color_Factor)**, shape=factor(Functional_Group))
All my attempts at calling a function as the initial argument in factor() have met with complete failure. I'm specifically interested in this for graphing purposes but am also wondering if there is a way to use the value of a variable rather than the variable name to specify a column in this type of function in general. I'm totally new to R so maybe there's an obvious solution but I haven't been able to find an answer online so far.
Thanks
This isn't very elegant but the non-standard evaluation of arguments to ggplot2 has always confused the heck out of me:
> Color_Factor<-readline("What is the Column Heading of the Variable you would like separated by Color? ")
What is the Column Heading of the Variable you would like separated by Color? mpg
qplot( x=mtcars[, Color_Factor], wt, data=mtcars)
I've tried (and failed with) a variety of language level incantations using as.name, substitute, and eval to supply the x-argument with a language element that satisfied it. The strategy above uses the capacity of [.data.frame to evaluate the Color_Factor and match it to a column name in mtcars. This alternative also succeeds (since it is pretty much duplicating what the first one is doing:
qplot( x=eval(as.name(Color_Factor), mtcars), wt, data=mtcars)