Re: [R] R: regression data set

2005-08-02 Thread Kevin Wang
Clark Allan wrote:

 i would like to give the class a practical assignment as well. could you
 suggest a good problem and the location of the data set/s?
 
 it would be good if the data set has been analysed by a number of other
 people so that students can see the different ways of tackling a
 regression problem. 

If you want some textbook examples I'd recommend
Ripley and Venables's  Modern Applied Statistics With S (VR bundle);

Maindonald and Braun's Data Analysis and Graphics using R (DAAG package)

Cheers,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] xtable Questions

2004-09-01 Thread Kevin Wang
Hi,
These are two problems I've never seen when I used xtable() before...
R 1.9.1 for Windows XP, xtable version 1.2-3:
   final.df
  Loci ChrMarker Position P.values Deviance DF
  1   Idd5   1  D1Mit181 42.6   0.0011   103.21 78
  2 Idd6/19/20   6  D6Mit374 66.7   0.0014   104.29 78
  3  Idd13   2  D2Mit490 64.5   0.002597.83 78
  4Idd8/12  13 D14Mit109   24   0.0244   102.41 78
  5  Idd14  14  D13Mit39  3.3   0.037995.92 78
  6  Idd3/10/17/18   3  D3Mit257 49.20.068   105.45 78
  7   Idd9   4  D4Mit233 69.9   0.1406   107.13 78
  8  Idd15   5  D5Mit338 43.7   0.2196   107.67 78
  9   Idd7   7  D7Mit101 45.9   0.460895.96 78
  10  Idd2   9  D9Mit328 17.5   0.5125   107.25 78
  11  Aire  10 D10Mit198 33.9   0.6457   106.13 78
  12  Idd4  11 D11Mit298 37.2   0.9261   107.47 78
  13 Idd21  18 D18Mit135  9.8   0.9272   107.67 78
   xtable(final.df,
  +caption = Summary for each Locus,
  +label = tab:sumLocus)
  Error in x + ifelse(x == 0, 1, 0) : non-numeric argument to binary 
operator
   is.data.frame(final.df)
  [1] TRUE

final.df is a data frame, but I cannot understand what the error message 
means about non-numeric argument to binary operator.

The other problem is:
   one.df
   Loci P.values
  1Idd5   0.1147
  2   Idd13   0.0085
  3   Idd140.002
  4 Idd8.120.042
  5Idd7   0.0114
   xtable(one.df,
  +caption = Fitting without Interactions,
  +label = tab:noI)
  tab:noI
  % latex table generated in R 1.9.1 by xtable 1.2-3 package
  % Thu Sep 02 14:22:01 2004
  \begin{table}[ht]
  \begin{center}
  \begin{tabular}{rll}
  \hline
Loci  P.values \\
  \hline
  1 Idd5  0.1147 \\
  2Idd13  0.0085 \\
  3Idd14   0.002 \\
  4  Idd8.12   0.042 \\
  5 Idd7  0.0114 \\
  \hline
  \end{tabular}
  \caption{Fitting without Interactions}
  \end{center}
  \end{table}
   is.data.frame(one.df)
  [1] TRUE
I want to give the resulting LaTeX markup for one.df a label, namely 
tab:noI, but instead of putting a \label{tab:noI}, it just put 
tab:noI at the beginning of the output.

I've tried to completely clear the workspace, delete the .RData and 
start fresh.  But the problems still occur *_*.

Any help would be appreciated!
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] [OT]Example Data for Non-statisticians

2004-09-02 Thread Kevin Wang
(Sorry for the slightly off topic post)

I'm giving a talk (on data mining) to some non-statisticians (who're
all postgrad students, but a mixture of Science and Commerce majors).

My intention is to show them the importance of statistics when doing
data mining.  What I'm thinking of doing is using, hopefully, two
datasets.  One from scientific area and another that is
commercially-related.  However, it would be nice if the datasets (or
at least one of them) will violate some kind of basic statistical
assumptions (in its raw form anyway) -- hence showing having a basic
statistical knowledge is important.  Also hopefully, I can introduce R
to them (since many of them haven't heard of it yet).

Does anyone have (or know where I can get) such data?  It doesn't have
to be huge,.

Thanks!

Kevin

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Two xtable Questions

2004-09-02 Thread Kevin Wang
Hi,

These are two problems I've never seen when I used xtable() before...

R 1.9.1 for Windows XP, xtable version 1.2-3:
   final.df
  Loci ChrMarker Position P.values Deviance DF
  1   Idd5   1  D1Mit181 42.6   0.0011   103.21 78
  2 Idd6/19/20   6  D6Mit374 66.7   0.0014   104.29 78
  3  Idd13   2  D2Mit490 64.5   0.002597.83 78
  4Idd8/12  13 D14Mit109   24   0.0244   102.41 78
  5  Idd14  14  D13Mit39  3.3   0.037995.92 78
  6  Idd3/10/17/18   3  D3Mit257 49.20.068   105.45 78
  7   Idd9   4  D4Mit233 69.9   0.1406   107.13 78
  8  Idd15   5  D5Mit338 43.7   0.2196   107.67 78
  9   Idd7   7  D7Mit101 45.9   0.460895.96 78
  10  Idd2   9  D9Mit328 17.5   0.5125   107.25 78
  11  Aire  10 D10Mit198 33.9   0.6457   106.13 78
  12  Idd4  11 D11Mit298 37.2   0.9261   107.47 78
  13 Idd21  18 D18Mit135  9.8   0.9272   107.67 78
   xtable(final.df,
  +caption = Summary for each Locus,
  +label = tab:sumLocus)
  Error in x + ifelse(x == 0, 1, 0) : non-numeric argument to binary
operator
   is.data.frame(final.df)
  [1] TRUE

final.df is a data frame, but I cannot understand what the error message
means about non-numeric argument to binary operator.

The other problem is:
   one.df
   Loci P.values
  1Idd5   0.1147
  2   Idd13   0.0085
  3   Idd140.002
  4 Idd8.120.042
  5Idd7   0.0114
   xtable(one.df,
  +caption = Fitting without Interactions,
  +label = tab:noI)
  tab:noI
  % latex table generated in R 1.9.1 by xtable 1.2-3 package
  % Thu Sep 02 14:22:01 2004
  \begin{table}[ht]
  \begin{center}
  \begin{tabular}{rll}
  \hline
Loci  P.values \\
  \hline
  1 Idd5  0.1147 \\
  2Idd13  0.0085 \\
  3Idd14   0.002 \\
  4  Idd8.12   0.042 \\
  5 Idd7  0.0114 \\
  \hline
  \end{tabular}
  \caption{Fitting without Interactions}
  \end{center}
  \end{table}
   is.data.frame(one.df)
  [1] TRUE

I want to give the resulting LaTeX markup for one.df a label, namely
tab:noI, but instead of putting a \label{tab:noI}, it just put tab:noI
at the beginning of the output.

I've tried to completely clear the workspace, delete the .RData and start
fresh.  But the problems still occur *_*.

Any help would be appreciated!

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] newsgroup on R

2004-09-02 Thread Kevin Wang
Hi,

On Thu, 2 Sep 2004, Bin Jiang wrote:

 HI, I wonder if there is a newsgroup on R available, instead of
 emaillist which I have to receive mails daily.

AFAIK the answer is no.  I think this has been brought up and discussed a
few years ago and the idea was kind of...rejected.

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] a little question about R

2004-09-07 Thread Kevin Wang
Hi,

On Wed, 8 Sep 2004, [gb2312] ÃÏÐÀ wrote:

 Hello,sir: Here's a little question about R which needs your help.Thanks in advance.
 If I wanna make a sequence just like a,b,c,d (In other words,a vector consists of 4 
 characters :a,b,c,d ).How can I do it in a shortcut manner? Yes,I can do it as 
 following: c(a,b,c,d) and the result is:[1] a b c d.
 But I remember there's a shortcut manner to do the same thing,something like

How about
  letters[1:4]



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] download of 1.9.1

2004-09-07 Thread Kevin Wang
Hi,

On Tue, 7 Sep 2004, Kathy DeRiemer wrote:

 Hi there,

 I downloaded version 1.9.1 WinZip file, 9.367 bytes ( so I can update my R

Uit doesn't sound right, 9 bytes

 and use the vcd package) but cannot get the download from your Web site to
 unzip and install.  So silly!

 The error message is : Error reading header after processing 0
 entries.  I tried downloading from 3 different URLs, all yielding the same
 message when I try to unzip and install the file.

Well, since you mentioned WinZip I'm assuming you are using R under
Windows.  IN which case why don't you update the package from Rgui using
the menu?  See the FAQ...

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] howto load functions?

2004-09-08 Thread Kevin Wang
Hi,
Loren Grimes wrote:
I realize that this is pretty basic, and I should be able to figure this out: but, how do I write a function [with a text editor] and then load it into an interactive R session?  

Thanks
Try ?source
HTH,
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Newbie q. need some help understanding this code.

2004-09-15 Thread Kevin Wang
Hi,
sean kim wrote:
thanks for any insights or other comments. 
I would suggest that you run the code line by line, to see what it does 
yourself.  It is the best way to learn!

library(stepfun)
This just loads the package stepfun.
lv - function(N=1000,cvec=c(1,0.005,0.6),x=c(50,100))
{
Declaration of a function named lv, where N, cvec and x are the 
parameters/arguments with default values.

m-length(cvec)
m is a new variable, with in this case is just a number, the length of 
the vector cvec.  In this case, 3.

n-length(x)
Ditto.
xmat-matrix(nrow=N+1,ncol=n)
Generate a matrix with N + 1 (1001) rows and  n columns.
tvec-vector(numeric,N)
h-vector(numeric,m)
Generating two vectors.
t-0
xmat[1,]-x
Assign x to the first row of the xmat matrix.
for (i in 1:N) {
h[1]-cvec[1]*x[1]
The first element in cvec and x, multiply them together and the result 
becomes the first element of h.

h[2]-cvec[2]*x[1]*x[2]
h[3]-cvec[3]*x[2]
Ditto.
h0=sum(h)
Get the sum of h.
tp-rexp(1,h0)
Generating an exponential random number with a rate of h0.
t-t+tp
u-runif(1,0,1)
Generating a uniform random number, [0, 1]
if ( u  h[1]/h0 ) {
x[1] - x[1]+1
If the uniform random number, u, is smaller than h[1]/h0 then do...
otherwise do the following...
} else if ( u  (h[1]+h[2])/h0 ) {
x[1] - x[1]-1
x[2] - x[2]+1
} else {
x[2] - x[2]-1
}
xmat[i+1,]-x
Increment to the next row.
tvec[i]-t
}
   
list(stepfun(tvec,xmat[,1]),stepfun(tvec,xmat[,2]))
}
Put things together into a list.
Again, check these line by line and you'll have a better understanding!
Kev
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] sapply() with cat()

