similar to: use expression() in a loop

Displaying 20 results from an estimated 10000 matches similar to: "use expression() in a loop"

2009 Apr 14
1
mean fold change issues and p values
I am new to R and have two scripts written slightly different but should to relatively the same thing but my lack of experience with the program I can not figure out the what I need to do to correct it. The first script gives me a consistent mean fold change values with every run but can generate negative p values for some. For the second version of the script, the fold changes seem to be very
2003 Jul 21
4
generate a series of fucntion
Hi there, I want to generate a large amount of functions, say f=function(x,t) exp(-t[1]-t[2]*g_1(x)-t[3]*g_2(1+x)) where g_1(x) and g_2(x) are from a long list of moments, such as x, x^2, log(x), log(1+x) .. and so on. Any suggestions on how to do this efficiently? thanks a lot. x.w
2009 Apr 08
0
Comparing Proportions Among Groups
Hi everyone, I am trying to compare proportions among groups using the logistic regression approach as follows: 1) Fit the model log(p_i/(1-p_i)) = M + G_i, where p_i is the probability of success in group i and G_i is the effect of group i, i=1,..,I. 2) Test the hypotheses: Ho: G_1 = G_2 = ... = G_I (the probability of success is the same for all groups) versus Ha: at least two
2008 Jan 25
2
Using bquote: question
Hi all Observe: x <- c(1,2) y <- c(1,-1) phi <- 1 p <- 2 par( mfrow=c(1,2)) plot(x , y, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) ) plot(y ~ x, main=bquote( paste( p==.(p)," and ",phi==.(phi)) ) ) par( mfrow=c(1,2)) On my system (details below), the first plot is correct (in my understanding), and produces a title reading "p=2 and phi=1"
2011 Jan 21
2
ordering a vector
Hi, is there a R function that order a matrix according to some criteria based on the rows(or cols) of that matrix? For example, let's say that my matrix S is composed by n rows S_1, S_2,.., S_n and that I compute some real value g_i=g(S_i) for each row. Then I want to order this set of g_i (from smaller to bigger) and order the correspondent row to the new position. Is it possible (apart
2010 Oct 08
3
Efficiency Question - Nested lapply or nested for loop
My data looks like this: > data name G_hat_0_0 G_hat_1_0 G_hat_2_0 G_0 G_hat_0_1 G_hat_1_1 G_hat_2_1 G_1 1 rs0 0.488000 0.448625 0.063375 1 0.480875 0.454500 0.064625 1 2 rs1 0.002375 0.955375 0.042250 1 0.000000 0.062875 0.937125 2 3 rs2 0.050375 0.835875 0.113750 1 0.877250 0.115875 0.006875 0 4 rs3 0.000000 0.074750 0.925250 2 0.897750 0.102000
2006 Dec 20
3
How to use strings from a data.frame as the argument of an expression() for plot
Greetings, I would like to use a data.frame with strings to feed the expression() in the title of a plot. The way I did this is: molecules <-data.frame(name=c("o3","no","no2"),expression=c("quote(O[3])","quote(NO)","quote(NO[2])")) for (mol in c(5,7,9)) { plot(x, y, type="b",
2009 Sep 02
2
combining grid.text, expression and variables
Dear R-users, I am trying to use the grid.text and expression functions to display several character strings and plotmath text on a viewport. Some strings can include a variable portion (PI.limits in the following example), which I thought could be implemented by combining the bquote and the expression functions. Unfortunately, my expressions do not seem to be evaluated. I would greatly
2011 Oct 06
2
Titles changing when a plot is redrawn
I ran into a problem with titles on graphs. I wanted a graph with multiple subplots, with each having a title that involved both a Greek letter and an identifier for each graph. Below is a simplified version of code to do this. The graph appears fine, with the first graph having "i=1" in the title, and the second graph having "i=2" in the title. However, when I resize the
2006 Mar 06
3
how to make plotmath expression work together with paste
Recent questions about using plotmath have renewed my interest in this question I want to have expressions take values of variables from the environment. I am able to use expressions, and I am able to use paste to put text and values of variables into plots. But the two things just won't work together. Here is some example code that shows what I mean. plot(NA,xlim=c(0,100),ylim=c(0,100))
2012 Jun 22
2
Boxplot with Log10 and base-exponent axis
Dear all, I would like to (i) produce boxplot graphs with axis in logarithm in base 10 and (ii) showing the values on the axis in 10^exponent format rather than 10E+exponent. To illustrate with an example, I have some widely spread data that I chart plot using boxplot() [figure on the left]; the log="y" option of boxplot() I obtained the natural logarithm conversion of the data and
2013 Apr 01
3
expression
Hi all, I´m using titt<- expression(paste("R con ventanas de 200 ", italic(datos))) And it works properly on a plot(...,main=titt,..) But if I want to add an improvement to avoid typing n on the plot so that n<-200 titt<- expression(paste("R con ventanas de ",n, italic(datos))) It doesn´t recognize that n is a "variable" and adds "n" letter
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9. I've been experimenting with plotmath. I wish it were easier to combine expressions in plotmath with values from the R program itself. There are two parameters in the following example, the mean "mymean" and standard deviation "mystd". I am able to use bquote to write elements into the graph title like mu = mymean and R will
2007 Jun 08
2
legend + expression
Dear all; A simple? question. I'm having a problem with a math expression in the legend of a plot and I haven't found the way to get this to work, so any help will be appreciate. Basically I want to include in the plot is the R-squared and its numerical value, so I tried this: R2c<-0.82879 # R-squared of calibration model plot(1:10,1:10) legend("topleft",
2010 Oct 12
1
Displaying a variable as an expression into a plot label, but the variable has brackets
I'm attempting to insert variables as expressions into labels for my plots, but I'm running into the issue that characters in my labels aren't allowed in expressions, notably '[' and ']'. An input string of "[^3H]5-CT" needs to be displayed as [3H]5-CT with the 3 as superscript. But brackets aren't particularly liked in expressions. I know I can do
2011 Nov 24
1
Changing graphic titles when using bquote and resizing the graphic window
Dear list, I found a strange behavior of the graphic display when using bquote to set a title to a plot. The problem arise when you manually resize the graphic window using the mouse. It happens on both quartz and x11 devices. Here's a reproducible example: par(mfrow = c(1,3)) for (i in 1:3){ title <- as.expression(bquote(gamma[.(i)])) plot(1:10, main = title) } Once you ran the
2010 Jan 25
3
Paste expression in graph title
This was my initial attempt at creating a title on a graph of the R squared value: x<-rnorm(10) y<-rnorm(10) plot(x,y, main=paste(expression(R^2)," = ",round(summary(lm(y~ x))$r.squared, digits=3), sep="")) I've read various other posts that say expression needs to be taken outside the paste, but I can't seem to get it work as the following fails plot(x,y,
2007 Nov 15
2
Using plotmath expressions in lattice key text
Folks: delta <- 1:5 I would like to put 5 separate lines of text of the form "10 %+-% delta[i]" into a lattice key legend, where ""%+-%" is the plotmath plus/minus symbol and delta[i] is the ith value of delta. The construct: lapply(delta,function(d)bquote(10%+-%.(d))) appears to produce a list of expressions of the correct form, and, indeed, if I assign the above
2010 Aug 27
3
How to plot an expression-label with variable text
Disclaimer: I have read plotmath, but maybe it's too late today: How do I get the two labels to be the same: plot.new() lab =expression(paste("Estimated ", t[50]," from tgv")) text(0.5,0.5,lab) # Should look the same as above. I could not get the substitute right: what = "tgv" lab =expression(paste("Estimated ", t[50]," from ",what))
2011 Feb 20
3
Partial italic in graph titles when looping
Dear all, I have a rather complicated problem. I am trying to loop through making graphs, so that the graph-making process is fully automated. For each graph, I'd like to make sure the corresponding title is formatted properly. The titles will be a combination of a gene name and numerical position within the gene. The gene name should be italic-bold, whereas the gene position should be