Displaying 20 results from an estimated 10000 matches similar to: "subsets in data frame"
2005 Jun 26
1
better code?
Hi, Laura:
How about the following:
> sapply(x1.df, class)
d x y
"factor" "numeric" "numeric"
> (byLH <- by(x1.df[-1], x1.df$d, var))
x1.df$d: 1/1/2005
x y
x 1.272688 -0.783719
y -0.783719 0.884866
-------------------------------------------------------------
x1.df$d: 1/15/2005
x y
x
2004 Jun 29
1
abline and its objects
Hi R People:
Is there a way to put an abline line for its objects on a plot, please?
I have an its object, ibm2, which runs from the January 2 through May 28.
>ibm2
ibm
2004-01-02 91.55
2004-01-05 93.05
2004-01-06 93.06
2004-01-07 92.78
2004-01-08 93.04
2004-01-09 91.21
2004-01-12 91.55
2004-01-13 89.70
2004-01-14 90.31
2004-01-15 94.02
.
.
.
I plot the data. No
2004 Aug 20
3
legends on the outside of the "box"
Hi R People:
Here is a simple set of commands:
>x1 <- 1:10
>x2 <- sqrt(x1)
>plot(x1)
>points(x2,col="red",pch=3)
>legend(2,8,legend=c("First","Second"),col=c("black","red"),pch=c(1,3))
>
Fine.
Now, I would like to put the legend box on the outside of the plot itself,
perhaps in the lower
left hand corner.
I've been
2004 Aug 11
2
str and Surv objects
Dear R People:
I used the "Surv" function to produce the following object:
>a <- Surv(1:4,2:5,c(0,1,1,0)) a
[1] (1,2+] (2,3 ] (3,4 ] (4,5+]
>str(a)
Error in "[.Surv"(object, 1:ile) : subscript out of bounds
>
Why does str(a) give an error, please? Or did I do something wrong?
Thanks in advance.
R Version 1.9.1 Windows
Sincerely,
Laura Holt
mailto: lauraholt_983
2004 Aug 19
2
ROracle and vector elements
Hi there!
Is ROracle available for Windows, please?
I found a download site, but it's really for UNIX/Linux.
Here is a "thought question", please: Why do the vector elements start at
location 1 rather than zero, as C does?
Thanks in advance!
R Version 1.9.1 Windows
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
2004 Nov 16
3
Changing zeros to NAs in a data frame
Dear R People:
I have a data frame with some columns that are numeric and some which are
factors.
There are zeros in the numeric columns and I would like to change them to
NAs. However, there are zeros in some of the factor columns, and I would
like them to be left alone.
Is there a "global" way to do this, please? I was thinking about use the
results from "str" but am
2004 Jun 22
2
question about window and inserting value
Hi again R People:
I have the following time series:
>x.ts
Jan Feb Mar Apr May Jun Jul Aug Sep
2000 0.95 0.66 0.83 0.66 -1.45 -1.25 0.33 1.03 -0.48
2001 2.55 1.21 -1.10 -0.63 0.01 -2.20 -0.51 1.12 1.11
2002 -1.37 0.55 -0.63 -0.56 0.92 -1.73 0.59 0.77 0.30
2003 0.55 -0.01 -0.54 2.27 -1.29 -0.23 0.09 -0.50 -0.61
Oct Nov Dec
2000 0.84 -1.35
2005 Jul 10
2
Off topic -2 Ln Lambda and Chi square
Dear R :
Sorry for the off topic question, but does anyone know the reference for
the -2 Ln Lambda following a Chi Square distribution, please?
Possibly one of Bartlett's?
Thanks in advance!
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
2005 May 03
4
Classes and methods
Hi R people:
I would like to learn about classes, methods, S3 and S4.
Which book would be the most helpful for this info, please: the green one
or the white(and blue) one?
Or is there something that would be even better, please?
Thanks in advance.
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
R 2.1.0 Windows.
trying to learn
2004 Aug 21
2
more on apply on data frame
Hi R People:
Several of you pointed out that using "tapply" on a data frame will work on
the iris data frame.
I'm still having a problem.
The iris data frame has 150 rows, 5 variables. The first 4 are numeric,
while the last is a factor, which has the Species names.
I can use tapply for 1 variable at a time:
>tapply(iris[,1],iris[,5],mean)
setosa versicolor virginica
2005 Feb 23
3
and [ESS] Starting ESS
Dear R People:
I have finally seen the error of my ways and have decided to use ESS for R
and S + stuff.
However, I have a question right from the beginning. I'm somewhat confused
by the installation instructions.
Do I install XEMACS or ESS first, please?
Windows XP
R Version 2.0.1
(S + 6.2)
Thanks so much!
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
2004 Nov 16
2
changing character to a vector name
Dear R People:
I would like to generate a vector/variable name from within a loop to be
passed to a table
function.
This is what I have so far:
>assign("p1",paste("raw3.df$",rw2$V1[3],sep=""))
>p1
[1] "raw3.df$CITIZEN"
>
Essentially, I want to use the raw3.df$CITIZEN along with another value to
generate a table.
However, I'm stuck here. I
2005 Feb 28
1
number formatting
Dear R People:
I have used the command round(x,3) to produce values with 3 places to the
right of the decimal.
Is there any command to remove the leading zero before the decimal point,
please: that is, if I have 0.375, how do I produce just .375, please?
Thanks in advance
R 2.0.1 for Windows
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
2004 Jul 07
1
question about seq.dates from chron vs. as.POSIXct
Dear R People:
Here is an interesting question:
>library(chron)
>xt <- seq.dates(from="01/01/2004",by="days",length=5)
>xt
[1] 01/01/04 01/02/04 01/03/04 01/04/04 01/05/04
>
#Fine so far
>as.POSIXct(xt)
[1] "2003-12-31 18:00:00 Central Standard Time"
[2] "2004-01-01 18:00:00 Central Standard Time"
[3] "2004-01-02 18:00:00 Central
2004 Oct 11
1
Puzzled on nlm
Dear R People:
Here is a function to minimized:
>mfun1
function(x,a) {
x[1] <- a[1]*x[2] + a[3] - a[2]*(a[1]-a[2])*a[3]
x[2] <- a[1]*x[1] - a[2]*a[3]
return(x)
}
Here is my first try:
>nlm(mfun1,c(1,1))
Error in f(x, ...) : Argument "a" is missing, with no default
>
>nlm(mfun1,c(1,1),a=c(0.8,0.5,1))
Error in nlm(mfun1, c(1, 1), a = c(0.8, 0.5, 1)) :
2005 Apr 27
2
Question about R initial message
Dear R:
First of all, nothing is wrong!
I just had a question about the following"
"Natural language support but running in an English locale"
What does than mean, please?
Thanks in Advance
R 2.1.0 Windows
Laura Holt
mailto: lauraholt_983 at hotmail.com
2004 Jun 21
2
question about latex command in Hmisc
Hi R People:
I got the following error from using the "latex" command from Hmisc;
>latex(bbm)
'latex' is not recognized as an internal or external command,
operable program or batch file.
Warning message:
cmd execution failed with error code 1 in: shell(cmd, wait = TRUE, intern =
output)
>
I was printing a matrix to a Latex File. This worked fine in Version 1.8.
This
2004 Jun 11
2
question about Rcmd SHLIB
Dear R People:
I'm trying to use the Rcmd SHLIB to produce a dll.
Rcmd SHLIB -o test2.dll test2.f
make[1]: *** [libR.a] Error 255
make: *** [libR] Error 2
Where do I go to find out about the "make" errors, please?
I suspect that I might be missing something. I have the tools for creating
new packages, but
maybe I left out something.
This is for R version 1.9.0 on Windows.
2004 Jul 01
2
[gently off topic] arima seasonal question
Hello R People:
When using the arima function with the seasonal option, are the seasonal
options only good for monthly and quarterly data, please?
Also, I believe that weekly and daily data are not appropriate for seasonal
parm estimation via arima.
Is that correct, please?
Thanks,
Sincerely,
Laura Holt
mailto: lauraholt_983 at hotmail.com
download!
2004 Jun 28
1
plotting with an its object
Dear R People:
I have an its object. The original its is the Dow Jones Industrial average
from March 23, 1990 to March 23, 2000. I did the following;
dj1 = original series
>dj2 <- log(dj1)
>ddj2 <- diff(dj2)
>
Ok so far.
Now I would like to plot this series with a certain y limit:
>min(ddj2)
[1] -0.07454905
>max(ddj2)
[1] 0.04860535
>plot(ddj2,ylim=c(-0.1,0.1))
Error