2004-09-15 Thread Kevin Wang
Hi,
Suppose I've got a data frame:
   inter.df
  V1  V2  V3  V4  V5  V6  V7  V8  V9 V10 V11 V12
  1  3.3  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
  2  0.0 0.1  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
  3  1.0 0.9 0.2  NA  NA  NA  NA  NA  NA  NA  NA  NA
  4  1.6 0.0 2.9 0.7  NA  NA  NA  NA  NA  NA  NA  NA
  5  0.0 0.1 2.9 0.1 0.1  NA  NA  NA  NA  NA  NA  NA
  6  2.4 1.0 0.6 0.4 1.9 0.1  NA  NA  NA  NA  NA  NA
  7  2.8 1.4 1.2 7.5 0.0 0.0 4.2  NA  NA  NA  NA  NA
  8  0.3 3.1 0.8 3.7 5.7 0.0 0.8 0.0  NA  NA  NA  NA
  9  0.1 2.9 0.3 1.3 0.2 0.2 0.5 1.4 0.9  NA  NA  NA
  10 0.8 2.6 0.0 0.0 0.1 4.1 0.8 4.3 0.6 2.2  NA  NA
  11 0.0 4.0 0.0 0.3 0.5 0.9 0.0 1.5 0.2 0.7 0.8  NA
  12 0.6 0.8 0.3 0.0 0.2 1.2 0.0 0.8 1.5 0.9 0.4   0
  
   foo - function(x) {
  +   ifelse(x  3.8, NA, x)
  + }
   sapply(inter.df, foo)
 V1  V2  V3  V4  V5  V6  V7  V8  V9 V10 V11 V12
   [1,] 3.3  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
   [2,] 0.0 0.1  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
   [3,] 1.0 0.9 0.2  NA  NA  NA  NA  NA  NA  NA  NA  NA
   [4,] 1.6 0.0 2.9 0.7  NA  NA  NA  NA  NA  NA  NA  NA
   [5,] 0.0 0.1 2.9 0.1 0.1  NA  NA  NA  NA  NA  NA  NA
   [6,] 2.4 1.0 0.6 0.4 1.9 0.1  NA  NA  NA  NA  NA  NA
   [7,] 2.8 1.4 1.2  NA 0.0 0.0  NA  NA  NA  NA  NA  NA
   [8,] 0.3 3.1 0.8 3.7  NA 0.0 0.8 0.0  NA  NA  NA  NA
   [9,] 0.1 2.9 0.3 1.3 0.2 0.2 0.5 1.4 0.9  NA  NA  NA
  [10,] 0.8 2.6 0.0 0.0 0.1  NA 0.8  NA 0.6 2.2  NA  NA
  [11,] 0.0  NA 0.0 0.3 0.5 0.9 0.0 1.5 0.2 0.7 0.8  NA
  [12,] 0.6 0.8 0.3 0.0 0.2 1.2 0.0 0.8 1.5 0.9 0.4   0
Up to here, sapply() does what I want, replacing values that are greater 
than 3.8 to NA, as per my foo() function.  But...

   goo - function(x) {
  +   ifelse(x  3.8, cat(\\textbf{, x, }, sep = ), x)
  + }
   sapply(inter.df, goo)
  \textbf{NA0.10.900.111.43.12.92.640.8}Error in [-(`*tmp*`, test, 
value = rep(yes, length.out = length(ans))[test]) :
  incompatible types

If instead whenever I get a value that's greater than 3.8 I want to 
change it what goo() does, e.g. the value 4.0 should become:
  \textbf{4.0}
but I got the above error.

What I'm intending is to then pass the inter.df (with the \textbf{} 
markups) into xtable() so the values will be bolded in the resulting 
LaTeX table (as so far, I cannot see how I can achieve bolding only 
certain numbers with xtable() alone).

Any suggestions will be welcome!
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Using eval() more efficiently?

2004-09-19 Thread Kevin Wang
Hi,

Suppose I have a vector:
   names.select
  [1] Idd13   Idd14   Idd8.12 Idd7
automatically generated by some selection criteria.

Now, if I have a data frame with many variables, of which the variables in
names.select are also variables from the data frame.  e.g.
   all.df[1:5,]
Mouse Idd5 Idd6.19.20 Idd13 Idd14 Idd8.12 Idd3.10.17.18 Idd9
  1   904   F1NOD   NODF1 NODF1  NOD
  2   934  NOD F1F1F1  F1   NOD  NOD
  3   950  NODNODF1   NOD  F1F1  NOD
  4   977   F1NOD   NODF1  F1F1   F1
  5  1050   F1 F1   NOD   NOD NOD   NOD   F1
Idd15 Idd7 Idd2 Aire Idd4 Idd21 Cross
  1F1  NOD  NOD  NOD  NOD   NOD 1
  2   NOD  NOD   F1   F1  NODF1 1
  3   NOD  NOD   F1   F1  NOD   NOD 1
  4   NOD   F1  NOD  NOD  NOD   NOD 1
  5   NOD   F1   F1   F1  NODF1 1

