Displaying 20 results from an estimated 4000 matches similar to: "Replace a for loop with a function"
2009 Aug 12
2
Superscripts in axis label
Hi All,
I am trying to lable the y-axis on my scatterplot with the following:
"Soil moisture content (m3m-3)"
I am using the following coding for plotting the graph:
plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab="Soil moisture content (m3m-3)", bty="l", font.main="2", pch=16, las=1, cex.lab="1.13")
I have
2011 Sep 19
1
Possible or not possible: serif axis labels with plotmath [but everything else sans serif]?
Dear expeRts,
I it possible to have serif labels in the following plot?
x <- 1:10
y <- x
plot(x, y, type="b", xlab=expression(x[1]), ylab=expression(x[2]))
I know that one can use pdf(, family="serif"), but then also the axis tick marks
are printed in serif font. Apart from the fact that it may not look nice, I'm
just interested if one can have serif axis labels
2009 Jul 31
1
colored 3D pillar plots
hi,
I'd like to do graphs like shown on the right panel on the following link:
http://www.clinchem.org/cgi/content/full/53/8/1544/F1
(if link doesn't work see attached file)
Any help and ideas highly appreciated, thanks in advance.
Thomas von K?nel
Human Genetics
Uni Berne
2009 Oct 21
1
slope calculation
Dear all
I am new R user, and trying to learn more.
I am doing linear regression analysis in R with my data. I am trying to find the way to calculate the slope value (coefficient of x) to degree of slope. Please give me idea on this.
Thanking you in anticipation
Warm regardMS
_________________________________________________________________
[[alternative HTML version
2011 Oct 10
3
How to test if two C statistics are significantly different?
Hey all,
In order to test if a marker is a risk factor, I built two models (using cox
proportional hazard model). One model included this marker, and the other is
not.
Then, I use R package risksetROC to test how much predictive value did the
marker add to this model. I get two C statistics by analyzing the linear
predictors of the two models into this package.
The qustion is How to test if two
2012 Aug 02
6
Polygon shaded area
Hi all,
I have two vectors (columns) called "efinal" and "efinal 2".
I want to plot them on the same plot and "draw" a shaded area beween the
two lines using function polygon
I have tried all but I don ?t understand the polygon area, can you help me
with examples?
plot(efinal,type="l",ylim=range(min(efinal2),
2010 Mar 31
2
Printing the function t.test() in R
Dear R Users,
I have a question, how does one print an r function like t.test in R (to get
the whole function and not just a summary of the environment)? For example
if I type the following:
> t.test
function (x, ...)
UseMethod("t.test")
<environment: namespace:stats>
> print(t.test)
function (x, ...)
UseMethod("t.test")
<environment: namespace:stats>
I
2008 Aug 15
6
Saving environment object
Hi,
When I create an environment object with new.env() and populate it with
values then how can I save it into an .RData file properly, so it can be
loaded later on in a new session?
Saving an environment object with save() or save.image() results in an error
message when loading again:
Error: protect(): protection stack overflow
Regards,
benjamin
======================================
2009 Sep 30
3
programming to calculate variance
Dear R-user
Suppose I have the following data
y=c(2,1,5,8,11,3,1,7,50,21,33,7,60)
x=data.frame(y)
for(i in 4:nrow(x)) x[i,] =var(x[i-3:i-1,])
I'm trying to get a new variable with the variance of the 3 previous values
(just an example) and with NA in the three first positions. I know that my
for() is wrong
but I'm not able to find my error.
Any idea?
Thanks,
Marlene.
2011 Sep 16
2
Numeric Characters in String
Dear all,
I have a vector, which looks about like this:
str <- c("14.XYZ", "15.ABCDE", "16.dkieowo", "120.EIDKAI")
I need to extract the numerical characters out of the string, so I receive
in the end a normal vector containing:
vec <- c(14, 15, 16, 120)
I need a generic solution for this. My actual vector contains about 403
2012 Feb 21
2
Using substitute in nested function calls
Dear List members,
I really, like the feature that one can call R functions with
mathematical expressions, e.g.
curve(x^2, 0, 1)
I wonder, how I can construct in a simple way a function like
mycurve = function (expr) {...}
such that that a call
mycurve(x^2)
has the same effect as the call
curve(x^2, -100,100)
Below is some code that works, but it seems much to complicated: it
first
2011 Sep 28
3
Plotting Lines Through multiple groups
Hi I have data in the following format
Cort Day Animal
23 0 1
27 3 1
24 0 2
27 1 2
34 2 2
30 3 2
24 4 2
20 0 3
24 1 3
28 2 3
34 4 3
etc.
It is measured across time(day) however no every individual is measured the
same number of times. All I want to do is plot the Raw data and then run a
line connecting the
2011 Sep 29
2
String manipulation with regexpr, got to be a better way
Help-Rs,
I'm doing some string manipulation in a file where I converted a string date in mm/dd/yyyy format and returned the date yyyy.
I've used regexpr (hat tip to Gabor G for a very nice earlier post on this function) in steps (I've un-nested the code and provided it and an example of what I did below. My question is: is there a more efficient way to do this. Specifically is
2011 Sep 08
6
Searching the console
Is there any way to search the console during an interactive session? I've
looked and looked, and can not find one. In some add-on package, maybe?
Sorry to be so basic, but help would be greatly appreciated.
andrewH
--
View this message in context: http://r.789695.n4.nabble.com/Searching-the-console-tp3797884p3797884.html
Sent from the R help mailing list archive at Nabble.com.
2011 Sep 06
2
subsetting tables
Hi guys,
one of the questions where you need a real human instead of a search engine,
so it would be great if you could help.
I have a matrix of z-scores which I would like to filter, sometimes
columnwise, sometimes rowwise. Data looks like this:
Allstar hsa.let.7a hsa.let.7a.1 hsa.let.7a.2
2 0.87 0.79 -0.57 1.07
3 0.67 -1.14 -0.78 -0.95
4
2013 Apr 23
1
Frequency Block Chart
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130423/641d9950/attachment.pl>
2012 Apr 02
1
\Sexpr{}
Did anyone know whether the problem " it doesn't evaluate \Sexpr{} in Sweave" has been fixed? I checked r help page and realized it was asked a couple of years ago. But I didn't find solutions.
Thanks for your help in advance!
Hua
[[alternative HTML version deleted]]
2008 Apr 05
2
pearson's correlation
Hello,
I used the function cor to calculate the pearson correlation coefficient between variables. However, the resulting values do not correspond to the outcome of my excel-calculations, for which I used the formula Cor(x,y)=Cov(x,y)/(SD(x)*SD(y))
So my question is: How does the function "cor" compute the pearson correlation coefficient?
Thank you in advance,
Ake Nauta
2013 Apr 29
3
How to "call" an object given a string?
Hello,
This is very basic and very frustrating.
Suppose this:
>A=5
>B=5
>C=10
> ls()
"A"
"B"
"C"
I would like this
>xpto()
5
5
10
How can I do xpto()?
Thanks
Rui
[[alternative HTML version deleted]]
2011 Oct 24
2
splitting a string into words preserving blanks (using regex)
I would like to split a string into words at its blanks but also to preserve all blanks.
Example:
c(" some words to split ")
should become
c(" ", "some", " ", " words", " ", "to" , " ", "split", " ")
I was not able to achieve this via strsplit() .
But I am not familiar with regular