Displaying 20 results from an estimated 10000 matches similar to: "hide body of function"
2000 May 25
1
diag() (PR#555)
Full_Name: David Duffy
Version: 1.0.1
OS: Linux
Submission from: (NULL) (152.98.96.21)
Documentation for diag() states that "If x is a vector (or a
1-d array) then diag(x) returns a diagonal matrix whose diagonal
is x."
> m<-matrix(1:4,ncol=1)
> diag(m)
[1] 1
diag(as.vector(m)) gives the advertised performance.
Fix: Change documentation.
2000 Mar 07
1
A simple question??
Dear all,
I'm currently use R v0.99 on Windows 98 Second Edition. I have a question on some simple calculations. I wonder that I've done something wrong with the calculation.
Here is the imput commands:
> a <- 25.01
> b <- 56.08
> a.trunc <- trunc(a)
> b.trunc <- trunc(b)
> a.tail <- a - a.trunc
> b.tail <- b - b.trunc
> a.trunc
[1] 25
>
2001 Jul 09
1
polynomial regression and poly
When doing polynomial regression I believe it is a good idea to use the poly
function to generate orthogonal polynomials. When doing this in Splus there
is a handy function (transform.poly I think) to convert the coefficients
produced by regression with the poly function back to the original scale.
Has somebody written something similar for R ?
Robert
2000 Feb 03
1
Re: your mail
> On Wed, 2 Feb 2000, Adriane Leal wrote:
>
> > I'd like to perform a box-cox transformation to a data set and also plot
> > lambda versus L(lambda) using R. Does anybody knows how can I do such a
> > thing?
gnlr3 in my gnlm library does both linear and nonlinear models with
Box-Cox transformation. However, it is somewhat nonstandard as it
renormalizes to obtain a
2000 Jun 22
1
help
Dear All,
Further to answers to sorting, can someone tell me how can I sort a list
that contains duplicates (name) but keeping the duplicates together when
sorting the values.
e.g., a data frame with name (in duplicates), Mvalues(may be different for
the duplicates)
name M
1234 8
1234 8.3
4321 9
4321 8.1
If I sort by M, it will be 1234, 4321, 1234, 4321 but I want to keep the
duplicates together,
1999 Mar 17
1
hist(list)?
It seems that the following should work:
> x<-read.table('1A.tab',header=T,skip=1);
> mode(x[1])
[1] "list"
> x[1]
p01
R1-00 0.0295
R1-01 0.0283
R1-02 0.0145
R1-03 0.0235
R1-04 0.0339
R1-05 0.0239
R1-06 0.0414
R1-07 0.0259
> hist(x[1])
Error: hist: x must be numeric
> as.numeric(x[1])
Error: (list) object cannot be coerced to vector type 14
>
2001 Nov 01
1
cor.test for a correlation matrix
Is there a simple way to run cor.test on for a matrix of correlations?
Of course, cor on a data frame produces a correlation matrix, but cor.test will only take two variables at a time. Is there a way to get behavior similar to that of cor with cor.test?
I suppose the programming alternative would be to run two for loops with the number of items and cor test embedded accessing the columns of
2000 May 04
1
logistic regression example from Devore5
I maintain the Devore5 package for R. This package provides the data
sets from Jay Devore's text "Probability and Statistics for
Engineering and the Sciences (5th ed)". I am having difficulty
reproducing some logistic regression results from the textbook.
Perhaps this is because I am not using the glm function correctly.
The data from Example 13.5 (page 559 for those with a copy
2000 Apr 25
2
Recursive Computation in R
Hi there,
I have written a function to calculate factorials as follows:
fact <- function(x) {
recurse <- x > 1
x[!recurse] <- 1
if( any(recurse) ) {
y <- x[recurse]
x[recurse] <- y * fact( y - 1 )
}
x
}
I want to be able to do the famous birthday problem, which will involve
the computation of 365!, however it shall get cancelled
2000 Sep 20
1
SV: sample from contingency table
I have had the same problem and I wrote this function
rmulti <- function(n, size, p)
{
NrDim <- length(p)
if(NrDim<2) stop("The simulated variabel has to be at least
2-dimensional")
res <- matrix(data=NA, nrow=n, ncol=NrDim)
p <- p/sum(p)
TempSize <- size
for(i in 1:NrDim)
{
TempP <- p[i]/sum(p[i:NrDim])
TempBin <- rbinom(n=n, size=TempSize,
2000 Aug 14
5
Writing a workable function
After searching in R- Introduction, FAQ, help... I don't understand
this:
I write a function in a file (.R):
tt <- function(mc) { date()
mc<-read.csv2("machines.txt",na.strings="")
date()
}
I source it in R and I type tt(). The answer is
> tt()
[1] "Mon Aug 14 11:18:25 2000"
>
The instructions following the first "date()" are ignored. Why?
2000 Sep 24
2
Folding ?
Hi,
I need to write a function that would look something like this:
S <- function(b=betas){
expression(b[1] * f(b[2] * x * f(b[3] * x * f(...b[n-1] * x * f(b[n] *
x)))...)
}
Where n is the number of element in b.
Further I need to be able to evaluate S at some x numerically of course and
I need to use "deriv" and produce dS/dx such that I can evaluate it also at
some x.
I
2000 Jan 12
3
functions for flat file import/export + utilities
Dear R-Developers,
please find attached a set of drafted functions for flat file import and
export, partially extending existing functions, partially completely written
as new code.
I thought you might be interested in those functions and the accompanying
utilities for padding and trimming.
Main features are
- supports several formats, i.e. fixed width and CSV (with one exception)
- supports
2000 Mar 20
3
: multinom()
Dear R users,
Does anyone know if it is possible to use multinom to do a polychotomous
fit using one categorical and one numeric variable as response. The
doc. for multinom states that for formula , response can be K>2 classes.
Is this 2 and more, or as I have understood it only greater than 2. I
have tried fitting my data, but have only encountered error messages.
On another note, Is it
1999 Sep 22
1
model.matrix() (PR#285)
I was alarmed to discover that model.matrix.default() can permute columns
with respect to the formula. This seems to happen with user-defined
components of the formula. Thus
X <- matrix(1:4, 1, 4, dimnames = list(NULL, LETTERS[1:4]))
Q <- function(x) x^2 # because model.matrix() does not like, eg, A:A
model.matrix(~ -1 + A + A:B + Q(C), data.frame(X))
has columns ordered A, Q(C), and
2000 Feb 23
2
Files unavailable on CRAN
I've been trying to download from CRAN the floppy versions of the R source
files:
R-release-1.tar.gz, R-release-2.tar.gz
I tried the servers in Seattle, Madison, and the Vienna
Technical University. In each case, the file(s) were unavailable.
Anne
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anne E. York
National Marine Mammal Laboratory
Seattle WA 98115-0070 USA
e-mail: anne.york at noaa.gov
2000 Oct 09
4
lm question
I have not really used lm before and I was hoping for some help on a
simple problem.
Here is a toy version of the problem I want to solve.
y x grp
-.9 1 a
-.8 2 a
-.7 3 a
-.7 1.5 b
-.5 2.5 b
-.3 3.5 b
-.19 2.7 c
-.11 3.7 c
-.41 4.7 c
I want to fit a model that has one y-intercept and three slopes, one for
2000 Jan 04
1
correlation matricies: getting p-values?
I have to admit that I'm at a bit of a loss here; any pointers would be
greatly appreciated.
I've been making correlation matricies from some of my datasets, and
have been instructed to get the probability values for each of these
correlations.
I've checked the online help for info on both the cor and cov functions,
but I was unable to find any relevant info on finding how to obtain
1999 Dec 19
3
CRAN src/contrib/Devel
The `src/contrib/Devel' dir contains
*bats*
Basic time series modelling functions.
*dopt*
Finding D-optimal experimental designs.
*tcltk*
Basic interface with Tcl/Tk.
*timeslab*
Time series routines.
*vtcl*
Interface to Visual Tcl.
which have all been there for a long time.
What is the current status, is any of the above getting ready for being
moved into
1999 Nov 14
2
dimnames
Hi,
Maybe this is a simple question:
Using S-Plus, and having a matrix m with row- and col-names, I have the
following problem:
When I import into a function the one-column matrix m[,i], I am no
longer able to get the
column name. Is there a way to get the column-name?
(Although attributes(m) displays row- and col-names, attributes(m[,i])
does no longer show
the col-name.)
Thank you for your