If I want to use the information from names.select to fit a glm() on
Cross, I can do something like:
one.glm2 - glm(eval(substitute(Cross ~ x1 + x2 + x3 + x4,
  +   list(x1 = as.name(names.select[1]),
  +x2 = as.name(names.select[2]),
  +x3 = as.name(names.select[3]),
  +x4 =
as.name(names.select[4],
  +data = all.df, family = binomial)
which does exactly what I want.

However, this is kind of inefficient as if my selection criteria change,
the variables being selected in names.select may change and it will make
my eval() from one.glm2 invalid.

Is there a way to solve this?  e.g. if names.select has got 5 elements
then I'd want to fit something like:
  one.glm2 - glm(eval(substitute(Cross ~ x1 + x2 + x3 + x4 + x5,
  list(x1 = as.name(names.select[1]),
   x2 = as.name(names.select[2]),
   x3 = as.name(names.select[3]),
   x4 = as.name(names.select[4]),
   x5 = as.name(names.select[5],
  data = all.df, family = binomial)

(What I'm doing is writing a function which let's the user determine a
selection criteria, hence names.select will be unknown -- and so far I'm
very puzzled about how I can then use the information in names.select into
my one.glm2...*_*.

Cheers,

Kevin



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] multinomial logistic regression

2004-09-22 Thread Kevin Wang
array chip wrote:
I think glm() can only handle binary response
variable, 
That's not true, have you looked at ?glm and ?family ?
HTH,
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A question in R

2004-10-12 Thread Kevin Wang
Hi,

On Tue, 12 Oct 2004, Kevin Bartz wrote:

 R looks less than fondly on Excel files. The easiest solution for you
 will be to export your Excel file to a tab-delimited text format (Save
 - (.txt) Tab-delimited Text), and then use read.delim as you did. Does
 that make sense?

The alternative (tricky but more convinient in the long run) is to use the
read.xls() function from gregmisc bundle.

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] (no subject)

2004-09-28 Thread Kevin Wang
Hi,

On Tue, 28 Sep 2004, YiYao_Jiang wrote:

 Hello everybody:

 I can't setup a library for some functions.
 Can anybody kindly give me an example about setup a library. From build a package to 
 library.

I am guessing you meant you want to compile a package from source?  Have
you looked at Writing R Extensions?

HTH,

Kevin



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Retrieving objects from functions...

2004-09-30 Thread Kevin Wang
Hi,

On Thu, 30 Sep 2004, Jonathan Harris wrote:

 I've written a program that involves a loop that creates a matrix. I'd
 like to be able to manipulate that matrix on my R desktop, but after I
 run the function, that matrix does not appear when I type ls(). How can
 I make that matrix become an object that I can manipulate?

If I understand you right, you want something like:
  foo - function() {
 goo - matrix(1:10, nrow = 5, ncol = 2)
  }
then be able to call goo after running foo()?  If this is what you want,
then you need to do something like:
  foo - function() {
 goo - matrix(1:10, nrow = 5, ncol = 2)
  }
to force goo to become a global variable, instead of a local variable to
foo().

HTH,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Excluding data in R

2004-10-03 Thread Kevin Wang
Hi,

On Sun, 3 Oct 2004, Laura Collins wrote:

 How do you exclude outliers from a set of data?

Your question is too vague.  I'm assuming you have a data frame and
already know exactly which observations are the outlier(s).  If your data
frame is called foo.df, and say observation 5 is an outlier, then
something like:
  foo.df[-5, ]
will exclude it.

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Re:How to create a R -application

2004-10-07 Thread Kevin Wang
Hi,

On Thu, 7 Oct 2004, Kunal Shetty wrote:

 Example for calculating the mean of  a data set

 x - c(8,11,16,18,6,4,20,25,9,13)
 u - mean(x)
 u

R is an interpreted language, not a compiled one like C++ or Java.
Therefore you don't compile it.  And for such a simple example, there
isn't much need in doing so.

However, compilation may come in handy when you are running simulations
and/or with some long loops, as interpreted languages aren't really good
at handling loops -- although you can get around with many loops by
vectorisation.  I think Luke Tierney is working on an R Compiler, which
will allow you to compile such simulation and will decrease the running
time a lot...but I'm not sure when it will be released.

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] library gregmisc

2004-10-25 Thread Kevin Wang
Hi,

On Mon, 25 Oct 2004, Anna Maria Paganoni wrote:

 I write to ask you an help about the package gregmisc.
 I saw the instructions, and I need some functionalities of this package,
 but I am unable ti download it.
 On friday I was able to download thte .zip, but R does not install this
 package, today there is no possibility to download it.

What do you mean R doesn't install the bundle?  How did you try to install
it?

Kev



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Finding out the number of times a loop has run

2004-11-04 Thread Kevin Wang
Hi,

Suppose I have:
  for(i in 1:10)
 rnorm(10)
(just a fake example, as my actual example is too long)

Is it possible to get the loop to print out i each time it has run?
Something like:
  for(i in 1:10) {
 print(i)
 rnorm(10)
  }
will only print i after the loop is completed.  But if I want to print out
i whenever it re-enters the loop, is it possible (so I know how many times
the loop has been run)?

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Finding out the number of times a loop has run

2004-11-04 Thread Kevin Wang
Hi,

On Thu, 4 Nov 2004, Peter Dalgaard wrote:

 Kevin, you must have seen this on the list before! Either use
 flush.console() or turn off the output buffering (Windows FAQ 6.3).

Whoopsssorry, I must be tiredneed another cup of coffee.

Kev


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] SAS or R software

2004-11-20 Thread Kevin Wang
Hi,

On Sat, 20 Nov 2004, neela v wrote:

 Hi all there

 Can some one clarify me on this issue, features wise which is better R or 
 SAS, leaving the commerical aspect associated with it. I suppose there are 
 few people who have worked on both R and SAS and wish they would be able to 
 help me in deciding on this.

R is THE one to use when it comes to graphics.  So far, I haven't seen any
other software that can produce better graphs (and I've used SAS, Minitab,
Excel, Genstat...etc).  It's programming feature, IMHO, is also neater
than SAS's procedure-oriented programming.

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] classification using logistic regression

2004-12-27 Thread Kevin Wang
Hi,

On Mon, 27 Dec 2004, Rajdeep Das wrote:

 I would like to do classification using logistic regression. Which R package 
 can I use?

Have you tried glm() function?

 Also is there any package for feature selection for logistic regression based 
 method?

Do you mean model selection methods like forward selection?  If so, try
step()

HTH,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] (no subject)

2005-01-12 Thread Kevin Wang
Hi,

On Wed, 12 Jan 2005, Bigby wrote:

 Hello,

 numerical.summary(Data), which didnt work, he suggested we try library(s20x)
 first, which came up with an error on my console. I have version 2.0.1 of R

library(s20x) is a package written by the Department of Statistics at the
University of Auckland.  It is used for their STATS 201/208 courses.  It
is not on CRAN.  You may need to contact them for it.

But you can get most of it using other commands.  From memory it simply
combines several other R functions, such as summary(), quantile()...etc.

HTH,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Barplot - Can't figure it out

2005-02-17 Thread Kevin Wang
Hi,
T Petersen wrote:
Hi,
I have two catagorical vectors like this;
x = c(1, 2, 4, 2, 1)
y = c(2, 4, 2 ,4, 1)
I want to set up a barplot with the catagories 1-4 horizontally  and 
number of occurances vertically for each vector x,y. I've tried

boxplot(table(x,y), beside=T)
and
boxplot(c(x,y), beside=T)
Have you tried barplot(), instead of boxplot()???
Cheers,
Kev
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] text editor for R

2004-07-07 Thread Kevin Wang
Hi,

 Uwe would be the authority on this 8-), but my impression is that if you
 keep two separate shortcuts, you should be fine.  The one for R-WinEdt has
 flags that sets it up for R, which should not be used in the one for MikTeX.

I think Andy is correct.  A few years ago (back in the dark ages -- before
I discovered Emacs/ESS), I had two short cuts, one calls R-WinEdt (i.e.
with flags...etc) and the other with just a normal WinEdt icon.

However, I *think* now you can interact R-WinEdt within R directly (I
tried the new version about 2 ~ 3 months ago just for fun, and that seemed
to be the case, but I can't quite remember *_*).

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7411
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Importing an Excel file

2004-07-08 Thread Kevin Wang
Hi,

On Thu, 8 Jul 2004, [iso-8859-1] Vito Ricci wrote:

 Hi,
 I'm trying to use read.xls() function to import Excel
 data, but I've this error:

 Error in system(cmd, intern = !verbose) : perl not
 found

 What happens?

It means it cannot find Perl.  You need Perl installed (and in your Path)
in your system.

Kev


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7411
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to pass strings to functions?

2004-07-08 Thread Kevin Wang
Please do not use the subject to ask a question without clarifying it!

So what exactly do you want?  Can you give some more descriptions?

Kev


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7411
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Can R work on very large of data?

2004-07-21 Thread Kevin Wang
Hi
On Wed, 21 Jul 2004, Hayashi Soichi - shayas wrote:

 Is there anyway I can tweak R around so that it will start processing as
 data comes and not load everthing on memory at once? The reason for this is

Have you read through R Data Import/Export?

There are several other ways, to name a few: scan() and RODBC -- I haven't
used the later though.

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7411
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] calibration/validation sets

2004-08-14 Thread Kevin Wang
Hi,

On Sat, 14 Aug 2004, Peyuco Porras Porras . wrote:

 Hi;
 Does anyone know how to create a calibration and validation set from a particular 
 dataset? I have a dataframe with nearly 20,000 rows! and I would like to select 
 (randomly) a subset from the original dataset (...I found how to do that) to use as 
 calibration set. However, I don't know how to remove this calibration set from the 
 original dataframe in order to get my validation set.Any hint will be greatly 
 appreciated.

A really quick way, suppose you want to have 30% of your dataset as the
validation set:
 iris.id = sample(nrow(iris), nrow(iris) * 0.3)
 iris.valid = iris[iris.id, ]
 iris.train = iris[-iris.id, ]
 nrow(iris.valid)
[1] 45
 nrow(iris.train)
[1] 105

The first line takes a sample of 30% of the number of rows in the Iris
data.  The second line does a subetting of those samples -- the validation
set.  The third takes what's left -- the training set.  This is perhaps
not efficient and the code can definitely be simplified...but it's Sunday
morning and I haven't had my morning coffee yet :D

Cheers,

Kevin



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plot.table on R 1.9.1

2004-08-16 Thread Kevin Wang
Hi,

On Mon, 16 Aug 2004, Meinhard GMX wrote:

 Hello!
 What is wrong on my system?
 I have downloaded today R 1.9.1 on my PC with Windows.

 plot.table isn't available in package base and neither in package graphics (as 
 suggested after ?plot.table).

You should not use plot.table.  Use plot(x) where x is of table object and
it should work.

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding sem to a plot

2004-08-16 Thread Kevin Wang
Hi,

On Mon, 16 Aug 2004, Luis Rideau Cruz wrote:

 R-help,

 I have a barplot and I wish to add standard erros (or deviations) bars to it.
 How?

Marc Schwartz has an article on this in R News 3/2 (October 2003).

HTH,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How do I add rows to a table?

2004-08-18 Thread Kevin Wang
Hi,

On Wed, 18 Aug 2004, Beverly Seavey wrote:

 inp1 - scan(data1,list(0,0))
 inp2 - scan(data2,list(0,0))

 allInp - c(inp1,inp2)

  I get a table with 4 columns.

If I understand you correctly...

Have you tried cbind()?

Cheers,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to extract data from excel sheet?

2004-08-19 Thread Kevin Wang
Hi,

Take a look at read.xls() from gregmisc package.

HTH,

Kevin
On Thu, 19 Aug 2004, Sivan Aldor wrote:

 i want to upload different sheets from one excel file.
 does anyone know of a way to do so? (i use read.csv to load the excel but
 i would like to load form the sheets themselves.)
 thanks
 sivan

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R and Latex tables

2004-08-25 Thread Kevin Wang
Hi,

On Wed, 25 Aug 2004, Joao Pedro W. de Azevedo wrote:

 Dear R users,
 I would like to know if there is any way that I can aumatically generate
 *.tex files with the output of my estimations from R.

Take a look at the xtable package.

HTH,

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Help using Hmisc / Latex

2004-08-25 Thread Kevin Wang
Hi,

On Wed, 25 Aug 2004, Joao Pedro W. de Azevedo wrote:

 ## Annette Dobson (1990) An Introduction to Generalized Linear Models.
 ## Page 9: Plant Weight Data.
 summary(lm.D90 - lm(weight ~ group - 1))# omitting intercept
 out  - latex(lm.D90)
 latex(out, model1, file=)

 When I run this code, I get an output which does not attend my needs.

Just out of interest, have you read the documentation for latex()?

Kevin


Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Order with scientific notations

2004-08-25 Thread Kevin Wang
Hi,
If a value like 8e-04 is in a data frame, is the following behaviour normal?
   final.df
 Chr P.values
  11   0.0379
  260.068
  32   0.0025
  4   138e-04
  5   14   0.0244
  63   0.0279
  74   0.1561
  85   0.9261
  97   0.0011
  10   9   0.5125
  11  10   0.2196
  12  11   0.6457
  13  18   0.9272
   final.sorted - data.frame(final.df[order(final.df$P.values), ],
  +row.names = 1:13)
   final.sorted
 Chr P.values
  17   0.0011
  22   0.0025
  3   14   0.0244
  43   0.0279
  51   0.0379
  660.068
  74   0.1561
  8   10   0.2196
  99   0.5125
  10  11   0.6457
  11   5   0.9261
  12  18   0.9272
  13  138e-04
I'd think 8e-04 should be the smallest value...?  It's R 1.9.1 on 
Windows XP if that helps.

Cheers,
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] read.spss trouble

2005-05-28 Thread Kevin Wang

Hi Martin,

Martin Klaffenboeck wrote:

Hello!

I'm not sure if this is an german list, so I will post in english.


It's an English list.


I'm using R on my gentoo linux and now I got an spss .sav file.  I found
that r has a function like read.spss(file.sav) but when I try this I
get the Error: couldn't find function read.spss.  Can anyone tell me
what's going wrong?


