Hello List,
I have been using Sweave for my homework this last quarter and have been
very impressed at how much time and effort it saves me. I, however, have
run up against a problem which I have not been able to solve using any of
the Sweave/LaTeX tricks I know. I work through my homework one p
List,
Would someone be so kind as to point me to a function that will calculate
simultaneous confidence intervals of regression coefficients based upon
their distribution as (under the assumption of normal errors, with
\mathbf{X} as the design matrix):
$\hat{\mathbf{\beta}} \sim N(\mathbf{\beta},
Severin Hacker wrote:
>
> Hi,
>
> I've been trying to make use of the dendrogram class to plot a tree.
> However, my attempts have failed so far because I'm not sure how to build
> up the nested list. (where do I have to store the nodes?). The tree I want
> to be drawn is like this: in the form
In body(fun, envir = environment(fun)) <- value, value can be an
expression or a list of R expressions.
But it seems that value must be length-1 list (if it is a list), is it right?
> f2 <- function(x) {}
> body(f2) <- list(quote(x<- x^5),quote(return(y)))
Error in as.function.default(c(formals(
G'day Kyle,
On Sat, 29 Nov 2008 11:11:37 -0800
"Kyle Matoba" <[EMAIL PROTECTED]> wrote:
> I have been using Sweave for my homework this last quarter [...] but
> would like to know if there is a clean way to do so using LaTeX or
> Sweave so that the latest version of the code is included in my
> h
Dear List,
my problem should be easy to fix, but I couldn't find a solution by
myself...
In my survey, there is a question with 14 possible answers. None of
the respondents choose the 13th answer, so when I table() the results,
R says:
1 2 3 4 5 6 7
G'day Simone,
On Sun, 30 Nov 2008 11:05:13 +0100
Simone Gabbriellini <[EMAIL PROTECTED]> wrote:
> my problem should be easy to fix, but I couldn't find a solution by
> myself...
>
> In my survey, there is a question with 14 possible answers. None of
> the respondents choose the 13th answer,
On 11/30/2008 5:05 AM, Simone Gabbriellini wrote:
> Dear List,
>
> my problem should be easy to fix, but I couldn't find a solution by
> myself...
>
> In my survey, there is a question with 14 possible answers. None of the
> respondents choose the 13th answer, so when I table() the results, R say
Dear Simone,
Try this:
x=c(1,1,2,3,4,3,2,2,2,1,2,3,4,4,3)
table(factor(x,levels=1:5))
1 2 3 4 5
3 5 4 3 0
HTH,
Jorge
On Sun, Nov 30, 2008 at 5:05 AM, Simone Gabbriellini <
[EMAIL PROTECTED]> wrote:
> Dear List,
>
> my problem should be easy to fix, but I couldn't find a solution by
> myself.
you have to use a factor, e.g.,
x <- sample((1:14)[-13], 100, TRUE)
f <- factor(x, levels = 1:14)
table(f)
I hope it helps.
Best,
Dimitris
Simone Gabbriellini wrote:
Dear List,
my problem should be easy to fix, but I couldn't find a solution by
myself...
In my survey, there is a questio
Sumitrajit Dhar wrote:
Hi folks,
I am trying to figure out how run a repeated measures ANOVA on the
following data set.
subject trial frequency dplvl
1 FSI052A A 1NA
2 FSI052B B 1NA
3 FSI053A A 1NA
..
Both "frequency" and "trial" are
Dear List,
is it possible to plot vertical labels under vertical bars? for
vertical labels I mean to rotate 90 degrees horizontal labels
I suppose yes, because if excel can do this, R should do it twice
better...
thank you,
Simone
__
R-help@r-p
Berwin A Turlach wrote:
G'day Simone,
On Sun, 30 Nov 2008 11:05:13 +0100
Simone Gabbriellini <[EMAIL PROTECTED]> wrote:
my problem should be easy to fix, but I couldn't find a solution by
myself...
In my survey, there is a question with 14 possible answers. None of
the respondents choose
Dear ALL,
thank you for this sunday morning help! It works great!
all the best,
Simone
Il giorno 30/nov/08, alle ore 11:22, Jorge Ivan Velez ha scritto:
>
> Dear Simone,
>
> Try this:
>
> x=c(1,1,2,3,4,3,2,2,2,1,2,3,4,4,3)
> table(factor(x,levels=1:5))
> 1 2 3 4 5
> 3 5 4 3 0
>
> HTH,
>
> Jorge
Hi Simone,
Yes. Take a look at the las argument in ?par. Here is an example with
barplot:
barplot(table(factor(x,levels=1:5)),names.arg=c('First','Second','Third','Forth','Fifth'),las=2)
HTH,
Jorge
On Sun, Nov 30, 2008 at 5:33 AM, Simone Gabbriellini <
[EMAIL PROTECTED]> wrote:
> Dear List,
Hi all,
Is there anyone who ever used igraph to calculate the index of
"centralization" ?
I tried my best but can't find it in igraph.
The brief introduction to "centralization" can be found here , and I think
it's an important index for measuring the centrality on the aggregated
level.(http://fa
Its also possible to build up a string:
> f <- function(x) {}
> body(f) <- parse(text = "{ x <- x^5; return(x) }")
> f
function (x)
{
x <- x^5
return(x)
}
On Sun, Nov 30, 2008 at 4:15 AM, ronggui <[EMAIL PROTECTED]> wrote:
> In body(fun, envir = environment(fun)) <- value, value can be
You could achieve this from the LaTeX side of things using the
attachfile package:
http://www.ctan.org/tex-archive/macros/latex/contrib/attachfile/
I use this package to attach data files and R code to pdf's generated
with Sweave + pdflatex, so that the entire analysis can be reproduced
from a sin
I think I found a solution. I do not like to use global variable by fear of
unpredictable side-effects but, I think that in this case I don't have to much
chance.
Here is a mock function that pushes the content of a variable evaluated within
a function to the nodes on the cluster, do some compu
Weijia, centralization was not included in igraph, because really, it
takes only writing a one line function to do it. But it is on our TODO
list and will be included soon.
E.g. for degree see the thread that starts here:
http://lists.gnu.org/archive/html/igraph-help/2008-11/msg00064.html
You can
Kyle,
In addition to "listings" already mentioned by Berwin, you may find
useful the "answers" package. This is what I use to create assignments/
exams/exercise sets with solutions all in one file.
HTH
Vincent
---
Vincent Goulet, Associate Professor
École d'actuariat
Université Laval
Weijia,
if you only need degree centralization, Gabor suggests me those lines
of code and they work great:
## undirected graph
centralization<-(sum(max(degree(g))-degree(g)))/(vcount(g)-1)/
(vcount(g)-2
## directed graph
centralization<-(sum(max(degree(g))-degree(g)))/(2*vcount(g)-1)/
(vc
This command
rows <- as.numeric(system(paste("wc -l < /path/myFile.txt",sep=""), TRUE))
works when used directly in R and when I put it inside a shell script
and submit it to the cluster.
This command
columns <- as.numeric(system(paste("head -1 < /path/myFile.txt | wc
-w",sep=""), TRUE))
works
"From: Yihui Xie
Date: Sun, 30 Nov 2008 15:32:35 +0800
Wow, you are so lazy... But sometimes R is just designed for lazy guys... "
Yeah, well, laziness is the mother of creativity :-) .
But seriously: I know far too many engineers who plug madly away for
hours/days on end, where I would jus
Hi,
I have a following situation with data:
col1 col2
mir-1 aaa
mir-1 abc
mir-1 aac
mir-2 abb
mir-2 aaa
mir-3 cag
mir-3 ccc
mir-3 aaa
I want to have output in this format:
col1 col2
mir-1 aaa, abc, aac
mir-2 abb, aaa
mir-3 cag,ccc,aaa
I have sorted column 1 so that the grouping could be p
On Sun, Nov 30, 2008 at 11:38 AM, Carl Witthoft <[EMAIL PROTECTED]> wrote:
> "From: Yihui Xie
> Date: Sun, 30 Nov 2008 15:32:35 +0800
>
> Wow, you are so lazy... But sometimes R is just designed for lazy guys... "
>
>
> Yeah, well, laziness is the mother of creativity :-) .
> But seriously: I kno
See ?tapply
> tapply(paste(DF$col2), DF$col1, c)
$`mir-1`
[1] "aaa" "abc" "aac"
$`mir-2`
[1] "abb" "aaa"
$`mir-3`
[1] "cag" "ccc" "aaa"
> # or
> t(t(tapply(paste(DF$col2), DF$col1, paste, collapse = " ")))
[,1]
mir-1 "aaa abc aac"
mir-2 "abb aaa"
mir-3 "cag ccc aaa"
> # or
> t(do.call(cb
On Sat, 29 Nov 2008, Faheem Mitha wrote:
Hi,
If I want to import the contents of a R file into another one, I can do
source("foo.R")
However, this imports everything from foo.R, including all functions and
global variables. Is there a way of selectively importing individual
functions etc.,
Hi all
I have the following regular expression problem: I want to find
complete elements of a vector that end in a repeated character but
where the repetition doesn't make up the whole word. That is, for the
vector vec:
vec<-c("", "baaa", "bbaa", "bbba", "baamm", "aa")
I would like to get
"b
BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }I
am looking to draw what I hoped was a simple plot of proportion WITHIN
a strata, save % males by site. I seem to be able to get proportion of
males, by
site, where the proportion is across the whole dataset, but not the
proportio
Dear list,
I have a data file which includes, alongside various variables representing
questionnaire scores, a variable for survey weights computed as the number of
observations in the sample drawn from that group divided by the number of
observations in the population in the group. I need to ca
Hi Stefan! :-)
From tools where negative lookbehind can involve variable lengths,
one
would think this would work:
grep("(?
It's really the PCRE library that doesn't like your regexp, not R.
The problem is that negative behind is only possible with a fixed-
length expression, and sinc
see
?coef # extract the estimates
?vcov # extract their covariance matrix
?qf # get the F quantile of interest
Also, you may be interested in
?car::ellipse
?ellipse::ellipse.lm
?gmodels::glht.test
hth,
Kingsford Jones
On Sat, Nov 29, 2008 at 4:30 PM, Kyle Matoba <[EMAIL PROTECTED]> wrote:
Hello list,
I wish to perform a randomization test on the F-statistics of a 2 way ANOVA
but have not been able to find out how to do so - is there a package /
function that can perform this that I am unaware of?
FactorA has 6 levels (0,1,2,3,4,5) whereas FactorB has 3 (1,2,3). A sample:
Resp.
Try this:
> vec <- c("", "baaa", "bbaa", "bbba", "baamm", "aa")
> grep("^(?!(.)\\1{1,}$).*(.)\\2{1,}$", vec, perl = TRUE)
[1] 2 3 5
The (?...) succeeds only if the string is not all the same
character and since that consumes no characters it
restarts at the beginning to match anything follow
dear list,
I have read a spss file with read.spss()
now I have a list with all my variable stored as vectors.
is it possible to selec cases based on the value of one or more
variables?
thank you,
Simone
__
R-help@r-project.org mailing list
https:
Here is a very slight further simplification, i.e. we can drop the final {1,}
> grep("^(?!(.)\\1{1,}$).*(.)\\2$", vec, perl = TRUE)
[1] 2 3 5
On Sun, Nov 30, 2008 at 3:26 PM, Gabor Grothendieck
<[EMAIL PROTECTED]> wrote:
> Try this:
>
>> vec <- c("", "baaa", "bbaa", "bbba", "baamm", "aa")
>
?subset
On Nov 30, 2008, at 3:36 PM, Simone Gabbriellini wrote:
dear list,
I have read a spss file with read.spss()
now I have a list with all my variable stored as vectors.
is it possible to selec cases based on the value of one or more
variables?
thank you,
Simone
___
It is.
For example, if you have a variable stored as a vector named "x", and
another variable stored as aa vector named "y", you can select cases
of y where x is greater than 3 by using
y[x>3]
However, you're going to have to provide more information in order to
get a better answer than t
You could see whether the stacked barchart in Sarkar's website meets
your needs:
http://lmdvr.r-forge.r-project.org/figures/figures.html
See figure 4.5
also look at:
?prop.table
Description
This is really sweep(x, margin, margin.table(x, margin), "/") for
newbies
--
David Winsemius
But is there a one-line grep thingy to do this?
Can't think of a one-liner, but a three-line solution you can easily
enough wrap in a small function:
vec<-c("", "baaa", "bbaa", "bbba", "baamm", "aa")
idx.1 <- grep("(.)\\1$", vec)
idx.2 <- grep("^(.)\\1*$", vec)
vec[setdiff(idx.1, idx.2)]
Dear Steve,
You can use svyvar() in the svy package to compute a covariance matrix that
properly reflects the weights (and other details of the sampling design), and
from this, using cov2cor(), a correlation matrix (if you want that too). You
should get consistent estimates from sem() in the se
Hi Charles,
Thanks for the reply.
On Sun, 30 Nov 2008, Charles C. Berry wrote:
On Sat, 29 Nov 2008, Faheem Mitha wrote:
Hi,
If I want to import the contents of a R file into another one, I can do
source("foo.R")
However, this imports everything from foo.R, including all functions
and g
sorry for my bad presentation...
read.spss gives me this:
> students
$Auno
[1] 6 1 2 2 1 3 4 2 4 2 4 4 1 1 NA 1 4 2 1 1 1
5 4
[24] 2 1 2 1 2 1 4 4 1 1 1 2 1 6 1 1 1 1 1 2 1
2 1
[47] 2 2 1 4 2 4 3 1 1 1 1 3 2 1 4 4 4 4 2 4
It's generally easier to work with data frames, so read your data with
students <- read.spss(yourFile, to.data.frame=TRUE)
Then subset will work as expected:
subset(students, Sex == 1)
If you would rather keep the data as a list you could do something like
lapply(students, function(x) x[stud
yes it's THE solution!
thank you very much,
Simone
Il giorno 30/nov/08, alle ore 22:42, Kingsford Jones ha scritto:
It's generally easier to work with data frames, so read your data with
students <- read.spss(yourFile, to.data.frame=TRUE)
Then subset will work as expected:
subset(students
Vincent, Ista, Berwin:
Thank you all for your help. It is great that a student like myself can
receive help from Professors and experts such as yourselves.
To the list, I found Berwin's solution to work excellently, though I chose
to change the font of the included text, e.g.
\texttt{ \lstinpu
I am running a large for loop and at the end of each iteration a matrix is
produced. The program changes the columns in the matrix, and each time a
column is added the name of that column is "y". All original columns have no
column name. Due to the nature of the program, all original columns
On Sun, 30 Nov 2008, Faheem Mitha wrote:
Hi Charles,
Thanks for the reply.
On Sun, 30 Nov 2008, Charles C. Berry wrote:
On Sat, 29 Nov 2008, Faheem Mitha wrote:
>
> Hi,
>
> If I want to import the contents of a R file into another one, I can do
>
> source("foo.R")
>
> However, thi
On Sun, 30 Nov 2008, Charles C. Berry wrote:
On Sun, 30 Nov 2008, Faheem Mitha wrote:
[much deleted]
I missed a '\n >' in my previous post. It should have read:
eval(foobar.expr[[ 1 ]])
ls()
[1] "foo" "foobar.expr"
foo
function(x) x+1
Charles C. Berry
Hello,
I have some code which generates lattice objects. The function
recieves serialized forms of the lattice objects which it then
unserializes and then adds to an ArrayList.
REXPRaw rser = new REXPRaw( target ); //target contains the raw
serialized forms of lattic
On Sun, Nov 30, 2008 at 12:21 PM, Salas, Andria Kay <[EMAIL PROTECTED]> wrote:
> I am running a large for loop and at the end of each iteration a matrix is
> produced. The program changes the columns in the matrix, and each time a
> column is added the name of that column is "y". All original c
Hello,
With reference to the problem below, I have narrowed it down to
trellis objects containing language objects , e.g a trellis object has
a list element called $prepanel.default which is a function.
The same happens if assign the result of an 'dist' call since it
contains
Yes
chron 2.3-25
zoo 1.5-4
R 2.8
Mac OS X 10.5.5
Gabor I don't know how to start up another verison of R on the mac. I
will figure this out, and get back to you (I can then test both of
them side by side).
other fast installation (version numbers from description files in R
2.7.2 directory)
chro
To run the old version of chron that you have under 2.7.2
into 2.8.0, on 2.7.2 issue the command (note initial dot):
.libPaths()
Suppose you find that the library that contains chron in
2.7.2 is "/a/b".
Then on 2.8.0 ensure that you don't have chron on the search path
search()
and if you do de
The code below may not be the most optimized, but it should do the trick.
I've implemented the permutation test, which by some nomenclatures is
distinguished from the randomization test in that the latter is exhaustive
while the former is not.
I'm eager to hear the views of the list on whether the
Hans W. Borchers wrote:
Dear R-help,
I am looking for ideas and presentations of new and advanced data visualization
methods. As an example of what I am searching for, the 'Many Eyes' pages at
http://manyeyes.alphaworks.ibm.com/manyeyes/
may provide a good paradigm. I would be interested
I have a dataframe with the following variables:
idnum areagender raceetc.
I would like to make a table that looks like
areagender race
M FB W A
1 4 53 5 1
2 6 74 6 3
etc.
Basically, I want to make a single broad table with a number of sub-set
Sorry for the need for a second mail, but the URL missed a 't'
http://www.omegahat.org/SVGAnnotation/tests/examples.html
^
Duncan Temple Lang wrote:
Hans W. Borchers wrote:
Dear R-help,
I am looking for ideas and presentations of new and advanced data
v
On Nov 30, 2008, at 10:23 PM, Dylan Beaudette wrote:
Hi, I am using the rcs() function in the Design library to model
non-linearity that is not well characterized by an otherwise
mechanistic function. I am able to make the model 'available' to
others through the excellent nomogram() function an
Wow, you are so lazy... But sometimes R is just designed for lazy guys...
##
f = function(a) {
s = substitute(a)
as.character(s)
}
##
f(a = asdf)
[1] "asdf"
f(qwer)
[1] "qwer"
Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile:
On Sun, 30 Nov 2008, Andrew Choens wrote:
I have a dataframe with the following variables:
idnum areagender raceetc.
I would like to make a table that looks like
areagender race
M FB W A
1 4 53 5 1
2 6 74 6 3
etc.
Basically, I want to make
To whomever may be of help,
I am a student in a graduate modeling class at the University of North Carolina
at Wilmington. I am trying to get a STELLA model converted into R. I am in the
process of trying to 're-write' the script into R, but I seem to be missing
pieces (i.e. parm values) that a
Dear R users:
I'm wondering if it's possible to get the residual correlation matrix when
using factanal.
Since factanal assumes that the errors are normally distributed and independent
(provided the factor model fits the data) this would be useful. Of course you
would need to submit the data to
Thanks for kind help from Steven and Christos last time. Now I got new
problem regarding the codes for calculating the "weights" (w) in "AIC ()
function".
The original code is as below:
> getAnywhere("logLik.lm")
function (object, REML = FALSE, ...)
{
res <- object$residuals
p <- ob
Gabor Grothendieck wrote:
> Try this:
>
>
>> vec <- c("", "baaa", "bbaa", "bbba", "baamm", "aa")
>>
>
>
>> grep("^(?!(.)\\1{1,}$).*(.)\\2{1,}$", vec, perl = TRUE)
>>
or even
grep("^(?!(.)\\1+$).*(.)\\2+$", vec, perl = TRUE)
vQ
__
On Sun, Nov 30, 2008 at 5:05 PM, Dana77 <[EMAIL PROTECTED]> wrote:
>
> Thanks for kind help from Steven and Christos last time. Now I got new
> problem regarding the codes for calculating the "weights" (w) in "AIC ()
> function".
> The original code is as below:
> > getAnywhere("logLik.lm")
> fu
Hans W. Borchers-4 wrote:
>
> Tom Backer Johnsen psych.uib.no> writes:
>
> I am also wondering if the "R Wiki" would be a better place to publish
> summaries
> on topics discussed here. On the mailing list, summaries are forgotten
> within
> one or two months time, only to be retrieved in spe
Gibson, Tyler F wrote:
> To whomever may be of help,
>
> I am a student in a graduate modeling class at the University of
> North Carolina at Wilmington. I am trying to get a STELLA model
> converted into R. I am in the process of trying to 're-write' the
> script into R, but I seem to be missing
69 matches
Mail list logo