Displaying 20 results from an estimated 7000 matches similar to: "Using Object's Name in Function"
2002 Apr 15
1
Re: Writting R Function
Hi,
I think I found the problem. It lies in my Fortran program. Is there a
way, after a DO loop, to make sure it does NOT return anything?
Cheers,
Kevin
On Mon, 15 Apr 2002, Ko-Kang Kevin Wang wrote:
> Date: Mon, 15 Apr 2002 17:27:20 +1200 (NZST)
> From: Ko-Kang Kevin Wang <kwan022 at stat1.stat.auckland.ac.nz>
> To: R Help <r-help at stat.math.ethz.ch>
> Subject:
2002 May 06
4
Subtitle?
Hi,
Is it possible to add a subtitle that appears directly below the main
title?
I tried the "sub" parameter, but it adds sub-title to the bottom of the
plot.
Cheers,
Kevin
------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand
Homepage:
2002 May 18
5
Length of a string
Hi,
Suppose I have created something like this in R:
foo <- "myfoo"
and I want to find out the number of character in foo (in other words, R
should return 5 since "myfoo" has 5 charactors.
How can I do it? I tried:
length(foo)
but it returned 1.
Cheers,
Kevin
------------------------------------------------------------------------------
Ko-Kang Kevin Wang
2002 Nov 15
1
postscript()
Hi,
I've been trying out postscript() when onefile is set to FALSE. However
I'm having trouble understanding the documentation for postscript().
Suppose I want to do:
plot(1:10)
plot(1:10, type = "l")
and store them in foo.ps and goo.ps. Furthermore, I'd like to do then
with one postscript() command -- because this is just a simplified version
of what I really need
2002 Sep 18
2
More on list to data frame (was: Re: List to Data Frame
Hi,
Now suppose I have just one list called FOO, which has 25 objects, e.g.:
[[1]]
1 2 3 4 5
[[2]]
6 7 8 9 10
.
.
.
And I want to do something like:
FRED <- data.frame(cbind(unlist(FOO[[1]]),
unlist(FOO[[2]]),
# ... for all 25 subsets
))
Is it possible to do this, without doing unlist(FOO[[i]]) 25
2002 Sep 23
4
Overall Title in par(mfrow)
Hi,
Say I did something like:
par(mfrow = c(1, 2))
plot(1:10)
plot(1:10)
and I'd like to have an overall title, i.e. a title that would appear,
centered, on the top of both plots, rather than the top of the last plot.
I tried:
title("FOO", outer = T)
but it doesn't appear right. Half of the FOO is outside the figure region
and can't be seen...
Is there another
2002 May 10
1
barplot()
Hi,
Is it possible to draw barplot with x-axis being shown? I looked up the
help file and I couldn't seem to find it.
For example, I tried to do
x <- 1:9
p <- log10(1 + 1/x)
barplot(p, xlab = "Digit d", ylab = "Probability",
ylim = c(0, 0.35), axes = F,
main = "Benford's Law Probability")
axis(1, 1:9)
axis(2, seq(0, 0.35, by = 0.05),
2002 Jun 08
2
More on for() Loop...
Hi,
Say I want to do something like fitting 10 different sized trees with
rpart() function. The only modification I need to do is to set 10
different cp's, which I have in a vector called foo.
Can I do something like:
for(i in 1:10) {
rpart(y ~ ., cp = foo[i], data = mydata)
}
My problem is, I wish to save the 10 rpart objects into 10 different
names, my.rpart1 ~ my.rpart10, for
2002 Sep 27
3
xtable()
Hi,
Does anyone know how to manually configure the number of digits printed
out from xtable()?
For example, I'm exporting a data frame through xtable() into a LaTeX
table, I only have two columns in the data frame so by default I only get
two decimal places. But I'd like at least 5 decimal places.
I had a look at ?xtable() but can't seem to find an example.
Cheers,
Kevin
2002 Sep 24
4
print(), paste()
Hi,
Suppose I have the following lines at the end of a function:
answer <- c(2, 1, 0, 4, 5) # In fact, answer will be generate in my
# function
print(answer) # Print the answer
# Now, find the best fitted n degree polynomial
print(paste("The best fit is with", which.min(answer) - 1,
"-degree polynomial"))
this will return:
2002 Sep 19
2
Rounding
Hi,
Suppose I have:
459
1789
23590
and I'd like to round them to:
400
1700
24000
On the other hand, say if I have:
232
1234
23120
that need to be rounded to:
300
1300
24000
I tried the round(), floor() or ceiling() and can't get what I want. Is
there any tricks I can use to achieve this goal?
Cheers,
Kevin
2002 Apr 09
1
Fortran (77) in R
Hi,
I'm learning Fortran and trying to load a Fortran subroutine into R.
I've done:
R SHLIB Fibonacci.f
and it compiled fine.
Then I went into R and done:
> dyn.load("Fibonacci.so")
> Fib <- function(n) {
+ .Fortran("Fibonacci",
+ as.integer(n))[[1]]
+ }
> Fib(5)
Error in .Fortran("Fibonacci", as.integer(n)) :
2002 Sep 19
2
R 1.6 for windows?
On Thu, 19 Sep 2002 10:43:01 -0400 (EDT), you wrote in message
<200209191443.KAA17404@falmouth.bwh.harvard.edu>:
>Hi Duncan -- I am curious as to whether you are building/distributing
>R 1.6.0 for windows? There's nothing urgent about it, I have one.
>The question is how to identify a distribution URL if one exists.
I will be building and distributing the final release.
2002 Feb 04
1
row.names in read.table()
Hi,
I was trying to read in the following data set by using:
gas <- read.table("gas.tab", header = T)
when I got the error message:
Error in "row.names<-.data.frame"(*tmp*, value = row.names) :
duplicate row.names are not allowed
Any help are appreciated.
Thanks,
Ko-Kang Wang
2002 Oct 01
1
Cleveland's Cut-and-Stack Plot
Hi,
Is there a function in R that does Cleveland's Cut-and-Stack plot (Page
190 -- 191, The Elements of Graphing Data, William S. Cleveland)?
Or do I need to do it the hard way, i.e. set par(mfrow = c(m, n)) then do
it one-by-one?
(I have a time series data set that is almost identical to the description
in Cleveland's book, hence I'm interested in trying the Cut-and-Stack
plot)
2002 Nov 06
2
Re: some questions!
Hi,
I'm also cc'ing it to r-help.
On Wed, 6 Nov 2002, Kenneth Cabrera wrote:
> Date: Wed, 06 Nov 2002 10:09:21 -0500
> From: Kenneth Cabrera <krcabrer at perseus.unalmed.edu.co>
> To: kwan022 at stat.auckland.ac.nz
> Subject: some questions!
>
> Hello Dear Ko-Kang Wang:
>
> I am trying to compile R v 1.6.1 .
>
> I am following the
2002 Sep 10
9
R 1.6.0 beta
R 1.6.0 has gone into final feature freeze as of today.
As a new feature, we'll make interim beta versions available via
ftp://cran.us.r-project.org/pub/R/src/base
alias
http://cran.us.r-project.org/src/base
(filename R-1.6.0beta_*.tar.gz, where * is the creation date).
If you want to help ensure that the final 1.6.0 works satisfactorily
on *your* platform, it might be a good idea to
2002 May 25
2
Ploting in for() loop
Hi,
Suppose I have a for() loop that draws 6 boxplots as follows:
par(mfrow = c(2, 3))
for(i in 2:length(spam.sample)) {
boxplot(split(spam.sample[,i], yesno))
}
Where spam.sample is a data frame with 7 columns, and I'm interested in
plotting column 2 ~ 7 against column 1 (yesno).
The boxplots appeared fine, however I'm trying to add a meaningful title,
x and y labels to them.
2002 Feb 11
2
Time Series ts() Objects
Hi,
Is it possible to create a ts() object, whose data is daily based BUT
measured only on working days?
In other words, suppose I have a data set with 255 observations, measured
from 29 June 1959 to 30 June 1960. How would I create such a data? I
tried something like:
ts(c(...), start(1959, 180))
but I'm not sure what to use for frequency. In other words I don't know
how to
2002 Oct 09
3
Multiplication of Matrices
Hi,
Suppose I have a matrix, A. Is there an easy way to find A^{n}?
I mean, I can do something like:
A %*% A %*% A %*% A
for A^4, but if I want A^{10} it would be kind of annoying...
Cheers,
Kevin
------------------------------------------------------------------------------
Ko-Kang Kevin Wang
Postgraduate PGDipSci Student
Department of Statistics
University of Auckland
New Zealand