It's in the package foreign.  Try:
  library(foreign)

HTH,

Kevin

--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Reference Card?

2005-05-30 Thread Kevin Wang

Hi,

Have you tried looking under Documentation - Contributed, under CRAN?

Kev

Martin Klaffenboeck wrote:

Hello!

For LaTeX I found a reference Card at
http://www.cs.ualberta.ca/~c603/LaTeX_docs/Symbol_Source/latex_symbols.pdf

Is there something available for R?

thanks,
Martin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] emacs

2005-06-01 Thread Kevin Wang

Hi,

Check out the ESS site, http://stat.ethz.ch/ESS/

Cheers,

Kev


Flatman wrote:

hi !

is there an emacs mode for .r code ?

thanks
erik

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Finding out collinearity in regression

2005-06-29 Thread Kevin Wang
Hi,

Young Cho wrote:

 fit - aov( Y ~ . , data = dat)
 Error in contrasts-(`*tmp*`, value =
 contr.treatment) :
 contrasts can be applied only to factors with
 2 or more levels
 
 I think there is a dependency in explanatory
 variables. So, I wanted to use alias to find out a
 dependency in design matrix but I can't because I
 cannot create fit in the first place.

The error message actually looks like you have got (at least) a variable 
that only has 1 level, e.g. a factor with only one level.

Cheers,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] TeX distribution on Windows

2005-09-05 Thread Ko-Kang Kevin Wang
Hi,

Göran Broström wrote:

 So, what is suggested? TUG (tug.org) recommends something called proTeXt,
 which is said to be based on MiKTeX, for Windows users. Since MikTeX 
 could be used with  R, that sounds like a good alternative.
 
 Any comments to that?

I've been using MikTeX on Windows for years and have never had any 
problems.  Its Update Wizard also has a nice and intuitive user 
interface.  I've never had any problems using it with R.

Cheers,

Kev


-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7488
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] TeX distribution on Windows

2005-09-05 Thread Ko-Kang Kevin Wang
Thomas Petzoldt wrote:


 
 Miktex can be used with WinEDT, Emacs, Texniccenter and others as editor.

Slightly off topic, if you want to get MikTeX working with Emacs and 
ESS, the  Claus Dethlefsen has a wonderful web site (in fact, best 
website on this topic IMHO) http://www.math.auc.dk/~dethlef/Tips/

Cheers,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7488
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] graphics guide?

2005-09-27 Thread Ko-Kang Kevin Wang
Hi,

Karin Lagesen wrote:
 I am trying to create some graphs with R and it seems to be able to do
 what I need. However, I have so far not been able to find any sort of
 explanation of how the graphics system works. I am for instance trying
 to create a multiple figure, and I seem to have to call plot.new()
 before every new plot command, I have however not found any

Do you mean several graphs in the same window?

If so, you want something like, e.g.:
   par(mfrow = c(2, 2))

Take a look at ?par and the mfrow or mfcol options.

Cheers and HTH,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7488
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Binary Logit Regression with R

2005-09-29 Thread Ko-Kang Kevin Wang
Hi,

Johann Park wrote:

 Let say, my Y is war occurence (occur=1, otherwise 0). And my independent 
 variables (Xs) are trade, democracy, military poweretc. 

Take a look at ?glm.

HTH,

Kev

-- 
Ko-Kang Kevin Wang
PhD Student
Centre for Bioinformation Science
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 2601
Australia

Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7488
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] there is no xls reader in R?

2006-04-20 Thread Ko-Kang Kevin Wang
Have a look at the read.xls() in gdata package.

HTH,

Kevin

Michael wrote:
 Currently I have to convert all my xls into csv before I can read it in
 and process the excel data in R...
 
 Is there a way to directly read in xls data?
 
 Thanks a lot!
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Ko-Kang Kevin Wang
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7471
Ph (M): +61-40-451-8301

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] ts() objects in R

2004-05-04 Thread Ko-Kang Kevin Wang
Does anyone know why this is happening?
 diff.prop[1:5]
 1  2  3  4  5 
-0.6323988 -0.5226586 -0.5605096 -0.6656347 -0.6011561 
 ts(diff.prop, start = c(1997, 11), frequency = 1)
Time Series:
Start = 2007 
End = 2125 
Frequency = 1 
[snip]

diff.prop is a vector, I want to convert it to a time series starting from Nov 1997 on 
a monthly basis.  However when it's created it starts from 2007.  It's happening on 
both R 1.8.1 and R 1.9.0 on Windows XP Pro

Cheers,

Kevin

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] ts() objects in R

2004-05-04 Thread Ko-Kang Kevin Wang
Hi,

- Original Message - 
From: Uwe Ligges [EMAIL PROTECTED]
 
 I think you mean
 
ts(diff.prop, start = c(1997, 11), frequency = 12)

Whoops, indeed..thanks!  That was a stupid question *_*

kevin Wang

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] how to get data and post it on R

2004-05-15 Thread Ko-Kang Kevin Wang
Hi,

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of matt lindon
 Sent: Saturday, May 15, 2004 8:21 PM
 To: [EMAIL PROTECTED]
 Subject: [R] how to get data and post it on R

 Hi , i'm having  trouble getting data from outside and
 trying to do either a discrimination analysis or a
 regression analysis.I don't know what kind of data i
 need to use and also what are the packages i need to
 use.
 Please get me some direction so i can begin .

Have you tried reading the documentation?

E.g. R Data Import/Export  and the FAQs?

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] cameraa rotation graphics

2004-06-03 Thread Ko-Kang Kevin Wang
Hi,

 -Original Message-
 From: [EMAIL PROTECTED]

 Dear all,
 Is there a camera rotation for 3d graphics in R. I have seen it in a
 conference one time and thought it is pretty neat. the
 presenter was able
 to rotate the 3d graph with dragging the mouse up down left
 right. If not
 in R is there something that is open source that does this.

Do you mean Daniel Adler's rgl
(http://wsopuppenkiste.wiso.uni-goettingen.de/~dadler/) or the
Ggobi/Rggobi http://www.ggobi.org/?

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] rpart

2004-06-04 Thread Ko-Kang Kevin Wang
Hi,

I think most, if not all, your questions can be answered by:

1) ?rpart

2) Some search through the r-help mailing list

3) Read the chapter on tree-based models in MASS 4 (Modern Applied
Statistics with S) by Venables and Ripley

Kevin

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 04, 2004 9:59 PM
Subject: [R] rpart


 Hello everyone,

 I'm a newbie to R and to CART so I hope my questions don't seem too
stupid.

 1.)
 My first question concerns the rpart() method. Which method does rpart use
in
 order to get the best split - entropy impurity, Bayes error (min. error)
or Gini
 index? Is there a way to make it use the entropy impurity?

 The second and third question concern the output of the printcp()
function.
 2.)
 What exactly are the cps in that sense here? I assumed them to be the
treshold
 complexity parameters as in Breiman et al., 1998, Section 3.3? Are they
the same
 as the treshold niveaus of alpha? I have read somewhere that the cps here
are
 the  treshold alphas divided by the root node error. Is that true?

 3.)
 How is rel error computed?
 I am supposed to evaluate the goodness of classification of of the CART
method.
 Do you think rel error is a good measure for that?

 I'd be very thankful if anyone could give me hand on that. This is a
project for
 uni and I desperately need a good mark.

 Thank you very much in advance,

 Mareike

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to Describe R to Finance People

2004-06-04 Thread Ko-Kang Kevin Wang
Hi,

I've been doing a joint research with someone from the Property
Department here and she is about to give a presentation on the
results.  The audience will include people from Property and Finance,
and she is wondering how to describe R to these people (as I used R to
do the analyses), since she has never even heard of R before our joint
research (and has been using SPSS).  The difficult part is she has
only about 1 ~ 2 minutes to talk about R.

The following is what I have in mind, any suggestions from people in
Finance will be greatly appreciated!  (From our research together I
think it may be safe to assume the audience will know, or at least
have heard of, basic statistical terminology such as multiple linear
regression and dummy variables).

\begin{quote}
R was originally developed by Dr. Ross Ihaka and Dr. Robert Gentleman
from the Department of Statistics at the University of Auckland in
1992.  It is free and in the last decade it has evolved into one of
the most powerful statistical software, with over 150 user-contributed
add-on packages.  It is not only used by statisticians or scientists,
but also econometricians and people in finance due to its cost (FREE)
and its powerfulness.

Although it has a slightly higher learning curve than SPSS-like
program, it gets easier to use once one is familiar with it.  One of
the main advantage it has over SPSS-like software is that you do not
need to explicitly create dummy variables.  You only need to specify
your dependent variable and independent variables and R will fit it
(and create dummy variables automatically) for you.

It also has many state-of-art free resources, including manuals,
contributed tutorials and documentations, online.  A free mailing list
is also available for people to ask questions and questions are
usually answered by more experienced users around the world within a
few hours (sometimes even within minutes).
\end{quote}

As mentioned above, she was rather impressed when I mention that one
does not need to create dummy variables in R.  Therefore I am thinking
she might be interested in mentioning it in her talk.

I have never had experience of trying to introduce R to
non-Scientists, hence I would appreciate any comments!

Cheers,

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Reading in Files (was: no subject)

2004-06-08 Thread Ko-Kang Kevin Wang
Please use a more appropriate subject!

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 08, 2004 8:25 PM
Subject: [R] (no subject)


 Hi!!
 I am a new user of R (just trying to analysis microarrays with some
packages from the bioconductor project).
 I would like to import a text-delimeted file containing 20 columns and
22200 rows.

 I have tried
 read.table;
 scan(file=)
  matrix(scan(file, n=20*200,20,200, byrow=TRUE));
 Doesn't matter what I try I got the next message:
 error in file (file r): unable to open connection
 in addition warning message
 cannot open file MAS5orig (this is the name of the file I am trying to
import in R)

It's a syntax error, I think.  Why do you have a  before matrix()
command?

