Displaying 20 results from an estimated 3000 matches similar to: "install a package from CRAN"
2002 May 03
2
delete rows
Hello,
I would like to know how to delete some rows?
Suppose I have a large data frame look something like this:
x1 x2 x3 ..............
a 1 0.45
b 1 0.41
c 0 0.43
a 1 0.39
d 1 0.40
e 0 0.41
r 1 0.42
a 0 0.46
. . ..
I would like to have another data frame which has all
2002 Apr 09
6
matrix dimension and for loop
Dear all,
My questions are that if I have
> x<-rnorm(50)
> dim(x)<-c(10,5)
> y=1:5
> Z<-matrix(0,NROW(x),NROW(y))
> for (j in 1:NROW(y)) Z[,j]<-x[,j]*y[j]
1. Is there any other way to write this without 'for'
loop?
2. and if I don't know the dimension of x, which could
be only 1 column, how could I write the command
without using if (NCOL(x)==1), or
2002 Apr 22
2
lattice x(y)lab and expression
Another question about lattice:
Is there a way to use plotmath in the labels and strips?
E.g.
xyplot(y~x|group,data=test.df,
panel=function(x,y,subscripts,df) {
llines(x,y,col="black",lwd=2)
llines(x,df[subscripts,"lowerCI"],lty=2,col="#aaaaaa")
llines(x,df[subscripts,"upperCI"],lty=2,col="#aaaaaa")
},
2002 Apr 22
2
lattice help
I'm new to lattice and can't figure out what the problem is with the
following example:
#########################
> library(lattice)
Loading required package: grid
Attaching package `lattice':
The following object(s) are masked _by_ .GlobalEnv :
xyplot
The following object(s) are masked from package:base :
levels
> test.data <- data.frame(x=rnorm(100),
+
2002 Apr 30
3
A sample question
Hello.
Given a vector 1 3 4 2 8 9 5
I want to obtain a vector with all 0 except in the second position and in
the fifth, where the numbers are the same of the first vector.
The new vector must be
0 3 0 0 8 0 0
Thank you very much.
Excuseme but my mind is out of order.
Alessandro
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2002 Apr 15
3
Greek in text()
I have gone over the examples and can't figure this out:
rho<-.77
text(x=.05,y=.5,paste(expression(rho),rho))
I was hoping to get this to print a Greek rho with 0.77 beside it.
Instead I get: rho 0.77 (i.e. Roman lettering)
The help on expression() is quite opaque so I don't understand how it
works.
Thanks for any help.
Bill Simpson
2002 May 06
3
Using Object's Name in Function
Hi,
Suppose I have a function:
myfunc <- function(x, y) {
...
}
And within the function I want to print out the name of the x, y
vectors. For example, if I do:
> myfunc(foo, goo)
[1] "foo" "goo"
It shall return "foo", "goo" (with or without quotes is fine), where foo
and goo are two vectors with numbers.
I know this sounds strange, but I'd
2002 May 06
3
function sort.list()
Derar R-people
I have troubles understanding what the function sort.list() is doing. On
the homepage it says that it returns a permutation which rearranges a
vector into ascending or descending order (like order() but on a vector
instead of a sequence).
> sort.list(c(0, 2, 10, 11, 4))
[1] 1 2 5 3 4
which does not make sense to me.
In fact I am getting the same (non-sensical) result using
2002 Apr 19
4
Multidimensional scaling
A student of mine wants to use R to do some nonmetric multidimensional
scaling. According to the R FAQ, there's a package called pcurve that
computes multidimensional scaling solutions, but I was not able to locate
it the contrib page (I am a Windows user with R version 1.4.1). Can
anyone tell me whether it is possible to do nonmetric multidimensional
scaling with R, and if so, how?
John
2002 Apr 17
4
union of lists
Hi there,
Given 2 lists of integer vectors, i.e.:
> lista1
$"1"
[1] 1 34 5
$"2"
[1] 2 1
$"3"
[1] 3 10 15
> lista2
$"1"
[1] 1 5
$"2"
[1] 2 1
$"3"
[1] 3 10 29
I want to obtain the union of both, defined
as the union of the vectors, that is
lista.union[[1]] <- union(lista1[[1]],lista2[[1]]):
> lista.union
2002 May 07
4
Putting obejct into Graph title
Hello all -
If I want to put mean value of a matrix into the title or subtitle of a graph, how would I do this? For example, in a set of commands like below,
> m.mean<-mean(m)
> gplot (m, thresh=m.mean)
> title (main="A2. Block Density of Matrix m\nplotted based on MDS",
+ sub="lines below mean density (**0.435**) suppressed")
I want to ask [R] to put the
2002 May 08
3
Inputting Co-ordinates
Hello
I am trying to input some co-ordinate sets into R of the form x,y by using
lists. The command I am using is:
p1 <- list(x=c(3445,563,646), y=c(234,567,456))
However the actual co-ordinate sets that I am trying to input have 305
points each and I think that the program will not accept a command that is
as long as necessary. Is this so? If this is the case can you tell me how
to read
2005 Jul 11
2
building packages on Windows
Hi, all,
I just recently upgraded my computer though I'm using the same OS (XP).
But now I'm having difficulty building packages and I cannot seem to
solve the problem. I'm using R-2.1.1pat on Windows XP.
Here is what I tried:
D:\Users\sundard\slib\sundar\R>R CMD CHECK sundar
* checking for working latex ... OK
* using log directory
2002 Jun 19
4
drawing ellipses
Hello again,
First I want to thank all the people who answered my question about line
width in graphs. I promise I will learn the 'par' help page by heart for
the end of the month !
I now want to trace some ellipses to emphasize groups of data. I found how
to trace circles with 'symbols()', but no ellipse. I'm planning on writing
my own function based on
2002 May 11
4
Is this a bug of pweibull()?
In rw1050, I found that
> pweibull(3:10, 2)
[1] 0.9998766 0.9999999 1.0000000 1.0000000 NaN NaN
[7] NaN NaN
Warning message:
NaNs produced in: pweibull(q, shape, scale, lower.tail, log.p)
more surprisingly,
> pweibull(3:10, 2.1)
[1] 0.9999566 1.0000000 1.0000000 -Inf NaN NaN
[7] NaN NaN
Warning message:
NaNs produced in: pweibull(q,
2003 Dec 22
1
La.eigen hangs R when NaN is present (PR#6003)
Full_Name: Sundar Dorai-Raj
Version: 1.8.1
OS: Windows 2000 Professional
Submission from: (NULL) (12.64.199.173)
I discovered this problem when trying to use princomp in package:mva when a
column in my matrix was all zeros and I set cor = TRUE (thus division by 0).
Doing so hangs R, never to return. I have to shut down Rterm in the Task Manager
and lose all work from the current image. I tracked
2018 May 24
4
Manipulation of data.frame into an array
Hello everyone,
I want to transform a data.frame into an array (lets call it mydata), where: mydata[[1]] is the first imputed dataset...and for each mydata[[d]], the first p columns are covariates X, and the last one is the outcome Y.
Lets assume a simple data.frame:
Imputed = data.frame( X1 = c(1,2,1,2,1,2,1,2, 1,2,1,2,1,2,1,2),
X2 =
2007 Nov 04
4
Problems with garch() function tseries package R 2.6.0
Hi all,
I recently updated my to R 2.6.0 and tseries package ?tseries? version: 0.10-11.
When i was using R Version 2.3.1 (2006-06-01) with tseries 'tseries' version: 0.10-7, the code
> garch(dflnRCLC1)
***** ESTIMATION WITH ANALYTICAL GRADIENT *****
Call:
garch(x = dflnRCLC1)
Coefficient(s):
a0 a1 b1
4.985e+00 1.880e-01 6.210e-14
>
worked very
2015 Jan 08
4
unloadNamespace
In the documentation the closed thing I see to an explanation of this is
that ?detach says "Unloading some namespaces has undesirable side effects"
Can anyone explain why unloading tseries will load zoo? I don't think
this behavior is specific to tseries, it's just an example. I realize
one would not usually unload something that is not loaded, but I would
expect it to do
2008 Apr 10
1
Problem installing and using package "tseries"
I have R 2.6.2, and have tried downloading and installing the package
"tseries". I get the same error when I use two different mirror sites:
> utils:::menuInstallPkgs()
trying URL
'http://cran.mirrors.hoobly.com/bin/windows/contrib/2.6/tseries_0.10-14.zip'
Content type 'application/zip' length 400799 bytes (391 Kb)
opened URL
downloaded 391 Kb
package