Re: [R] R and LaTeX
Hi David, You can export the graphs in (encapsulated) postscript format, or in PDF/PNG/JPEG format. The following functions may be helpful: postscript() png() pdf() You may also want to check out Sweave (http://www.ci.tuwien.ac.at/~leisch/Sweave/), it allows you to integrate LaTeX and R neatly. Cheers, Kevin David Kaplan wrote: Hi all, I have started using LaTeX for writing papers and I have heard that R works well with LaTeX. I'm specifically interested in how I can have LaTeX read in R generated graphics - for example graphs formed by matplot, or other such processes. Does anyone out there use LaTeX and can point me in the right direction? Thanks David -- Ko-Kang Kevin Wang Ph (H): +61-2-612 57471 Ph (M): +61-40-4518301 http://wwwmaths.anu.edu.au/~wangk/personal/ __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] there is no xls reader in R?
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
Re: [R] simple question
Hi, Korbinian von Blanckenburg wrote: Its just a simple question I guess: I have a vector with missing information like x-c(0,1,31,131,NA,133,NA,310,NA,112,3,1,2,93) How can I make a vector like this no missing in it. I used the x[x0] commabd and tried some more, with no success. Try na.omit() HTH, Kevin -- 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
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] graphics guide?
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] TeX distribution on Windows
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
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] R: regression data set
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
Re: [R] Finding out collinearity in regression
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] emacs
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] Reference Card?
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] read.spss trouble
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] Barplot - Can't figure it out
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] (no subject)
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] classification using logistic regression
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] SAS or R software
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
[R] Finding out the number of times a loop has run
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
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] library gregmisc
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
Re: [R] A question in R
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] Re:How to create a R -application
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] Excluding data in R
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] Retrieving objects from functions...
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] (no subject)
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] multinomial logistic regression
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
[R] Using eval() more efficiently?
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] Newbie q. need some help understanding this code.
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()
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
Re: [R] howto load functions?
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] a little question about R
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
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
[R] [OT]Example Data for Non-statisticians
(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
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
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
[R] xtable Questions
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] R and Latex tables
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
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
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] how to extract data from excel sheet?
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] How do I add rows to a table?
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] plot.table on R 1.9.1
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
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] calibration/validation sets
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] Can R work on very large of data?
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] Importing an Excel file
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?
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] text editor for R
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] help in importing data
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] legend
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] setwd problems
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
[R] Date Calculation
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
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] load function to R GUI
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] Table to Data Frame
[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
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] Reading in Files (was: no subject)
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
Re: [R] rpart
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
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] cameraa rotation graphics
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] how to get data and post it on R
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
[R] ts() objects in R
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
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] Error with 1.9.0 - Invalid HOMEDRIVE
I heard of this problem mentioned by one staff member here, but he suspected it was to do with Windows XP's patch. When the technician told us about getting the patches for Windows, Rgui started to crash. But then a few days later a new patch by Microsoft was released and after installing the new patch, the problem was solved. As a result, the staff member suspected it's the problem with Microsoft but now it may have been solved. Kevin - Original Message - From: David Scott [EMAIL PROTECTED] To: Prof Brian Ripley [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, April 23, 2004 11:41 AM Subject: Re: [R] Error with 1.9.0 - Invalid HOMEDRIVE A quick question: has anybody encountered this error working on a desktop? Users here who have had problems are working on laptops, and laptops have been mentioned in other posts. Brian said he was unable to reproduce the problem. David Scott -- _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics __ [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] I do not achieve to install some packages
Hi, -Original Message- From: [EMAIL PROTECTED] I can't load the packages locfit, lokern and quantreg. When I try to load the 3 packages the R program says that the pakages are not properly installed. He says to see the note in ?library. I think that the error is because there is no built field in the 3 packages. What can I do to make the packages run. Can you tell us how you installed it? It would help. Also which version of R are you using? If you installed it within Rgui, by going to Packages - Install packages from CRAN..., then it should definitely work. 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] Clever R syntax for extracting a subset of observations
Hi, - Original Message - From: Ajay Shah [EMAIL PROTECTED] But this doesn't work since if D is a data frame, you can't say D[d]. Let me show you: x = runif(100) y = runif(100) D = data.frame(x, y) d = c(7,3,2) E = D[d] Error in [.data.frame(D, d) : undefined columns selected Any suggestions on how one can do such pretty things as D[d] where D is a data frame? So I take it you want to select the 7th, 3rd, and 2nd observation (i.e. rows) from D? A data frame has two dimensions, so you need to specify the row and columns. Maybe try: E = D[d,] HTH, 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] Density Estimation
-Original Message- From: [EMAIL PROTECTED] Dear Sir/Madam; Would you please tell me what is the command that allows the estimation of the Kernel Density for some data. Thanks, ?density __ [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] Nested Loop in R
Thanks for those who replied! I found out the problem. I don't need the nested loop at all. The following code would've worked (for those who're interested to know): # ## Testing CLT. pp 281 of Chance Encounters x - round(runif(1000, 1, 6)) clt - function(x, samp.no = 5, n = 5) { samp - vector(mode = list, length = samp.no) plot.new() plot.window(xlim = c(1, 6), ylim = c(1, samp.no)) axis(1, at = 1:6) axis(2, at = 1:samp.no, labels = samp.no:1, las = 1) for(i in 1:samp.no) { samp[[i]] - sample(x, n) points(jitter(samp[[i]], 0.3), rep(i, n)) lines(x = c(mean(samp[[i]]), mean(samp[[i]])), y = c(i - 0.1, i + 0.1)) } title(main = paste(samp.no, samples of size n = , n, sep = ), xlab = 6-Sided Die, ylab = Sample Number) } ## 5 Samples par(mfrow = c(2, 2), bg = white) clt(x, samp.no = 5, n = 5) clt(x, samp.no = 5, n = 10) clt(x, samp.no = 5, n = 20) clt(x, samp.no = 5, n = 30) # __ [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] Nested Loop in R
Hi, Apologies for such a trivial question, but it has been over two years since I last used nested loops and I'm ashamed to say that I forgot how they work *_* Suppose I've the following codes: # x - round(runif(1000, 1, 6)) samp5 - vector(mode = list, length = 5) for(i in 1:5) { samp5[[i]] - sample(x, 5) } plot.new() plot.window(xlim = c(1, 6), ylim = c(1, 5)) axis(1, at = 1:6) axis(2, at = 1:5, labels = 5:1, las = 1) points(jitter(samp5[[1]], 0.1), rep(5, 5)) lines(x = c(mean(samp5[[1]]), mean(samp5[[1]])), y = c(5.1, 4.9)) points(jitter(samp5[[2]], 0.1), rep(4, 5)) lines(x = c(mean(samp5[[2]]), mean(samp5[[2]])), y = c(4.1, 3.9)) points(jitter(samp5[[3]], 0.1), rep(3, 5)) lines(x = c(mean(samp5[[3]]), mean(samp5[[3]])), y = c(3.1, 2.9)) points(jitter(samp5[[4]], 0.1), rep(2, 5)) lines(x = c(mean(samp5[[4]]), mean(samp5[[4]])), y = c(2.1, 1.9)) points(jitter(samp5[[5]], 0.1), rep(1, 5)) lines(x = c(mean(samp5[[5]]), mean(samp5[[5]])), y = c(1.1, 0.9)) # and wanted to convert them into a function like: # clt - function(x, samp.no = 5, n = 5) { samp - vector(mode = list, length = samp.no) plot.new() plot.window(xlim = c(1, 6), ylim = c(1, samp.no)) axis(1, at = 1:6) axis(2, at = 1:samp.no, labels = samp.no:1, las = 1) for(i in 1:samp.no) { samp[[i]] - sample(x, n) for(j in n:1) { points(jitter(samp[[i]], 0.1), rep(j, n)) lines(x = c(mean(samp[[i]]), mean(samp[[i]])), y = c(j - 0.1, j + 0.1)) } } } clt(x) # But it didn't quite work and I can see the problem occurs within the nested loop. Can anyone spot my mistake? Thank you very much in advance! 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] Interpreting knn Results
Hi, -Original Message- From: Liaw, Andy [mailto:[EMAIL PROTECTED] Maybe you should show your colleague how to access help pages in R? Right in ?knn, it says: prob: If this is true, the proportion of the votes for the winning class are returned as attribute 'prob'. so 1.0 mean all three NNs are of the `winning'; i.e., predicted, class, and 0.7 means 2 out of the 3 NNs are of the winning class, etc. Whoops sorry, I guess I should've known that *_*. She lost access to her email due to a technical problem and I was running to a tutorial so didn't have time to think. After my tutorial I looked at the results with her and figured it out*_* Thanks, 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] Interpreting knn Results
Hi, [I'm posting this on behalf of a colleague -- as I don't know knn myself...] How to interpret the knn() results? Tried the example codes in the documentation: data(iris3) train - rbind(iris3[1:25,,1], iris3[1:25,,2], iris3[1:25,,3]) test - rbind(iris3[26:50,,1], iris3[26:50,,2], iris3[26:50,,3]) cl - factor(c(rep(s,25), rep(c,25), rep(v,25))) knn(train, test, cl, k = 3, prob=TRUE) attributes(.Last.value) and got: $levels [1] c s v $class [1] factor $prob [1] 1.000 1.000 1.000 1.000 1.000 1.000 [7] 1.000 1.000 1.000 1.000 1.000 1.000 [13] 1.000 1.000 1.000 1.000 1.000 1.000 [19] 1.000 1.000 1.000 1.000 1.000 1.000 [25] 1.000 1.000 1.000 0.667 1.000 1.000 [31] 1.000 1.000 1.000 0.667 1.000 1.000 [37] 1.000 1.000 1.000 1.000 1.000 1.000 [43] 1.000 1.000 1.000 1.000 1.000 1.000 [49] 1.000 1.000 1.000 0.667 0.750 1.000 [55] 1.000 1.000 1.000 1.000 0.500 1.000 [61] 1.000 1.000 1.000 0.667 1.000 1.000 [67] 1.000 1.000 1.000 1.000 1.000 0.667 [73] 1.000 1.000 0.667 What do the prob mean? Thanks, 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] book recommendation
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fred J. Sent: Thursday, March 25, 2004 9:25 PM To: r help Subject: [R] book recommendation Hello right, I need a good book to help me with R. background, programming in matlab, perl, visualBasics. os windows and Linux. some good books to match the need would be appreciated. Perhaps http://www.r-project.org/doc/bib/R-publications.html would be a good place to start looking? You also need to be more specific. It's good that you have quite a few programming skills but what is it you want with R? Do you want to write functions/packages and contribute to the R community (in which case Chambers's Programming with Data, and VR's S Programming would be good choices)? Or do you just want to use R as a statistical application? In which case there are several, VR's MASS4 for example. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] failure in simple calculation!!
Hi, - Original Message - From: Mike Campana [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 11, 2004 12:20 PM Subject: [R] failure in simple calculation!! Hello I have a dataframe, at least I think I created it by using: DELTA - as.data.frame(DELTA) The dataframe has 2 columns made of numbers(data and delta) If I use DELTA$delta + 12 I get a sequence of NA Warning message: + not meaningful for factors in: Ops.factor(DELTA$deltatemp, 12) What does this mean? Can you explain me please why I can not make this simple calculation? And what can I do to the calculation? further information: mode(DELTA) [1] list DELTA$delta . [685] 6.04 7.84 8.01 8.43 6.6 6.33 8.42 8.86 10.25 8.2 9.32 9.77 [697] 7.9 6.42 5.95 474 Levels: -0.02 -0.13 -0.22 -0.46 -0.55 -1.26 -1.83 -1.86 -2.45 -3.2 ... 9.9 What does this last row mean? Several things. 1) DELTA is not a data frame here. It is a list: mode(DELTA) 2) DELTA$delta is not a vector. It is a factor. For some reason when you generated DELTA, your delta has become a factor. Arithematic operations on factors are meaningless. HTH. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] Identifying Multicollinearity in sparse datasets
Hi, Take a look at the car package, there is a function called vif. HTH, Kevin - Original Message - From: Briggs, Meredith M [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 11, 2004 1:43 PM Subject: [R] Identifying Multicollinearity in sparse datasets Hello Is there any package or method to identify multicollinearity in data of the sort below? thanks. Meredith DATA2.txt __ [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] Decision Trees
Hi, -Original Message- WEKA includes a re-implementation of the ideas behind C4.5, but not C4.5. If my memory serves me right, WEKA people called this re-implementation J4.8. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] LME, where is the package?
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Yong Wang Sent: Saturday, February 28, 2004 8:48 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [R] LME, where is the package? Hi, all My R 1.7.1 can not find lme, I just downloaded and installed the file lme4 from Crane, is this the same as lme? the problem is R still print no function named lme, how should I do. I believe you are looking for nlme package. Try to load it. 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] a loop question
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Susan Lin Sent: Saturday, February 28, 2004 10:10 AM To: [EMAIL PROTECTED] Subject: [R] a loop question I want to get three .gif image files test.1.gif, test.2.gif, test.3.gif by using a loop. The code I tried is like this: x=c(0, 1, 2, 3, 4) y=c(1, 2, 3, 4) for(i in 1:3) { x11() jpeg(test.i.gif) plot(x, y) dev.off() } but I only could get one image file, test.i.gif. How can I get three image files? How about (I haven't tried it) something like: jpeg(paste(test., i, .gif, sep = ) Ko-Kang Kevin Wang, MSc(Hon) SLC Stats Workshops Co-ordinator The University of Auckland New Zealand 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
[R] Collapsing Categorical Variables
Hi, Suppose I have a categorical variable called STREET, and I have 30 levels for it (i.e. 30 different streets). I want to find all those streets with only 15 observations or below then collapse them into a level called OTHER. Is there a quick way, other than using a for() loop, to do it? Currently what I'm doing is something like: ### Collapse STREET (those 15) st - c() STREET - as.vector(STREET) for(i in 1:length(STREET)) { if(STREET[i] == BOYNE AVE || STREET[i] == CHAPEL ST || STREET[i] == CONE PL || STREET[i] == LACEBARK LANE || STREET[i] == PRUDHOE LANE || STREET[i] == VIRGIL PL || STREET[i] == WILMOT ST ) st[i] - Other else st[i] - STREET[i] } But I'm sure there is a better way Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] (2) Questions
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 12:34 PM To: [EMAIL PROTECTED] Subject: [R] (2) Questions Hi Fellows from R-Help List! My questions are basic since i an new with R. I am very acquainted with Matlab Gauss (the compentence, I guess). Anyhow, (1) I am trying to get R execute comands made or built as text, so that one can feed a particular option with many variations coming from a text file. Is this possible with the free version? For instance, there exists the eval comand in Matlab, which executes the matlab comand in the text argument incoming thru eval. I think what you need to do first is to read the manuals. An Introduction to R would be a good start. There is no free version vs commercial version. R is open-sourced and you don't have to pay for it -- of course, donations are welcome by the R Foundation ;D. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] R won't start
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pål Anders Martinussen Sent: Friday, February 20, 2004 8:53 AM To: [EMAIL PROTECTED] Subject: [R] R won't start Hi, I have a problem with R; it won't start! I've installed it fine, no problems, but when I try to run it the mouse cursor changes to an hourglass for 1 second and back to normal, and that's it, it doesn't start up. No error messages or nothing. I run Windows XP Pro. by the way. What do you mean it won't start? Can you be more specific? Which icon did you click? Is it Rgui or Rterm (you should double click on Rgui) Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] How to write efficient R code
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 3:36 AM To: [EMAIL PROTECTED] Subject: [R] How to write efficient R code I have been lurking in this list a while and searching in the archives to find out how one learns to write fast R code. One solution seems to be to write part of the code not in R but in C. However after finding a benchmark article (http://www.sciviews.org/other/benchmark.htm) I have been more interested in making the R code itself more efficient. I would like to find more info about this. I have tried to mail the contact person for the benchmark, but I have so recieved no reply. One way to make your codes more efficient is to use vectorisation -- vectorise your codes. I'm not sure where you can find more information about it, but an example would be to use the apply() function on a data frame instead using a loop. Avoid loops if you can. 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] problem for installing package
Hi, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wassim Kamoum Sent: Tuesday, February 17, 2004 5:12 AM To: [EMAIL PROTECTED] Subject: [R] problem for installing package Hello I would like to install a package on R (splancs package) after downloading them what is the step for implementing them in my library? Which operating system are you running R on? Reading the manuals might be a good start. 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] plot
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Xi ZHU Sent: Tuesday, February 17, 2004 11:10 AM To: [EMAIL PROTECTED] Subject: [R] plot Hi, How could I plot two vectors on the same graph? For example, if I have two lists of results, each list is a vector. I want to display them on the same graph, so I can compare them. How could I do that? You have to be more specific. What kind of vertors are they? Are they both numeric continuous variables? What kind of plot(s) do you want to draw? Assuming you have two continuous variables and you want to draw a scatter plot, one way to do it is to use plot(). For example: plot(x, y) Take a loot at ?plot to find out how to use it. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] plot
-Original Message- From: Justin Xi ZHU [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 17, 2004 2:30 PM To: Ko-Kang Kevin Wang Subject: RE: [R] plot Hi, Thanks for your email. Result 1: 23, 234, 45, 39 corresponding to Q1, Q2, Q3 and Q4. Result 2: 123, 34, 454, 45 corresponding to Q1, Q2, Q3 and Q4. I would like to plot both result 1 and result 2 on the same graph. The x-axis is Q1, Q2, Q3 and Q4. I would like to compare two trends. Regards, Justin What you can do is to plot the question labels on the x-axis and use points (with different types/colours) and/or lies for the two Results. You may want to take a look at the documentation for plot(), points() or lines(). I'm sure there are better plots, but I'll leave that to the other r-helpers to help you -- I'm too busy finishing up a consulting report *_*. Cheers, Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] Basic Help
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marisa Ramos Sent: Friday, February 13, 2004 8:49 AM To: [EMAIL PROTECTED] Subject: [R] Basic Help OK I have been trying to learn how to use this program and I cannot even import any data into it. I have downloaded all the manuals but they do not seem to help. Is there a book on R for dummies??? Chapter 7 in An Introduction to R explains how to read the data in, it should be pretty goodif you're still unsure, look at the documentation for read.table() and scan(). Chapter 2 of my incomplete book, http://www.stat.auckland.ac.nz/~kwan022/pub/R/RBook/, has a short explanation about data structure in R. The chapter has sort of been complete (it's in the draft version) HTH, Kevin Wang Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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] PhD student reading list, suggestions wanted
Hi, [This is slightly offtopic as it has nothing to do with R, but I'm still sending it to the list in case someone else is interested]. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ernesto Jardim Sent: Tuesday, February 10, 2004 3:22 AM To: Mailing List R Subject: RE: [R] PhD student reading list, suggestions wanted Hi, What online references would you propose ? It depends on how much you already know about data mining. Two Crow's Introduction to Data Mining and Knowledge Discovery (http://www.twocrows. com/) might be a good introductory guide and is available for free download (it is a recommended reading at a Year 3 undergraduate course here at my university). Journal of Machine Learning Research (http://www.jmlr.org/) may have some useful article. My Master's Dissertation (http://www.stat.auckland.ac.nz/~kwan022/research.php) sort of briefly compared a few methods (neural net, decision trees and Logistic regression) and benchmarked them, but that is using SAS Enterprise Miner. If you want some data to try out data mining methods, the UCI Machine Learning Repository (http://www.ics.uci.edu/~mlearn/) is the best place to go. And finally, there is google;-D. 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] Printting 'for' and 'while' indices
Quoting Marcos Sanches [EMAIL PROTECTED]: I mean, I want something like this: i-0 While(i100){ do a lot of commands print i i-i+1 } How do I print the i at each step? Is print(i) what you want? Cheers, Kevin Ko-Kang Kevin Wang SLC Statistics Workshops Co-ordinator Student Learning Centre University of Auckland New Zealand - This mail sent through University of Auckland http://www.auckland.ac.nz/ __ [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] PhD student reading list, suggestions wanted
Hi, -Original Message- But above all, I would like her to use R whenever it's appropriate. We have MASS and Dalgaard's introductory book in the library here, I'm aware of S Poetry, but what do you think would be the best start for someone learning R in order to use it for doing data mining? Not specifically for R, but a must-have for anyone going into data mining area is The Elements of Statistical Learning: Data Mining, Inference, and Prediction, by Hastie et. al. 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] I am totally lost on how to install R . . .
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shoultz, Gerald Sent: Friday, February 06, 2004 8:19 AM To: [EMAIL PROTECTED] Subject: [R] I am totally lost on how to install R . . . Second, I am trying to install R on windows XP. In looking at the instruction manual I get the following: The simplest way is to use 'rw1081.exe' or 'miniR.exe'. Just double-click on the icon and follow the instructions. If you installed R this way you can uninstall it from the Control Panel. How do I get the rw1081.exe or miniR.exe? All I have right now is the R-latest.tgz file and I have absolutely NO idea on how to open or use that. Could someone point me to a clear, step-by-step method for installing R on my computer? Please advise; you may write me directly if you like. Which part of the manual were you looking at? I am assuming you meant the R for Windows FAQ, in which case, the section before How do I install R for Windows tells you where to get it! Take a look at http://cran.r-project.org/bin/windows/rw-FAQ.html#Where%20can%20I%20find%20 the%20latest%20version%3f 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] please help me!
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, January 30, 2004 5:19 AM To: [EMAIL PROTECTED] Subject: [R] please help me! hello there, I'm a new user to R and I am having difficulty reading a file into the program. Here's the error I keep getting, I bet there's a simple solution, but I cant find any... Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file `c:MikeWeather2.txt' How did you get this error message? It would help if you put your codes here. But I'm guessing it is because you typed something like: foo = read.table(C:\MikeWeather2.txt) Try to use C:/MikeWeather2.txt or C:\\MikeWeather2.txt. HTH. Kevin Ko-Kang Kevin Wang, MSc(Hon) Statistics Workshops Co-ordinator Student Learning Centre 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
[R] Julian Dates
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
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] strptime Usage
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] strptime Usage
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] read.table(..)..Help?
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
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
Re: [R] Program Saving
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] Two Y-axises and One X-axis
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)
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] interfacing C into R and R packages
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] Complete Newbie Q
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