Also, which operating system are you running?  Are you sure your working
directory is correct?

Cheers,

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Table to Data Frame

2004-06-10 Thread Ko-Kang Kevin Wang
[Forwarding on behalf of a colleague]

She's got a list with several tables:
 tab - list()
 for(i in 1:6) {
+ tab[[i]] - table(freq[i])
+ }
 tab
[[1]]

   0 0.17  0.3  0.51  2.534
 1962515252

[[2]]

   0 0.17  0.31  2.534
 199136261

[[3]]

  0 0.5
217   1

[[4]]

  0 2.5
216   2

[[5]]

   0 0.17  0.3  0.51  2.534
 2071111241

[[6]]

   0 0.173
 21611


And would like to convert to a data frame, like:

0   0.17  0.3  0.5  1
1962 5 1  5
1991 3 0  6
2170 0 1   0
[snip]


Basically down the columns she'd like to have the counts.  But because each
table in the list has got different number of columns, I've been unable to
convert them into a data frame for her.

Any help would be greatly appreciated!

Cheers,

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to Describe R to Finance People

2004-06-10 Thread Ko-Kang Kevin Wang
Thank you very much to those who contributed to this rather interesting
discussion/debate.  I was very surprised (and almost overwhelmed) by the
volume of replies based on this topic!

I have prepared some slides and put the draft version on
www.stat.auckland.ac.nz/~kwan022/tmp/RFin.ppt.  Feel free to download a copy
if you are interested in what I am planning to use -- of course, any more
suggestions are welcome but remember, it will only be a 1 ~ 2 minute talk on
R *_*

Cheers,

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] load function to R GUI

2004-06-14 Thread Ko-Kang Kevin Wang
Hi,
 -Original Message-
 From: [EMAIL PROTECTED]

 Hi all!
 I looked through the manual and FAQ, and did not find any
information
 on how to load functions from files (with .R extension) to run them
in
 R GUI under Windows. The only way I know is to create and edit a
 function inside GUI. But what if I want to edit it in Emacs (do not
 want to use ESS) and then load into GUI?
 Any suggestions...

Do you mean ?source?

i.e. save your function in, say, foo.R then use the source() function
to get it in.

HTH

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Date Calculation

2004-06-17 Thread Ko-Kang Kevin Wang
Hi,

I've been playing with:
 joinDate - format(strptime(as.vector(forum[,2]), %d-%b-%y),
+%d-%b-%Y)
 today - format(strptime(as.vector(14-Jun-04), %d-%b-%Y),
+ %d-%b-%Y)
 joinDate
 [1] 04-Feb-2004 13-Feb-2004 26-Feb-2004 27-Feb-2004
27-Feb-2004
 [6] 27-Feb-2004 29-Feb-2004 01-Mar-2004 02-Mar-2004
07-Mar-2004
[11] 08-Mar-2004 17-Mar-2004 20-Mar-2004 22-Mar-2004
22-Mar-2004
[16] 23-Mar-2004 23-Mar-2004 24-Mar-2004 01-Apr-2004
01-Apr-2004
[21] 01-Apr-2004 01-Apr-2004 02-Apr-2004 06-Apr-2004
09-Apr-2004
[26] 11-Apr-2004 14-Apr-2004 03-May-2004 04-May-2004
30-May-2004
[31] 01-Jun-2004 10-Jun-2004 14-Jun-2004 17-Jun-2004
17-Jun-2004
 today
[1] 14-Jun-0004
 joinDate - today
Error in joinDate - today : non-numeric argument to binary operator

But it didn't quite work.  What I'd like joinDate - today to return is
the number of days to today, since joinDate.  I'm sure it has been asked
before however a search on r-help didn't found me any relevant
information *_*.

Cheers,

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Date Calculation

2004-06-17 Thread Ko-Kang Kevin Wang
Hi,

 -Original Message-
 From: Martin Maechler [mailto:[EMAIL PROTECTED]
 Kevin,
[[did you have tough day? usually your Q/A are much
 better ;-()]]

Thanks to those who have replied, and yes shame on me..

[I also realised I can just use Sys.Date() to get today's date,
instead of typing it in..I really had a tough day *_*]

Cheers,

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] setwd problems

2004-06-21 Thread Ko-Kang Kevin Wang
Hi,

 -Original Message-
 From: [EMAIL PROTECTED]

 Hello,

 I am using R for Windows and I receive error messages when trying to
 change my working directory:

  setwd('C:\BACC_R')
 Error in setwd(dir) : cannot change working directory

Have you tried:
  setwd(C:/BACC_R)
Or
  setwd(C:\\BACC_R)

HTH

Kevin


Ko-Kang Kevin Wang, MSc(Hon)
SLC Stats Workshops Co-ordinator
The University of Auckland
New Zealand

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] legend

2004-06-23 Thread Ko-Kang Kevin Wang
Hi,

- Original Message - 
From: Perez Martin, Agustin [EMAIL PROTECTED]
To: lista R help (E-mail) [EMAIL PROTECTED]
Sent: Wednesday, June 23, 2004 9:19 PM
Subject: [R] legend


 DeaR UseRs:

 I want to put a legend in my plot. In the first line of the legend I want
to
 put a box filled but in the second one I would like to put a lty=2

Have you looked at ?lengend

It's got some good examples.

Kevin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] help in importing data

2004-06-24 Thread Ko-Kang Kevin Wang
Hi,

Try read.csv()

i.e. take a look at ?read.csv

HTH

Kevin

- Original Message - 
From: Jose Sanchez [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Sent: Friday, June 25, 2004 10:38 AM
Subject: [R] help in importing data






 hi,

 i was wondering if you can give me an example on how to import a data set
 in csv format. i tried  the manual's example, but have been getting an
 error message:Error: syntax error.

 sincerely,

 jose sanchez

 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to make a plot without any axis-labeling

2003-08-03 Thread Ko-Kang Kevin Wang
?plot

On Fri, 1 Aug 2003, Michael Kirschbaum wrote:

 Date: Fri, 1 Aug 2003 00:22:09 +0200
 From: Michael Kirschbaum [EMAIL PROTECTED]
 To: R-Help [EMAIL PROTECTED]
 Subject: [R] how to make a plot without any axis-labeling
 
 Hi.
 I got a problem, perhaps someone can help me...
 
 every time, when I want to plot data, both axis are labeled by default like
 
 data[1,]
  and 
 data[2,]
 
 how can I make a plot without ANY labeling?
 
 does anyone know that?
 
 thanks for helping
 
 Michael
 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Memory-problem?

2003-08-11 Thread Ko-Kang Kevin Wang
On Mon, 11 Aug 2003, Unternährer Thomas, uth wrote:

 test.window - function(stat, some arguments){
   several ifs and ifs in ifs (if(){...if(){...}})
 }
 
 ...
 for (ii in 1 : length(data)){  ## data is a vector of length 2500
 
stat - test.window( some arguments )  
  ## there are 15 arguments including a big list (stat), vectors and scalars
plot.points(stat, some other arguments)
 
 }
 
 If I use the functions test.window and plot.points with the arguments 
 (test.window(stat,...)) 
 the for-loop stops at point ii = 1200 with an error message (error: Object stat not 
 found). 
 In every loop the object stat is used. This error could not be the real problem I 
 think.

I don't think it is a memory problem.  From your error message, the object 
stat cannot be found.  Have you initialised stat before the loop?

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] problems with lda , data included, can somebody test withthe new version

2003-08-14 Thread Ko-Kang Kevin Wang
On Wed, 6 Aug 2003, Nicolaas Busscher wrote:

 enclosed a simple R script (and a data file, and the output) , with
 calls lda similar to the example with the iris data in the
 documentation. it is not working and i dont understand the error
 message. can anybody help me? i am using R 1.5.1 (2002.06.17) on
 debian woody stable. 
 
 I would like to avoid updating now, because i want to keep the system
 in stable. can somebody test, if the newer version didnt have this
 problem ? thanks

 z-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08)

Using the latest version, R 1.7.1, I get:
 z
Call:
lda.formula(assignment ~ ., data = actaData, prior = prio, tol = 1e-08)

Prior probabilities of groups:
  5   6 
0.5 0.5 

Group means:
  diagonal.moment cluster.shade histogram.kurtosis
584.94982 -11989.17 -0.1116342
6   138.31495 -18892.15 -0.1205776

Coefficients of linear discriminants:
 LD1
diagonal.moment-1.575854e-03
cluster.shade  -1.209398e-04
histogram.kurtosis -2.028278e+02


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Princomp function in R

2003-08-14 Thread Ko-Kang Kevin Wang
It is in package mva.
On Tue, 12 Aug 2003, dai wrote:

 Date: Tue, 12 Aug 2003 13:51:10 -0700
 From: dai [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: [R] Princomp function in R
 
 Hi,
 
 I want to use Princomp function in R, but com up an error as  Error:
 couldn't find function princomp , can you help me resolve this problem?
 Thanks,
 
 Jixin Dai, Ph.D
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] default directory RGui for windows NT

2003-08-14 Thread Ko-Kang Kevin Wang
On Mon, 11 Aug 2003, Roy Werkman wrote:

 Can anyone tell me how to change the default directory in RGui for
 windows NT?

I take it you mean the working directory?

At least two ways:

1) Right click on the Rgui shortcut, click on Properties.  Enter the path 
into the Starting Location (or something like that, I'm using Chinese 
Windows and I'm translating the words).

2) In Rgui, File - Change dir...

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Books for R

2003-08-14 Thread Ko-Kang Kevin Wang
On Wed, 13 Aug 2003, anne wrote:

 As a newbie to R, I need to learn my way around (no previous experience 
 of S).What books, doc for R are recommended? I'm interested primarly in 
 non linear regression and process modelling (and have downloaded the R 
 documentation from the site).

So you have checked the publications on R web site? 
http://www.r-project.org/doc/bib/R-publications.html  There is a list 
there.
  William N. Venables and Brian D. Ripley. Modern Applied Statistics with 
  S. Fourth Edition. Springer, 2002. ISBN 0-387-95457-0.
