Displaying 20 results from an estimated 10000 matches similar to: "from function to its name?"
2007 Jan 14
4
Controlling size of boxplot when it is added in a plot
Greetings,
I am trying to add a boxplot to the bottom of a histogram, right
between the histogram bars and the x axis. Here is the code I am
using at the moment (the par line is probably not relevant for our
discussion):
hs <- hist(x, breaks = 20, plot = F)
par(mar = c(3,3,2,1))
hist(x, breaks = 20, main = NULL, ylim = c(-2, max(hs$counts)))
boxplot(x, horizontal = T, axes = T, add =
2007 Nov 07
3
Indexing, and using an empty string as a name
Hello all,
I ran into the following, to me unexpected, behavior. I have (for
reasons that don't necessarily pertain to the question at hand, hence
I won't go into them) the need/desire to use an empty string for the
name of a vector entry. Perhaps I did not read ?"[" very carefully,
but it seems to me that he following lines should return "1" at the end:
2007 Feb 04
4
Reading expressions from character vectors
Greetings,
I have a problem that I am sure is very straightforward, but I just
can't wrap my head around it. I've read the help pages on text,
plotmath, expression, substitute, but somehow I can't find the answer
to this simple question.
Basically consider the following example:
plot( NULL, xlim = c(0,2), ylim = c(0,2) )
expressions <- expression( -infinity, infinity )
2005 Aug 29
2
reexpand a matrix after subsetting
Hi,
suppose I have a matrix (or dataframe)
as a result from subsetting.
mat <- matrix(1:20,ncol=2)
mat[c(3,6,9),] <- NA
cc <- complete.cases(mat)
sub <- mat[cc,,drop=FALSE]
sub <- sub * 2
#some caluculations with sub.
now I would like to expand sub somehow
so row 3,6, and 9 would be filled with
NAs but the rest should be in place again.
Is there a simple function for this?
2006 Nov 08
6
Making a case for using R in Academia
Hello, new to the list, first message.
This question perhaps might be more appropriate to R-sig-teaching,
and I'd be happy to take it there if this is not the right place for it.
I am teaching applied statistics at a small liberal arts college with
limited resources, and we are currently using SPSS for our courses.
Mainly the reason for this, as I understand it, is that this is what
2006 Dec 07
1
templating library for R
Hi,
does anybody know of a templating library for R,
like velocity or freemarker?
It doesn't have to be very fancy just a bit
better than sub in replacing tags in a text (not
necessarily html) file.
thank you very much for your answer.
Ido
2007 Jul 05
1
ggplot2 customizing
Dear all,
I know that ggplot2 documentation is coming along,
but at the moment I can't find how to do the following:
a) change the title of the legend
b) get rid of the closing line at the bottom of the
density line.
I also observed that the density lines (after limiting the
x-scale) extend a little bit into the surrounding of the plot,
which can be seen very strong when plotted as pdf.
2007 Aug 09
1
depreciation of $ for atomic vectors
Dear All,
I would like to know why $ was deprecated for atomic vectors and
what I can use instead.
I got used to the following idiom for working with
data frames:
df <- data.frame(start=1:5,end=10:6)
apply(df,1,function(row){ return(row$start + row$end) })
I have a data.frame with named columns and
use each row to do something. I would like the
named index ($) because the column position
in
2007 Mar 01
2
R code for "Statistical Models in S" ?
I just acquired a copy of "Statistical Models in S", I guess most
commonly known as the "white book", and realized to my dismay that
most of the code is not directly executable in R, and I was wondering
if there was a source discussing the things that are different and
what the new ways of calling things are.
For instance, the first obstacle was the solder.balance data
2007 Dec 17
3
Cannot grasp how to apply "by" here...
I have a data frame named "database" with panel data, a little piece
of which looks like this:
Symbol Name Trial Factor1 Factor2
External
1 548140 A 1 -3.87
-0.32 0.01
2 547400 B 1 12.11
-0.68 0.40
3 547173 C 1
2008 Jan 22
1
R: determinants and inverses
hello all
sorry for the following "none" R related question.
does anyone know of a reference to calculate the following identity:
|I + ABC|
where I is an identity matrix and A, B,C may not have to be square matrices?
you help will be greatly appreciated.
H. V. Henderson; S. R. Searle
SIAM Review, Vol. 23, No. 1. (Jan., 1981), pp. 53-60.
provides a result to
2008 Jun 12
2
numbers as part of long character
Hi,
I'm looking for some way to pick up the numbers which are contained and buried in a long character.
For example,
outtree.new="(((B:1204.25,E:1204.25):7581.11,F:8785.36):8353.85,C:17139.21);"
num.char =
2008 Mar 05
4
vertex labels in igraph from adjacency matrix
I am getting some unexpected results from some functions of igraph and
it is possible that I am misinterpreting the vertex numbers. Eg., the
max betweenness measure seems to be from a vertex that is not connected
to a single other vertex. Below if my code snippet:
require(igraph)
my.graph <- graph.adjacency(adjmatrix = my.adj.matrix, mode=c("undirected"))
most.between.vert <-
2007 Feb 22
1
Cross-tabulations next to each other
I have the following relatively simple problem. Say we have three
factors, and we want to create a cross-tabulation against each of the
other two:
x <- factor(rbinom(5, 1, 1/2))
y <- factor(rbinom(5, 1, 1/2))
z <- factor(rbinom(5, 1, 1/2))
table(x,y)
table(x,z)
This looks like:
y
x 0 1
0 2 0
1 1 2
z
x 0 1
0 1 1
1 2 1
I would like to get (surely this will
2008 Jun 07
2
Using lm with a matrix?
I'm trying to do a linear regression between the columns of matrices. In
example below I want to regress column 1 of matrix xdat with column1 of ydat
and do a separate regression between the column 2s of each matrix. But the
output I get seems to give correct slopes but incorrect intercepts and
another set of slopes with value NA. How do I do this correctly? I'm after
the slope and
2008 Feb 29
8
Running LaTeX dvi previewer on MacOS X
Several people have given great advice on how to successfully use X11 on
Mac to so we can use the dvi previewer to view latex() output from
Hmisc. Now after a version upgrade of X11 and X11sdk we are getting
lots of crashes. I noticed a Mac dvi previewer with an executable
stored as /Applications/TeX/TeXShop.app/Contents/MacOS/TeXShop
Can we bypass X11 problems and point Hmisc to this
2007 Dec 22
2
Understanding eval
After many hours of debugging code, I came to the conclusion that I
have a fundamental misunderstanding regarding eval, and hope that
someone here can explain to me, why the following code acts as it does:
foo <- function(expr) {
eval(substitute(expr), envir=list(a=5), enclos=parent.frame())
}
bar <- function(er) {
foo(er)
}
> foo(a)
[1] 5
> bar(a)
Error in eval(expr,
2008 Nov 03
1
dev2bitmap: extra missing
Hi,
I don't know if I am the first one to report the problem:
in 2.8.0 dev2bitmap gained aa support, but "extra" is null
if neither taa nor naa is specified.
> dev2bitmap("plot.pdf",type="pdfwrite")
Error in paste(shQuote(gsexe), " -dNOPAUSE -dBATCH -q -sDEVICE=", type, :
object "extra" not found
>
2005 Dec 13
1
correct C function usage
Hello,
I am not sure if I am interfacing with C correctly and _safely_
or if there is a better way esp. with regards to terminating
the "returned" array.
I am trying to fill an int array with values whose actual size
is determined in the C function and is always maximally as large
as length(values).
I also don't understand the purpose of $ab in the example:
conv <- function(a,
2008 Mar 10
3
Weighting data when running regressions
Dear R-Help,
I'm new to R and struggling with weighting data when I run regression. I've
tried to use search to solve my problem but haven't found anything helpful
so far.
I (successfully) import data from SPSS (15) and try to run a linear
regression on a subset of my data file where WEIGHT is the name of my
weighting variable (numeric), e.g.:
library(foreign)