in particular, is a very good book for beginners.  It has a chapter on 
non-linear regression and smooth regression, using packages like nls.

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Crosstabs

2003-08-14 Thread Ko-Kang Kevin Wang
On Tue, 12 Aug 2003, Gerhard Prade wrote:

 i think i am to silly.  I have installed R 1.7.1 (2003-06-16). Installed
 some packages like xtables ore xml. I tried out this to installing
 packages. Then i tried to make a crosstable like i know it from spss.
 They say in this list that it would be going.
 
 than i want make a crosstables with the first and the second variable.

I'm not sure what SPSS does as I have never used it.  But is the 
CrossTable() function in the gregmisc library what you want?

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] How to reinstall rpart?

2003-08-15 Thread Ko-Kang Kevin Wang
On Fri, 15 Aug 2003, David Parkhurst wrote:

 After entering “library(rpart)”, I tried to plot an existing rpart tree, and
 got this error message:  Error: couldn't find function plot.rpart.
 However, “?plot.rpart” does bring up the help for the function.  The same
 things occur for text.rpart, although print(my.tree) does work.

So have you *read* the help when you do ?plot.rpart ?

Please read the example, and see how it is used.  Hint: you do not use 
plot.rpart(), but plot()


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Neural Networks in R

2003-08-20 Thread Ko-Kang Kevin Wang
Hi,

Venables and Ripley's Modern Applied Statistics with S, 4th Ed, 
Springer.

It is the best book and has a large section devoted to using the nnet 
library.

Of course, you need to understand the theory first;-D

On Wed, 20 Aug 2003, Miriam Dreißig wrote:

 Date: Wed, 20 Aug 2003 12:54:18 +0200 (MEST)
 From: Miriam Dreißig [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [R] Neural Networks in R
 
 Hello!
 We are a group of three students at Bielefeld University currently working
 on a statistical projects about neural networks. Within the framework of this
 project we are supposed to use the nnet-function in R and explain how it
 works. Since anyone of us has much experience in using R we hoped to find some
 information on your homepage. Unfortunatelly, we haven't been very successfull
 so far.
 We were wondering if you happen to know any books or articles which deal
 with neural networks in R or if you could tell us were we can find such
 information.
 We would highly appreciate if you could help us on that matter.
 Thank you very much in advance.
 Best regards,
 
 Anne Bruns, Miriam Dreißig, Sascha Hartung
 
 

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R tools for large files

2003-08-25 Thread Ko-Kang Kevin Wang
Hi,

Have you looked at R Data Import/Export?

On Mon, 25 Aug 2003, Murray Jorgensen wrote:

 Date: Mon, 25 Aug 2003 16:04:17 +1200
 From: Murray Jorgensen [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: R-help [EMAIL PROTECTED]
 Subject: [R] R tools for large files
 
 I'm wondering if anyone has written some functions or code for handling 
 very large files in R. I am working with a data file that is 41 
 variables times who knows how many observations making up 27MB altogether.
 
 The sort of thing that I am thinking of having R do is
 
 - count the number of lines in a file
 
 - form a data frame by selecting all cases whose line numbers are in a 
 supplied vector (which could be used to extract random subfiles of 
 particular sizes)
 
 Does anyone know of a package that might be useful for this?
 
 Murray
 
 

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] selecting by variable

2003-08-27 Thread Ko-Kang Kevin Wang
On Wed, 27 Aug 2003, Eugene Salinas wrote:

 I'm a recent R convert so I haven't quite figured out
 the details yet...

Usually it is good to read the manuals when you use a unfamiliar 
software...

 How do I select one variable by another one? Ie if I
 want to draw the histogram of variable X only for
 those individuals that also have a value Y in a
 certain range?

e.g.
  x = rnorm(100)
  y = 1:100
  x[y = 20:50]
will give you the value of x when y is between 20 and 50.  To do a 
histogram, type:
  ?hist

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Re: diamond graphs and patents

2003-08-28 Thread Ko-Kang Kevin Wang
I have been reading this discussion (or debate, depends on your point of 
view) with great interest in the last few days.

On Thu, 28 Aug 2003, David Scott wrote:

 My reaction when learning of a proposed patent on a new graph was: oh 
 well, that's something I can forget about. Without a patent, code would 
 have been available in R in a very short period of time, the statistical 
 community would have been able to play around with it, see how it worked 
 on various problems. If the graph proved useful it would make its way into 
 statistical practice. With a patent none of that seems possible. Prof 
 Munoz has had fun exploring his creation, but if any of us are to do 
 likewise I guess we will either pay up or secretly write code and play 
 around with diamond graphs while hidden in the basement.

I agree.  The question, IMHO, is not whether the diamond graph is a good 
visualising tool or not -- because it still remains to be seen, but on the 
idea of having it patented.

I completely agree with Dr. Ihaka that the only reason that makes R so 
popular and widely used across the academia, research institutes and even 
many large commercial companies, is that it is free and open-sourced.

It is certainly going to be interesting to write up some functions in R 
that draws diamond graphs, and then test them on some simulated and real 
world data.  But as Associate Professor Scott pointed out, with a patent 
on diamond graph (should the application be accepted), I am not sure if 
this is possible.

With patenting in mind, I have been think what would the world like if 
histograms, bargraphs, boxplots...etc. were patented by the original 
inventors!  The idea of patenting a graph seems to me like patenting a 
mathematical/statistical theorem.  Again, if for example the Central 
Limit theorem is patented, does it mean we have to pay whenever we want to 
make inference from it?

There are many software that offers educational institution an academic 
license, and offers students a student license.  But the thought of the 
possibility of having to pay for using a graph (or writing codes to draw 
the graph) is.

 Getting a graph used is not that simple I think. Boxplots are now an 
 extremely useful tool, but lets not forget that Tukey also invented the 
 hanging rootogram.

What is a hanging rootogram? ;-D

 As for Microsoft getting involved, God help us. Excel still doesn't do 
 boxplots does it? Not to mention the quality of their implementation of 
 most of their statistical routines.

Even those graphs that Excel does do, e.g. histograms, it does not do a 
very good job in them.  It has been, what, over a decade now since the 
first version of Excel was released?  I cannot keep myself from wondering 
why Excel still produces ugly graphs.


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] subtract 2 columns in a data.frame

2003-09-04 Thread Ko-Kang Kevin Wang
On 4 Sep 2003, Ulrich Leopold wrote:

 could someone point me to the right command to subtract 2 columns in a
 data.frame. Might be a bit embarrassing question. But I cannot figure
 out how to do this simple command in R.

Suppose your data frame is called foo, and you want the first column minus 
the second:
  foo[,1] - foo[,2]


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] documents for writing functions

2003-09-04 Thread Ko-Kang Kevin Wang
On Thu, 4 Sep 2003, Spencer Graves wrote:

 Have you considered the two books by Venables and Ripley (2002) Modern 
 Applied Statistics in S and (2000) S Programming (both Springer)?  If 
 yes, I don't know what you mean by the usually available manuals.

In addition, John Chambers's Programming with Data (aka The Green Book) 
is a good source.
 
 hope this helps.
 
 Rado Bonk wrote:
  Hi,
  
  Does anybody know suitable documents (manuals) on writing user functions
  (covering loops, conditions ...) in R? Other than the usually available
  manuals.

It all depends on how much programming experience you already have.  I'm 
giving a small workshop next week on these areas and my notes are 
available at http://www.stat.auckland.ac.nz/~kwan022/rinfo.php 

I'm planning on extend the notes into a book I'm writing -- which will be 
submitted to CRAN when it is completed.

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Sorting

2003-09-11 Thread Ko-Kang Kevin Wang
Hi,

On Thu, 11 Sep 2003 [EMAIL PROTECTED] wrote:

 What is the best way to sort a dataframe?
 
 For example, how would I go about sorting a dataframe (with variables V1-V5)
 by ascending V1, V2 and descending V3 while retaining V4 and V5.

?sort

 Also, is there a relatively easy way by which to re-order my columns?

?order or ?sort

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] CART analysis

2003-09-17 Thread Ko-Kang Kevin Wang
Or, I think, the rpart package.

On Thu, 18 Sep 2003, Vladimir N. Kutinsky wrote:

 Date: Thu, 18 Sep 2003 00:18:25 +0400
 From: Vladimir N. Kutinsky [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: RE: [R] CART analysis
 
 Ron,
 
  Does anyone know of an R code for classification and regression tree
  analysis (CART)?
 
 If I got you right, you need a tree package. It implemets the CART method.
 If you go further, you will like randomForest package.
 
 Regards,
 Vladimir
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] xgobi vs ggobi

2003-09-22 Thread Ko-Kang Kevin Wang
Hi,

On Mon, 22 Sep 2003, Christian Hennig wrote:

 Hi Ted,
 
 here is something rather imprecise. I have both xgobi and ggobi on my
 computer. Up to now, I used almost always xgobi, because it contains the
 features that I need. Some of these are not in ggobi (e.g. mean/sd and med/mad
 standardization). ggobi has also some instabilties (no details now, because
 it's some time ago that I encountered them). In general, ggobi looks more
 user friedly, is supposed to communicate better with R and does also
 some standardization and other things which are not in xgobi.

I think GGobi is also *supposed to be* more Windows-friendly, as it does 
not need an X Server running -- whereas you need to have an X Server 
running on Windows in order to use XGobi.

The installation process of GGobi is also easier.  If my memory serves me 
right, I think the XGobi development has sort of stopped and the 
developers are now concentrating on GGobi?  I could be wrong though...

The other thing, I think, is that GGobi supports XML data format and XGobi 
doesn't (or not very well?).

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] truncating axis

2003-10-01 Thread Ko-Kang Kevin Wang
On 1 Oct 2003, Diego Riano wrote:

 Does anyone know how to truncate and axis in R?

What do you mean by truncate?  Do you mean to change the range of the 
axes?  If so then something like
  plot(x, xlim = range(), ylim = range())
should do (just put the desired range


-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] r editors

2003-10-02 Thread Ko-Kang Kevin Wang
On Thu, 2 Oct 2003, forkusam wrote:
 
 I am programming on a windows system and have problems
 using notepad which is my main editor.Each time I try
 to open the editor from the R IDE, R crashes.

Not sure what you meant by R IDE, do you mean Rgui?

 CAn someone tell me if I am doing anything wrong or is
 there a better editor(freeware) which I could get.

If you are really programming in R, you really should get Emacs/ESS

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] (no subject)

2003-10-02 Thread Ko-Kang Kevin Wang
On 30 Sep 2003, Arunkumar  Arumugam wrote:

 I tried testing some of the programs and functions.
 I read in the manual that plot(x,y) functions automatically 
 generates a  graphical window and plot. that does not happens in 
 my installation.

Ummm...can you be a bit more precise?

What exactly has happened when you typed plot(x, y)?  Have you created two 
vectors called x and y?  Were they any error messages, if so what are the 
messages?

-- 
Cheers,

Kevin

--
On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question.

-- Charles Babbage (1791-1871) 
 From Computer Stupidities: http://rinkworks.com/stupid/

--
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Managing memory on R

2003-10-16 Thread Ko-Kang Kevin Wang
On Thu, 16 Oct 2003, ZABALZA-MEZGHANI Isabelle wrote:

 I have a problem with the memory size within R. I would like to know if
 there is any may for getting back free memory during a R session. I've tried
 with rm and gc but it still craches. I am working on windows R1.3.1.

Perhaps trying to upgrade your R version first?  R 1.3.1 is kind of old 
now..

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] interactive prompts

2003-10-20 Thread Ko-Kang Kevin Wang
On Tue, 21 Oct 2003, Ernie Adorio wrote:

 Am using R on a Linux box and am currently writing an interactive R script.
 
 1. How do I ask a user to press any key to continue ? I used a system call to 
 read but this only works if the Enter key is pressed:
   print(Press any key to continue)
   system(read)

  par(ask = TRUE)
will do what you want.

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] interactive prompts

2003-10-20 Thread Ko-Kang Kevin Wang
On Tue, 21 Oct 2003, Ko-Kang Kevin Wang wrote:

 On Tue, 21 Oct 2003, Ernie Adorio wrote:
 
  Am using R on a Linux box and am currently writing an interactive R script.
  
  1. How do I ask a user to press any key to continue ? I used a system call to 
  read but this only works if the Enter key is pressed:
print(Press any key to continue)
system(read)
 
   par(ask = TRUE)
 will do what you want.

Sorry, that will only work if you are plotting graphs.  I didn't quite 
read your question properly *_*.

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] questions about axis

2003-10-22 Thread Ko-Kang Kevin Wang
Hi,

On Wed, 22 Oct 2003, yyh wrote:

 I have difficulties to handle axis. I want to draw axis label such that axis has 
 range of [-0.4,0.4] with intervel 0.2 for x and y axis.
 Some part of range do not have data points. Thus, plot does not show whole range. 
 How can I enforce plot to depict the whole range regardless of existence of data 
 points ?

You can draw the plot from first principle.  For example:
  x = seq(-0.4, 0.4, length = 50)
  y = runif(50, -0.2, 0.2)
  plot.new()
  plot.window(xlim = c(-0.4, 0.4), ylim = c(-0.4, 0.4))
  axis(1, at = seq(-0.4, 0.4, by = 0.2))
  axis(2, at = seq(-0.4, 0.4, by = 0.2))
  points(x, y)
  box()

 Another problem is that when I depict axis labels, some labels are overlapped 
 because interval is very small. In this case, I'd like to put one of label into 
 insde the box which is drawn by plot. 
 How can I do this ?

Try:
  title(xlab = This is my x-label, line = -2)
 
Of course, this is just a silly example, with 50 uniform random numbers 
between -0.2 and 0.2.  But you get the idea...

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] comments and Sweave

2003-10-22 Thread Ko-Kang Kevin Wang
Hi,

I asked exactly the same question to the author of Sweave privately last 
week.  Friedrich's reply was that it is not possible at the moment, as R 
parser discard the comments.  But he's working on it ;-D

On Wed, 22 Oct 2003, Giovanni Petris wrote:

 Date: Wed, 22 Oct 2003 10:59:38 -0500 (CDT)
 From: Giovanni Petris [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [R] comments and Sweave
 
 
 I am using Sweave to produce handouts for teaching. 
 Is there a way of making Sweave keep the comments following the `#' in
 the code chuncks?
 
 Thanks,
 Giovanni
 
 

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Complete Newbie Q

2003-10-26 Thread Ko-Kang Kevin Wang
On Sun, 26 Oct 2003, Tom Hopper wrote:

 My question is this: is there a quick-start guide or introductory 
 tutorial for someone with my background? While there seems to be quite 
 a lot of documentation on R, it all seems directed at people with a 
 different background. It's too basic, or too advanced, but doesn't 
 address someone reasonably familiar with statistics who just needs to 
 change his work habits.

Not knowing your exact background, it is difficult to suggest one.  I'd 
say that An Introduction to R manual from CRAN is a good start.  
Alternatively, Venables and Ripley's Modern Applied Statistics with S is 
an excellent source -- perhaps the best in the field.  Peter Dalgaard's 
Introductory Statistics with R may also be a good choice.

At the moment, Steven Miller and I are planning on co-authoring a book on 
using R, targetted at experience statisticians who have little or no 
experience with R.  The current ideas are at 
http://www.stat.auckland.ac.nz/~kwan022/pub/R/RBook/ .  We are planning on 
finishing it by Feb/March 2004 -- which may be too late for you.  Once it 
is finished we will submit it to CRAN.

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] interfacing C into R and R packages

2003-11-04 Thread Ko-Kang Kevin Wang
I think Writing R Extensions may help you with that...

On Tue, 4 Nov 2003, Peyrard Nathalie wrote:

 Date: Tue, 04 Nov 2003 10:19:00 +0100
 From: Peyrard Nathalie [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [R] interfacing C into R and R packages
 
 Hi,
 
 I would like to interface a C code into R. Is it possible to use in the C code, 
 functions from a R package (for instance, to use pmvnorm within loops in the C code 
 and to call the result in  a R function)?
 
 Nathalie
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Two Y-axises and One X-axis

2003-11-07 Thread Ko-Kang Kevin Wang
Hi,

On Fri, 7 Nov 2003, umeno wrote:

 I would like to know if anyone knows how to draw a plot with two Y-axises and 
 one X-axis? When you have two sets of y values that do not have the same 
 scale, but correspond to the same x value, I would like to plot them on one 
 graph.

I think both Modern Applied Statistics with S (Venables and Ripley 2002) 
and Introductory Statistics with R (Dalgaard 2002) have some example.

Basically one way to do this is to build the plot piece by piece (aka by 
first principle, or low-level plotting).  For example, the axis() command 
can be useful:
  axis(1) # x-axis at the bottom
  axis(2) # y-axis on the left
  axis(4) # y-axis on the right


-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] y label after axis (4)

2003-11-07 Thread Ko-Kang Kevin Wang
Hi,

On Fri, 7 Nov 2003, umeno wrote:

 Then, I want to label the second y axis pay2.  I tried title(ylab=pay2), 
 but it put this lable on the first y-axis.  Does anyone know how to move this 
 to the second y-axis?

?mtext will do what you want.

For example, here is a few codes from Venables and Ripley 2002 Modern 
Applied Statistics with S, Chapter 8.1:
  library(MASS)
  attach(wtloss)
  # alter margin 4; others are default
  oldpar - par(mar = c(5.1, 4.1, 4.1, 4.1))
  plot(Days, Weight, type = p, ylab = Weight (kg))
  Wt.lbs - pretty(range(Weight*2.205))
  axis(side = 4, at = Wt.lbs/2.205, lab = Wt.lbs, srt = 90)
  mtext(Weight (lb), side = 4, line = 3)
  par(oldpar) # restore settings
  detach()

Note that you can also get the above codes from 
$R_HOME/library/MASS/scripts/ch08.R.




-- 
Cheers,

Kevin

---
Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Program Saving

2003-11-13 Thread Ko-Kang Kevin Wang
Hi,

On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote:

 I have a very simple question. If a want to save a whole program (say more than 5 
 command lines), how can I proceed without each time using the command history (that 
 allow me to recall previously saved command, but which is to long if you want to 
 recall more than 5 command lines), or without saving to a text file and use 
 copy/paste when I open a new R session (but in fact this doesn't work since when you 
 copy your program to a text file, you copy the  or the + , and when you paste 
 it back to a new R command sheet, you get syntax error since you now have double  
 () and double + (++) at each line.

Please wrap your text to something like 80 character per line...

Copy/paste works very well.  Instead of copying from your R session over 
to a text editor, why don't you do it the other way round?  i.e. type your 
R codes in your favourite editor, THEN copy/paste into R.  That way you 
don't get any syntax error, and you have all your R codes saved into one 
file.

There are several good tools.  (X)Emacs/ESS is one of them (and it's the 
one I prefer).  For beginners there is RWinEdt (a plugin, written by Uwe 
Ligges, for WinEdt).  Both allows direct communication from the editor to 
R

HTH.

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] read.table(..)..Help?

2003-11-20 Thread Ko-Kang Kevin Wang
On Thu, 20 Nov 2003, forkusam wrote:

 Hi;
 Thanks for the quick reply. I am presently not sittinh infront of my computer so I 
 can't tell you the exact error message but.
 
 I have read through the documentation and have found nothing of help.
Yes. the columns are separated by semicolons
My problem is: I do not know the command / or parameter I need to read the rows 
 and  process the stored information one after the other.

read.table() should know how to read each rows, can you provide an subset 
of your data? 

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] reading data rows

2003-11-20 Thread Ko-Kang Kevin Wang
Hi,

On Thu, 20 Nov 2003, forkusam wrote:

 to carry out mathematical calculations 
 
 I have a a file  of the form 
 mu1   mu2 alpha   betaWsigma sigmaA  b  r 
 2515  .05 .05 22   3.3.5
 3020  .1  .2  22  .3.3.5
 
  I intend to read one row , carry out the calculations
 and then the next row with which I intend to do the
 same calculations.
 I do the following.
 p-read.table(file=eingabe.csv, header=TRUE,sep=;)
   
 data.frame(as.numeric(mu1-p$mu1),as.numeric(mu2-p$mu2),
 
 as.numeric(alpha-p$alpha),as.numeric(beta-p$beta),
 
 as.numeric(Wsigma-p$Wsigma),as.numeric(sigmaA-p$sigmaA),as.numeric(b-p$b),as.numeric(r-p$r))

Is there any particular reason why you want to do this data.frame() line?  
To me it seems redundant.  Each column is already in numeric/vector form,  
I believe.

 Error in uniroot(function(n) eval(p.body) - power,
 c(2, 1e+07)) : 
 invalid function value in 'zeroin'
 In addition: Warning message: 
 the condition has length  1 and only the first
 element will be used in: if (f(lower, ...) * f(upper,
 ...) = 0) stop(f() values at end points not of
 opposite sign)

What kind of mathematical calculations were you trying to do when you got 
this error message?  As discussed off-list last night, since you want to 
operate on each row using the same operation, have you tried using 
apply()?

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] strptime Usage

2003-11-25 Thread Ko-Kang Kevin Wang
Hi,

I have a column in a dataframe in the form of:
 as.vector(SLDATX[1:20])
 [1] 1/6/1986  1/17/1986 2/2/1986  2/4/1986  2/4/1986
 [6] 2/21/1986 3/6/1986  3/25/1986 4/6/1986  4/10/1986
[11] 4/23/1986 4/30/1986 5/8/1986  5/29/1986 6/15/1986
[16] 6/18/1986 6/23/1986 6/29/1986 7/16/1986 7/25/1986

I'd like to convert it into either -mm or /mm form, e.g. 1986-06 
or 1986/06, and I've been suggsted to use the strptime() function.  

However when I look at the documentation of it and tried something like:
 strptime(as.vector(SLDATX)[1:20], %y/%m)
 [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA

I got a bunch of NA's.  I also tried:
 strptime(as.vector(SLDATX)[1:20], %y/%m/%d)
 [1] 2001-06-19 NA   2002-02-19 2002-04-19 2002-04-19
 [6] NA   2003-06-19 NA   2004-06-19 2004-10-19
[11] NA   NA   2005-08-19 NA   NA
[16] NA   NA   NA   NA   NA

It is totally messed up.

I'd really appreciate if anyone can point out where I did wrong *_*!

Many thanks in advance.


-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] strptime Usage

2003-11-30 Thread Ko-Kang Kevin Wang
Thanks!

On Wed, 26 Nov 2003, Gabor Grothendieck wrote:

 Date: Wed, 26 Nov 2003 00:34:11 -0500 (EST)
 From: Gabor Grothendieck [EMAIL PROTECTED]
 To: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [R] strptime Usage
 
 
 
 strptime takes a character input and produces a POSIXlt output so
 the format you specify to strptime is the format of the input, 
 not the output:
 
format( strptime(10/22/1986, %m/%d/%Y), %Y-%m )

It worked perfect.  Just out of interest, if I want to convert (either 
from the original form, i.e. mm/dd/, or the -mm form, to quarterly 
format, e.g.:
  1999-1
  1999-2
  1999-3
  1999-4
is it possible to do with strptime?  Or do I have to do something 
creative? ;-D

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
x88475 (City)
x88480 (Tamaki)

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Julian Dates

2003-12-15 Thread Ko-Kang Kevin Wang
Hi,

I'm a bit confused how julian() works.  If I understand right, it returns 
the number of days since the origin. 

I have a vector:
 SLDATX[1:10]
 [1] 1986-01-06 1986-01-17 1986-02-02 1986-02-04
 [5] 1986-02-04 1986-02-21 1986-03-06 1986-03-25
 [9] 1986-04-06 1986-04-10

And when I did:
 TIMESOLD - as.numeric(julian(as.POSIXlt(SLDATX),
+   origin = as.POSIXct(1986-01-01, )))

I got:
 TIMESOLD[1:10]
 [1]  5.0 16.0 32.0 34.0 34.0 51.0
 [7] 64.04167 83.04167 95.04167 99.04167


THe first 6 values from TIMESOLD is obvious, however I'm not sure why I 
got decimals from the 7th value, as my input vector does not have any 
specific times after the dates.

Any insights would be greatly appreciated...;-D

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang, MSc
SLC STATS 10x Workshop Coordinator
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599  x88475

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Julian Dates

2003-12-15 Thread Ko-Kang Kevin Wang
Thanks!  chron() is very useful indeed.

Just out of interest, is it possible to do, say in this case, the number 
of months (or quarters) after January 1986?  i.e. use a different time 
interval?

On Mon, 15 Dec 2003, Gabor Grothendieck wrote:

 What you can do to handle this timezone problem is either to use
 POSIXt with GMT or use chron (which does not use timezones so 
 can't cause problems like this):
 
 Suppose:
 
 SLDATX - c( 1986-01-06, 1986-01-17, 1986-02-02, 1986-02-04,
 ,1986-02-04, 1986-02-21, 1986-03-06, 1986-03-25,
 ,1986-04-06, 1986-04-10 )
 
 # then using POSIXt in the GMT timezone:
 
 TIMESOLD - as.numeric( julian( as.POSIXlt( SLDATX, tz=GMT ),
   origin = as.POSIXct( 1986-01-01, tz = GMT ) ) )
 
 # or the alternative using chron:
 
 require(chron)
 TIMESOLD2 - as.numeric( chron( SLDATX, format=y-m-d, 
   origin = c( month = 1, day = 1, year = 1986 ) ) )
 
 all.equal(TIMESOLD,TIMESOLD2)
 

-- 
Cheers,

Kevin

---
Try not.  Do, do!  Or do not.  There is no try
   Jedi Master Yoda


Ko-Kang Kevin Wang, MSc
SLC STATS 10x Workshop Coordinator
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599  x88475

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Getting graphs into LaTeX

2002-12-19 Thread Ko-Kang Kevin Wang
Hi,

- Original Message -
From: Andrew Criswell [EMAIL PROTECTED]
To: r-help [EMAIL PROTECTED]
Sent: Friday, August 22, 2003 2:17 AM
Subject: [R] Getting graphs into LaTeX


 Hello ALL:

 I ran with success the following commands in R getting a file saved
 --
--
 postscript()

 postscript('~/data/st202/2003/lecture00/lecture00-graph-01.eps',
horizontal = FALSE, height = 6, pointsize = 10)

 hist(trial.outcome.5, breaks = 5,
  main = '1000 Replications of 5 Trials of a Coin Toss',
  xlab = 'Frequency of a Tail')
 --
--


Have you closed the postscript device?  Normally you need a dev.off() after
you finished the plot.  Try putting dev.off() after your hist().

The other thing is can you actually view lecture00-graph-01.eps in the
directory, with a postscript Viewer?

The last point, I think pdflatex (or pdftex) does not accept PS/EPS
formatted picture.  Can you latex trix.tex?  If so, try to save your
histogram as a PDF or PNG file, then pdflatex it again.

Cheers,

Kevin


Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022





__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] how could I add legends?

2003-01-26 Thread Ko-Kang Kevin Wang
Hi,

- Original Message - 
From: Qin Xin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 27, 2003 9:42 AM
Subject: [R] how could I add legends?


 Hi All,
 
 I plotted several distribution curves in one graph but
 I do not know how to add legends say which is what
 distribution.  Could someone help me?  Thanks,


Have a look at
   ?legend

Kevin

Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] Regarding Installation of R

2003-01-30 Thread Ko-Kang Kevin Wang
- Original Message -
From: saicharan komanduru [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 31, 2003 7:31 AM
Subject: [R] Regarding Installation of R


 Hi,
  I am trying to install R on Windows. I copied the set
 up binary. But it is corrupted on all the mirror
 sites. Please let know an alternative for getting the
 software.


Which set up binary did you downloaded?  It should not be corrupted.  Did
you download the rw1062.exe in, for example,
http://cran.r-project.org/bin/windows/base ?


Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] basic question

2003-02-04 Thread Ko-Kang Kevin Wang
Hi,

From your description I am guessing you're using Windows.

What you may need is to compile this package from source.  It is explained
in one of the R manuals (I can't remember which one though).

You can also look at my R Guide for Windows Users at
http://www.stat.auckland.ac.nz/~kwan022/rinfo.php (Section 5).

I'm not sure the exact contents in the labdsv_0.9-1.tar.gz , but in general
you can first unpack it with, e.g.:
   tar zxvf labdsv_0.9-1.tar.gz
 then you may need:
   Rcmd labdsv_0.9-1

Hope this helps,

Kevin


Ko-Kang Kevin Wang
Master of Science (MSc) Student
Department of Statistics
University of Auckland
New Zealand
www.stat.auckland.ac.nz/~kwan022

- Original Message -
From: Archaux Frederic [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Sent: Tuesday, February 04, 2003 9:46 PM
Subject: [R] basic question


Dear R users,

Up to now, I only used precompiled packages. As I am working on vegetation
ecology, I would be interested in using a package not stored by CRAN called
labdsv_0.9-1.tar.gz and developped by Dave Roberts at the National Center
for Ecological Analysis and Synthesis (unfortunately I did not find any
corresponding .zip file).

Although I tried to follow the proposed guidelines  to install such a file
in R, I did not succeed. I installed the library tools, the Perl and the
MinGW softwares, but I feel all this stuff is useless in my case (my
knowledge in informatic in so poor that I am reduced to intuitions!)

I know this is probably one of the most FAQ, but I did not find the answer
to my problem on the R-CRAN web site. Thank you in advance!

Have a good day.

Frédéric Archaux (PhD, Engineer)

Biodiversity and Forest Management Team
CEMAGREF
Domaine des Barres
F-45290 Nogent-sur-Vernisson
FRANCE


[[alternate HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



  1   2   >