[R] Where to find the source codes for the internal function in stats package

2009-01-16 Thread zhijie zhang
Dear all, I want to see the source codes for "dchisq(x, df, ncp=0, log = FALSE)", but cannot find it. I input "dchisq" in the R interface, and then enter, the following message return: > dchisq /*/ function (x, df, ncp = 0, log = FALSE) { if

Re: [R] splitting a string / finding a numeric value within a string

2009-01-16 Thread Gabor Grothendieck
The first one replaces non-numerics with the empty string and the second one returns numerics directly: gsub("[^0-9]", "", "test_01.log") # or library(gsubfn) strapply("test_01.log", "[0-9]+")[[1]] On Fri, Jan 16, 2009 at 11:00 PM, Jörg Groß wrote: > Hi, > > I have this variable; > > > x <- c("

Re: [R] splitting a string / finding a numeric value within a string

2009-01-16 Thread Jorge Ivan Velez
Dear Jörg, Try this: > gsub("^.*['_']|[.].*$", "", "test_01.log") [1] "01" > as.numeric(gsub("^.*['_']|[.].*$", "", "test_01.log")) [1] 1 HTH, Jorge On Fri, Jan 16, 2009 at 11:00 PM, Jörg Groß wrote: > Hi, > > I have this variable; > > > x <- c("test_01.log") > > > and I want to extract th

[R] splitting a string / finding a numeric value within a string

2009-01-16 Thread Jörg Groß
Hi, I have this variable; x <- c("test_01.log") and I want to extract the number (01) out of the variable. So that I get; > x [1] 1 I tried strsplit, but I don't know how to refer to the result. Can someone help me with that? [[alternative HTML version deleted]]

Re: [R] data.frame: how to extract parts

2009-01-16 Thread jim holtman
You are missing a comma. You are addressing the dataframe as if it were a matrix and you want to extract all the rows that match: only.male <- b[b$row1 == "male",] On Fri, Jan 16, 2009 at 9:57 PM, Jörg Groß wrote: > Hi, > > I have a problem with the R syntax. > It's perhaps pretty simple, but I

[R] data.frame: how to extract parts

2009-01-16 Thread Jörg Groß
Hi, I have a problem with the R syntax. It's perhaps pretty simple, but I don't understand it ... I can extract a column from a data.frame with the following code for example ... b$row1[b$row1 == "male"] so I see all male-entries. But I cannot extract all lines of a data.frame dependin

Re: [R] Winsorizing Multiple Variables

2009-01-16 Thread William Revelle
Thanks to Michael for giving a nice solution to Karl's question . This identified a bug in the psych package winsor function which has now been fixed in version 1.0.63. (The current development version). Although my winsor.means function in 1.0..62 (and ealier) worked correctly, my winsor fu

Re: [R] Fitting of lognormal distribution to lower tail experimental data

2009-01-16 Thread Göran Broström
On Sat, Jan 17, 2009 at 12:27 AM, Göran Broström wrote: > On Fri, Jan 16, 2009 at 3:31 PM, Mattias Brännström > wrote: >> Thank you, David! >> >> I agree and apprechiate your analysis, which definitely will influence my >> analysis of this data, but still I would like you to disregard from it(!)

Re: [R] Fitting of lognormal distribution to lower tail experimental data

2009-01-16 Thread Göran Broström
On Fri, Jan 16, 2009 at 3:31 PM, Mattias Brännström wrote: > Thank you, David! > > I agree and apprechiate your analysis, which definitely will influence my > analysis of this data, but still I would like you to disregard from it(!) > > The standard routine in the field is, beyond my control, to a

Re: [R] storing several arima models

2009-01-16 Thread Stephan Kolassa
Does a list of arima models help? foo <- list() foo[[1]] <- arima(...) foo[[2]] <- arima(...) HTH, Stephan diego Diego schrieb: Hello everyone! I'm kind of a new R user and I'm trying to store several arima models (as arima models not as lists) in something (vector, matrix, whatever)... i've

Re: [R] specifying model terms when using predict

2009-01-16 Thread Marc Schwartz
on 01/16/2009 03:44 PM David Winsemius wrote: > > On Jan 16, 2009, at 4:30 PM, Marc Schwartz wrote: > >> on 01/16/2009 02:20 PM VanHezewijk, Brian wrote: >>> I've recently encountered an issue when trying to use the predict.glm >>> function. >>> >>> >>> >>> I've gotten into the habit of using the

[R] storing several arima models

2009-01-16 Thread diego Diego
Hello everyone! I'm kind of a new R user and I'm trying to store several arima models (as arima models not as lists) in something (vector, matrix, whatever)... i've tried several things but nothing seems to work the way I need. Ideally I need a vector (or something) whose entries are Arima class

Re: [R] specifying model terms when using predict

2009-01-16 Thread David Winsemius
On Jan 16, 2009, at 4:30 PM, Marc Schwartz wrote: on 01/16/2009 02:20 PM VanHezewijk, Brian wrote: I've recently encountered an issue when trying to use the predict.glm function. I've gotten into the habit of using the dataframe$variablename method of specifying terms in my model stateme

Re: [R] specifying model terms when using predict

2009-01-16 Thread Marc Schwartz
on 01/16/2009 02:20 PM VanHezewijk, Brian wrote: > I've recently encountered an issue when trying to use the predict.glm > function. > > > > I've gotten into the habit of using the dataframe$variablename method of > specifying terms in my model statements. I thought this unambiguous > notation

Re: [R] Winsorizing Multiple Variables

2009-01-16 Thread Michael Conklin
Don't sort y. Calculate xbot and xtop using xtemp<-quantile(y,c(tr,1-tr),na.rm=na.rm) xbot<-xtemp[1] xtop<-xtemp[2] -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Karl Healey Sent: Friday, January 16, 2009 2:51 PM To: r-help@r-proj

Re: [R] Efficiency challenge: MANY subsets

2009-01-16 Thread jim holtman
Try this one; it is doing a list of 7000 in under 2 seconds: > sequences <- list( + + + c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T","Y","L","L","I" + ,"M", + + + "N","H","K","L","L","L","I","N","N","N","N","L","T","E","V","H","T","Y","F", "N","I","N","I","N","I","D","K","M","Y","

[R] Barchart in lattice package: controlling order of bars in plot and color of a selected bar

2009-01-16 Thread Matthew Pettis
Hi, I'm using the lattice function 'barchart' to make a series of 4 histograms. Currently, the y-axis values are graphed in order of the y-axis variable. I'd like to have the y-axis values sorted in ascending order of the x-axis values so that the longest bar horizontally is on top of the graph

Re: [R] Winsorizing Multiple Variables

2009-01-16 Thread David Winsemius
Might work better to determine top and bottom for each column with quantile() using an appropriate quantile option, and then process each variable "in place" with your ifelse logic. I did find a somewhat different definition of winsorization with no sorting in this code copied from a Patri

[R] matching more than two vectors (?)

2009-01-16 Thread Juliane Struve
Dear listmembers,   I am trying to obtain values for pointdistance from another dataframe by matching UTMX and UTMY coordinates, but I am not sure how to introduce the second coordinate.   PointDF$pointdistance=DistanceDF$distance[match(PointDF$UTMX,DistanceDF$UTMX & PointDF$UTMY,DistanceDF$UTM

Re: [R] Smooth periodic splines

2009-01-16 Thread Spencer Graves
1. RSiteSearch('{periodic spline}') produced 12 hits. I looked at the first five and found that four of them seemed relevant to your question. 2. The third hit in this list notes that the DierckxSpline package has periodic splines, while 'fda' recommends finite Fourier series for

[R] Winsorizing Multiple Variables

2009-01-16 Thread Karl Healey
Hi All, I want to take a matrix (or data frame) and winsorize each variable. So I can, for example, correlate the winsorized variables. The code below will winsorize a single vector, but when applied to several vectors, each ends up sorted independently in ascending order so that a given

Re: [R] Lattice: how to have multiple wireframe nice intersection?

2009-01-16 Thread David Winsemius
On Jan 16, 2009, at 9:43 AM, Guillaume Chapron wrote: Hello, This code builds a simple example of 2 wireframes : require(lattice) x <- c(1:10) y <- c(1:10) g <- expand.grid(x = 1:10, y = 1:10, gr = 1:2) g$z <- c(as.vector(outer(x,y,"*")), rep(50,100)) wireframe(z ~ x * y, data = g, groups = g

[R] User input in batch mode

2009-01-16 Thread Sebastien Bihorel
__ R-help@r-project.org 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.

[R] Error when running Kendall Package

2009-01-16 Thread gqkou
I am new to R and am trying to run data through using the Kendall package. My first question is that I have NA values for certain criterias, will that be a problem or will they be ignored? ie:FallSpring Summer 1988 NA 1.321 1.564 1999 1.333 1.452NA W

Re: [R] bootstrap validation of LR error message

2009-01-16 Thread Marc Schwartz
on 01/16/2009 02:19 PM A Van Dyke wrote: > when i try to validate my logistic regression model: > > fit<-glm(y~x,binomial,data=dataname,x=TRUE,y=TRUE) > validate(fit,method="boot",B=150,...) > > i get the following error message: > > Error in UseMethod("validate") : no applicable method for "val

Re: [R] Efficiency challenge: MANY subsets

2009-01-16 Thread Johannes Graumann
Thanks. Very elegant, but doesn't solve the problem of the outer "for" loop, since I now would rewrite the code like so: fragments <- list() for(iN in seq(length(sequences))){ cat(paste(iN,"\n")) fragments[[iN]] <- lapply(indexes[[1]], function(g)sequences[[1]][do.call(seq, as.list(g))])

[R] specifying model terms when using predict

2009-01-16 Thread VanHezewijk, Brian
I've recently encountered an issue when trying to use the predict.glm function. I've gotten into the habit of using the dataframe$variablename method of specifying terms in my model statements. I thought this unambiguous notation would be acceptable in all situations but it seems models writte

[R] bootstrap validation of LR error message

2009-01-16 Thread A Van Dyke
when i try to validate my logistic regression model: fit<-glm(y~x,binomial,data=dataname,x=TRUE,y=TRUE) validate(fit,method="boot",B=150,...) i get the following error message: Error in UseMethod("validate") : no applicable method for "validate" any insight would be appreciated. many thanks!

Re: [R] Memory allocation

2009-01-16 Thread Duncan Murdoch
On 1/16/2009 12:46 PM, Gabriel Margarido wrote: Hello everyone, I have the following issue: one function generates a very big array (can be more than 1 Gb) and returns a few variables, including this big one. Memory allocation is OK while the function is running, but the final steps make some co

Re: [R] Missing file to run Rcmd batch on Windows

2009-01-16 Thread Gabor Grothendieck
Regarding Perl, the batchfiles distribution batch files do not use Perl but R's own Rcmd.exe does. Based on comments recently I understand that Perl will be eliminated from the R batch scripts soon but in the meantime if you install Rtools (which is a set of tools that includes perl and is simple

[R] PHP and R

2009-01-16 Thread Applejus
Hi, I know I've already asked this question, but I am really getting trouble getting a PHP document execute an R function on windows. I would appreciate if someone could give me a simple example code where a php calls an R function and passes to it arguments, specifying also how to set up the p

[R] glmer documentation

2009-01-16 Thread Raphaelle
Hello, I am fitting a gmler using poisson, and I was looking for a documentation to interpret correctly the output. I'm quite a beginner with these kind of models. I couldn't find something in the lme4 package manual. and on the internet neither... Thank you, Raphaelle -- View this message in

[R] Memory allocation

2009-01-16 Thread Gabriel Margarido
Hello everyone, I have the following issue: one function generates a very big array (can be more than 1 Gb) and returns a few variables, including this big one. Memory allocation is OK while the function is running, but the final steps make some copies that can be problematic. I looked for a way t

Re: [R] installing mclust and flexmix on linux

2009-01-16 Thread Uwe Ligges
Tim F Liao wrote: I've been trying to install some R packages such as mclust and flexmix on linux but have had the following error messages. I've been trying to install mclust on my notebook which has linpus linux lite os and I have installed R as well as some packages all right. However,

Re: [R] Updating packages under R 2.8.1

2009-01-16 Thread Uwe Ligges
Henning Wildhagen wrote: Dear users, i just installed the lastest version of R, 2.8.1 on my computer (OS Windows XP). Then i tried to update the packages copied from my old R version by update.packages(ask=F) However i get the following warning: "Warning: unable to access index for repo

Re: [R] faster version of split()?

2009-01-16 Thread Peter Dalgaard
Simon Pickett wrote: Hi all, I want to calculate the number of unique observations of "y" in each level of "x" from my data frame "df". this does the job but it is very slow for this big data frame (159503 rows, 11 columns). group.list <- split(df$y,df$x) count <- function(x) length(un

Re: [R] problems with extractPrediction in package caret

2009-01-16 Thread Max Kuhn
The issue is the usage of extractPrediction. expred <- extractPrediction(rftrain) should really be expred <- extractPrediction(list(rftrain)) Since this function is intended to get predictions across multiple models, the man file has a description of the first argument to teh funtion bein

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Marc Schwartz
on 01/16/2009 11:34 AM David Winsemius wrote: > Looking at the display I see this line: > > \texttt{Typewriter Font has ``double quotes''} > > ... displayed with leading but trailing . Was > that intended? David, That is correct. If using Emacs with Auctex or another LaTeX aware editor, when y

[R] Weighted Kaplan-Meier Statistics

2009-01-16 Thread Ritwik Sinha
Dear All, I could not locate an implementation of the Weighted Kaplan-Meier Statistics proposed by Pepe and Fleming, Biometrics. 1989 Jun;45(2):497-507 (http://www.ncbi.nlm.nih.gov/pubmed/2765634) in R. I am wondering if anyone is aware of a R implementation of the test statistics proposed in the

Re: [R] Using "optim" with exponential power distribution

2009-01-16 Thread Stefan Evert
I know "optim" should do a minimisation, therefor I used as the optimisation function opt.power <- function(val, x, y) { a <- val[1]; b <- val[2]; sum(y - b/(2*pi*a^2*gamma(2/b))*exp(-(x/a)^b)); } I call: (with xm and ym the data from the table) a1 <- c(0.2, 100) opt <- optim(a1, opt.powe

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread David Winsemius
Looking at the display I see this line: \texttt{Typewriter Font has ``double quotes''} ... displayed with leading but trailing . Was that intended? -- David Winsemius On Jan 16, 2009, at 12:21 PM, Paul Johnson wrote: On Fri, Jan 16, 2009 at 10:43 AM, David Winsemius wrote: Dear Dr Johns

Re: [R] (no subject)

2009-01-16 Thread milton ruser
Dear Henning, Try other repositories. Best wishes, miltinho brazil On Fri, Jan 16, 2009 at 2:08 PM, Henning Wildhagen wrote: > Dear users, > > i just installed the lastest version of R, 2.8.1 on my computer (OS Windows > XP). Then i tried to update the packages copied from my old R version by >

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
On Fri, Jan 16, 2009 at 11:06 AM, Vincent Goulet wrote: > Paul, > > The file did not make it to the list. > > Did you try loading Sweave with the 'noae' option, that is: > >\usepackage[noae]{Sweave} > > This *may* solve your issue. > > HTH Vincent > Wow. That does fix it. I bow to you. I

[R] Updating packages under R 2.8.1

2009-01-16 Thread Henning Wildhagen
Dear users, i just installed the lastest version of R, 2.8.1 on my computer (OS Windows XP). Then i tried to update the packages copied from my old R version by >update.packages(ask=F) However i get the following warning: "Warning: unable to access index for repository http://cran.ch.r-projec

Re: [R] faster version of split()?

2009-01-16 Thread David Winsemius
Henrique's solution seems sensible. Another might be: > df = data.frame(x = sample(7:9, 10, rep = T), y = sample(1:5, 10, rep = T)) > table(df) y x 1 2 3 4 5 7 1 0 1 0 2 8 0 1 0 0 1 9 0 1 1 2 0 > rowSums(table(df) >0) 7 8 9 3 2 3 #-same as Henrique's > count <- fu

[R] Using "optim" with exponential power distribution

2009-01-16 Thread Ronald Bialozyt
Hello, I am trying to fit a exponential power distribution y = b/(2*pi*a^2*gamma(2/b))*exp(-(x/a)^b) to a bunch of data for x and y I have in a table. > data x y 1 2527 2 7559 3125 219 ... 25912925 1 26012975

[R] (no subject)

2009-01-16 Thread ursachi
Dear all, Can anybody help me with an RExcel tutorial? Maybe some example on which functions can be used/how to use it... I have installed it on my computer, using the R(D)COM server. Thank you all in advance, Irina Ursachi. __ R-help@r-project.org mai

[R] installing mclust and flexmix on linux

2009-01-16 Thread Tim F Liao
I've been trying to install some R packages such as mclust and flexmix on linux but have had the following error messages. > I've been trying to install mclust on my notebook which has linpus linux lite > os and I have installed R as well as some packages all right. However, when > I tried to

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
On Fri, Jan 16, 2009 at 10:43 AM, David Winsemius wrote: > Dear Dr Johnson; > > > I'm not sure if you get copies of your posts. If you do can you check to see > if the list-server kept the attachment? My copy did not have one. > > -- > Best > David winsemius Hm. Well, I do get the attachment, an

[R] (no subject)

2009-01-16 Thread Henning Wildhagen
Dear users, i just installed the lastest version of R, 2.8.1 on my computer (OS Windows XP). Then i tried to update the packages copied from my old R version by >update.packages(ask=F) However i get the following warning: "Warning: unable to access index for repository http://cran.ch.r-projec

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Vincent Goulet
Paul, The file did not make it to the list. Did you try loading Sweave with the 'noae' option, that is: \usepackage[noae]{Sweave} This *may* solve your issue. HTH Vincent Le ven. 16 janv. à 11:31, Paul Johnson a écrit : I'm attaching a file foo.Rnw and I'm hoping some of you might

Re: [R] Sweave documents have corrupted double quotes

2009-01-16 Thread Ben Bolker
Paul Johnson gmail.com> writes: > > I'm attaching a file foo.Rnw and I'm hoping some of you might run it > through your R & latex systems to find out if the double-quotes in > typewriter font turn out as black boxes (as they do for me). If you > don't use Sweave, but you have a system with a wo

[R] Sweave documents have corrupted double quotes

2009-01-16 Thread Paul Johnson
I'm attaching a file foo.Rnw and I'm hoping some of you might run it through your R & latex systems to find out if the double-quotes in typewriter font turn out as black boxes (as they do for me). If you don't use Sweave, but you have a system with a working version of R and LaTeX, the file gives

Re: [R] Use of [:alnum:] or . in gsub() etc..

2009-01-16 Thread Marc Schwartz
on 01/16/2009 10:13 AM ppaarrkk wrote: > > test = c ( "AAABBB", "CCC" ) > > > This works : > > gsub ( "[A-Z]", "2", test ) > > > > None of these do : > > gsub ( "[A-Z]", [:alnum:], test ) > gsub ( "[A-Z]", [[:alnum:]], test ) > gsub ( "[A-Z]", "[:alnum:]", test ) > gsub ( "[A-Z]", "[[:alnum

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gabor Grothendieck
If "that" refers to using a database on disk to temporarily hold the file then example 6 on the home page shows it, as mentioned, and you may wish to look at the other examples there too and there is further documentation in the ?sqldf help file. On Fri, Jan 16, 2009 at 11:11 AM, Gundala Viswanath

[R] Use of [:alnum:] or . in gsub() etc..

2009-01-16 Thread ppaarrkk
test = c ( "AAABBB", "CCC" ) This works : gsub ( "[A-Z]", "2", test ) None of these do : gsub ( "[A-Z]", [:alnum:], test ) gsub ( "[A-Z]", [[:alnum:]], test ) gsub ( "[A-Z]", "[:alnum:]", test ) gsub ( "[A-Z]", "[[:alnum:]]", test ) gsub ( "[A-Z]", "^[:alnum:]$", test ) What am I doing

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gundala Viswanath
Hi, > Unless you specify an in-memory database the database is stored on disk. Thanks for your explanation. I just downloaded 'sqldf'. Where can I find the option for that? In sqldf I can't see the command. I looked at: envir = parent.frame() doesn't appear to be the one. - Gundala Viswanath

Re: [R] Missing file to run Rcmd batch on Windows

2009-01-16 Thread Duncan Murdoch
On 1/16/2009 10:51 AM, Brigid Mooney wrote: Hi, I'm trying to run an R script using Rcmd Batch from the command line on a Windows Vista machine. I am using R version 2.8.1. I installed the batch files 4-3 found at http://cran.r-project.org/contrib/extra/batchfiles/ and added them to my path. I

Re: [R] Missing file to run Rcmd batch on Windows

2009-01-16 Thread Gabor Grothendieck
Try writing BATCH in upper case. On Fri, Jan 16, 2009 at 10:51 AM, Brigid Mooney wrote: > Hi, > > I'm trying to run an R script using Rcmd Batch from the command line on a > Windows Vista machine. I am using R version 2.8.1. > > I installed the batch files 4-3 found at > http://cran.r-project.o

[R] Missing file to run Rcmd batch on Windows

2009-01-16 Thread Brigid Mooney
Hi, I'm trying to run an R script using Rcmd Batch from the command line on a Windows Vista machine. I am using R version 2.8.1. I installed the batch files 4-3 found at http://cran.r-project.org/contrib/extra/batchfiles/ and added them to my path. I also had to install the latest version of per

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gabor Grothendieck
Only the portion your extract is ever in R -- the file itself is read into a database without ever going through R so your memory requirements correspond to what you extract, not the size of the file. On Fri, Jan 16, 2009 at 10:49 AM, Gundala Viswanath wrote: > Hi Gabor, > > Do you mean storing d

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gundala Viswanath
Hi Gabor, Do you mean storing data in "sqldf', doesn't take memory? For example, I have 3GB data file. with standard R object using read.table() the object size will explode twice ~6GB. My current 4GB RAM cannot handle that. Do you mean with "sqldf", this is not the issue? Why is that? Sorry for

Re: [R] autocorrelation

2009-01-16 Thread Michael Denslow
> > Hi > Is any multiple regression-like test with correction for > autocorrelation ? If I understand your question, yes. Take a look at the spdep package for starters. Also you may find the following references helpful. Dormann et al. 2007. Methods to account for spatial autocorrelation in t

Re: [R] Predictions with GAM

2009-01-16 Thread Ken Knoblauch
Ken Knoblauch inserm.fr> writes: > Robbert Langenberg gmail.com> writes: > > I am trying to get a prediction of my GAM on a response type. So that I > > eventually get plots with the correct values on my ylab. > > The problem I am encountering now is that I cannot seem to get it done for > > the

Re: [R] Fitting of lognormal distribution to lower tail experimental data

2009-01-16 Thread Mattias Brännström
Thank you, David! I agree and apprechiate your analysis, which definitely will influence my analysis of this data, but still I would like you to disregard from it(!) The standard routine in the field is, beyond my control, to assume lognormal distribution to achieve comparable results also with o

Re: [R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Ivan Alves
Hi, On my system (see below), it works fine (inputing the code below at the R prompt). Make sure that the encoding of the input file is encoded UTF-8. Rgds, Ivan > sessionInfo() R version 2.8.1 Patched (2009-01-14 r47602) i386-apple-darwin9.6.0 locale: en_GB.UTF-8/en_GB.UTF-8/C/C/en_GB.

[R] Odp: basic boxplot questions

2009-01-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.01.2009 15:24:26: > dear R experts: > > I am playing with boxplots for the first time. most of it is > intuitive, although there was less info on the web than I had hoped. > > alas, for some odd reason, my R boxplots have some fat black dots, not >

[R] Lattice: how to have multiple wireframe nice intersection?

2009-01-16 Thread Guillaume Chapron
Hello, This code builds a simple example of 2 wireframes : require(lattice) x <- c(1:10) y <- c(1:10) g <- expand.grid(x = 1:10, y = 1:10, gr = 1:2) g$z <- c(as.vector(outer(x,y,"*")), rep(50,100)) wireframe(z ~ x * y, data = g, groups = gr, scales = list(arrows = FALSE)) However, the inters

Re: [R] Predictions with GAM

2009-01-16 Thread Ken Knoblauch
Hi, Robbert Langenberg gmail.com> writes: > I am trying to get a prediction of my GAM on a response type. So that I > eventually get plots with the correct values on my ylab. > The problem I am encountering now is that I cannot seem to get it done for > the following type of model: > > *model3<-

Re: [R] How to create a chromosome location map by locus ID

2009-01-16 Thread Martin Morgan
Sake writes: > Neil Shephard wrote: >> >> >> >> Whats wrong with things like the HapMap Genome Browser that allows you to >> zoom in and out and to produce customised annotations of chromosomal >> regions at varying resolutions (see http://www.hapmap.org/)? Of course >> I'm assuming that you

Re: [R] basic boxplot questions

2009-01-16 Thread K. Elo
Hi Ivo, ivo welch wrote: > alas, for some odd reason, my R boxplots have some fat black dots, not > just the hollow outlier plots. Is there a description of when R draws > hollow vs. fat dots somewhere? > [and what is the parameter to change just the size of these dots?] Have you tried the comma

Re: [R] basic boxplot questions

2009-01-16 Thread K. Elo
ivo welch kirjoitti: > dear R experts: > > I am playing with boxplots for the first time. most of it is > intuitive, although there was less info on the web than I had hoped. > > alas, for some odd reason, my R boxplots have some fat black dots, not > just the hollow outlier plots. Is there a d

Re: [R] reading data from Excel Spread sheet

2009-01-16 Thread Pedro Mardones
or maybe by using the xlsReadWrite package: mydata <- read.xls("mydata.xls", sheet = 'Sheet1") On Fri, Jan 16, 2009 at 4:32 AM, venkata kirankumar wrote: > Hi all, > > I tried to read data from Excel spread sheet with using > > read.csv(file.choose()) > and > read.delim(file.choose()) > but

Re: [R] Predictions with GAM

2009-01-16 Thread Robbert Langenberg
Thanks for the swift reply, I might have been a bit sloppy with describing my datasets and problem. I showed the first model as an example of the type of GAM that I had been able to use the predict function on. What I am looking for is how to predict my m3: model3<-gam(y_no~s(day,by=mapID),family=

[R] basic boxplot questions

2009-01-16 Thread ivo welch
dear R experts: I am playing with boxplots for the first time. most of it is intuitive, although there was less info on the web than I had hoped. alas, for some odd reason, my R boxplots have some fat black dots, not just the hollow outlier plots. Is there a description of when R draws hollow v

Re: [R] [R-SIG-Mac] data frames with å, ä , and ö (=non-ASCII-characters) from win dows to mac os x

2009-01-16 Thread Prof Brian Ripley
You need to use CP1252 not UTF-8 to read the data. It tells you how to do so on the help page ... under 'encoding'. So something like A <- read.table(con <- file("myfile", encoding="CP1252"));close(con) Please don't cross-post ... I am being brief because you did. On Fri, 16 Jan 2009, Gusta

Re: [R] Efficiency challenge: MANY subsets

2009-01-16 Thread Henrique Dallazuanna
Try this: lapply(indexes[[1]], function(g)sequences[[1]][do.call(seq, as.list(g))]) On Fri, Jan 16, 2009 at 11:06 AM, Johannes Graumann < johannes_graum...@web.de> wrote: > Hello, > > I have a list of character vectors like this: > > sequences <- list( > > > c("M","G","L","W","I","S","F","G","

Re: [R] Efficiency challenge: MANY subsets

2009-01-16 Thread Jorge Ivan Velez
Dear Johannes, Try this: sequences <- c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T", "Y","L","L","I","M","N","H","K","L","L","L","I","N","N","N","N","L","T","E","V", "H","T","Y","F","N","I","N","I","N","I","D","K","M","Y","I","H","*") indexes <- matrix(c(1,22,22,46,46,51,1,46,22,51,1

[R] data frames with å, ä, and ö (=n on-ASCII-characters) from windows to mac os x

2009-01-16 Thread Gustaf Rydevik
Hi, I ran into this issue previously and managed to solve it, but I've forgotten how and am getting frustrated... I have a data frame (see below) with scandinavian characters in R (2.7.1) running on a Win Xp-computer. I save the data frame in an RData-file on a usb stick, and load() it in R (2.8.0

Re: [R] function return output

2009-01-16 Thread David Winsemius
On Jan 16, 2009, at 5:22 AM, threshold wrote: Hi, I wrote the function which outputs a matrix 'c' and a single value 'd', as follows (simplified example): procedure <- function(a,b){ ... list(c,d) } now I want to use 'c' and 'd' in code as follows: d <- matrix(0,1,1) value <- procedure(a,b)

[R] Efficiency challenge: MANY subsets

2009-01-16 Thread Johannes Graumann
Hello, I have a list of character vectors like this: sequences <- list( c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T","Y","L","L","I","M", "N","H","K","L","L","L","I","N","N","N","N","L","T","E","V","H","T","Y","F", "N","I","N","I","N","I","D","K","M","Y","I","H","*") ) and ano

Re: [R] Predictions with GAM

2009-01-16 Thread Gavin Simpson
On Fri, 2009-01-16 at 12:36 +0100, Robbert Langenberg wrote: > Dear, > > I am trying to get a prediction of my GAM on a response type. So that I > eventually get plots with the correct values on my ylab. > I have been able to get some of my GAM's working with the example shown > below: > * > model

Re: [R] reading data from Excel Spread sheet

2009-01-16 Thread John Sorkin
Kiran, One, not very elegant way, to solve your problem is to first save the Excel spreadsheet as a CSV file (open the Excel file in Excel and the use file->save as CSV, i.e. xxx.CSV) and then use read.csv() John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Mary

Re: [R] re name vector

2009-01-16 Thread Gabor Grothendieck
Its a FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f On Fri, Jan 16, 2009 at 6:58 AM, canadiangirl19 wrote: > > I´m a really R beginer, > > so I have a simply question. > > I would like to rename a vector in a loop. > > I´d like to have as output: >

[R] re name vector

2009-01-16 Thread canadiangirl19
I´m a really R beginer, so I have a simply question. I would like to rename a vector in a loop. I´d like to have as output: vector1<-whatever vector2<-whatever vector3<-whatever etc.. so I thought it´s easily for (s in c(1:3)){ vector"n"<- whatever } but I´m getting an error. cheers -- Vie

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Gabor Grothendieck
On Fri, Jan 16, 2009 at 5:52 AM, r...@quantide.com wrote: > I agree on the database solution. > Database are the rigth tool to solve this kind of problem. > Only consider the start up cost of setting up the database. This could be a > very time consuming task if someone is not familiar with databa

Re: [R] Smooth periodic splines

2009-01-16 Thread Duncan Murdoch
cmr.p...@gmail.com wrote: Hello group! Is there a package that allows to fit smooth *periodic* splines to data? I'm interested in a function which combines the functionality of smooth.spline and splines::periodicSpline. I don't know one, but you could use the same technique that periodicSp

[R] Predictions with GAM

2009-01-16 Thread Robbert Langenberg
Dear, I am trying to get a prediction of my GAM on a response type. So that I eventually get plots with the correct values on my ylab. I have been able to get some of my GAM's working with the example shown below: * model1<-gam(nsdall ~ s(jdaylitr2), data=datansd) newd1 <- data.frame(jdaylitr2=(24

Re: [R] PDF slided (beamer or prosper) to an editable PPT

2009-01-16 Thread Neil Shephard
zubin-2 wrote: > > Hello, I am getting requests to place our PDF slides (output from > beamer) into Microsoft Powerpoint formats (.ppt). What's the best > practice or any recommended software packages (any success with open or > commercial) that we can use to convert PDF slides into an EDIT

Re: [R] How to create a chromosome location map by locus ID

2009-01-16 Thread Sake
Neil Shephard wrote: > > > > Whats wrong with things like the HapMap Genome Browser that allows you to > zoom in and out and to produce customised annotations of chromosomal > regions at varying resolutions (see http://www.hapmap.org/)? Of course > I'm assuming that you are looking at human

Re: [R] How to create a chromosome location map by locus ID

2009-01-16 Thread Neil Shephard
Sake wrote: > > Hi, > > I'm trying to make a chromosomal map in R by using the locus. I have a > list of genes and their locus, and I want to visualise that so you can see > if there are multiple genes on a specific place on a chromosome. A example > of what I more or less want is below: > ht

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Wacek Kusnierczyk
r...@quantide.com wrote: > I agree on the database solution. > Database are the rigth tool to solve this kind of problem. > Only consider the start up cost of setting up the database. This could > be a very time consuming task if someone is not familiar with database > technology. and won't pay if

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Wacek Kusnierczyk
r...@quantide.com wrote: > > Using file() is not a real reading of all the file. This function will > simply open a connection to the file without reading it. > countLines should do something lile "wc -l" from a bash shell just for a test: cat(rep('', 10^7), file='test.txt', fill=1) library(R.ut

Re: [R] Adressing list-elements

2009-01-16 Thread Uwe Ligges
Thomas Schwander wrote: Dear all, I'm using R 2.8.1 under Vista. I programmed a Simulation with the code enclosed at the end of the eMail. After the simulation I want to analyse the columns of the single simulation-runs, i.e. e.g. Simulation[[1]][,1] sth. like that but I cannot address thes

Re: [R] function return output

2009-01-16 Thread Uwe Ligges
threshold wrote: Hi, I wrote the function which outputs a matrix 'c' and a single value 'd', as follows (simplified example): procedure <- function(a,b){ ... list(c,d) } now I want to use 'c' and 'd' in code as follows: d <- matrix(0,1,1) value <- procedure(a,b) and d[1,1] <- value[2] breaks te

Re: [R] [r] How to Solve the Error( error:cannot allocate vector of size 1.1 Gb)

2009-01-16 Thread Uwe Ligges
Kum-Hoe Hwang wrote: Hi, Gurus Thanks to your good helps, I have managed starting the use of a text mining package so called "tm" in R under the OS of Win XP. However, during running the tm package, I got another mine like memory problem. What is a the best way to solve this memory problem a

Re: [R] problems with extractPrediction in package caret

2009-01-16 Thread Uwe Ligges
Häring, Tim (LWF) wrote: Hi list, I´m working on a predictive modeling task using the caret package. I found the best model parameters using the train() and trainControl() command. Now I want to evaluate my model and make predictions on a test dataset. I tried to follow the instructions in t

Re: [R] faster version of split()?

2009-01-16 Thread Søren Højsgaard
Hi, R version 2.2.1 is slightly old. You may want to upgrade to the current version, R.2.8.1!!! You can for example do library(doBy) dd <- data.frame(x=c(1,1,1,2,2,2), y=c(1,1,2, 1,1,1)) summaryBy(y~x, data=dd, FUN=function(x)length(unique(x))) Regards Søren -Oprindelig meddelelse-

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread r...@quantide.com
I agree on the database solution. Database are the rigth tool to solve this kind of problem. Only consider the start up cost of setting up the database. This could be a very time consuming task if someone is not familiar with database technology. Using file() is not a real reading of all the f

Re: [R] Value Lookup from File without Slurping

2009-01-16 Thread Wacek Kusnierczyk
if the file is really large, reading it twice may add considerable penalty: r...@quantide.com wrote: > Something like this should work > > library(R.utils) > out = numeric() > qr = c("AAC", "ATT") > n =countLines("test.txt") # 1st pass > file = file("test.txt", "r") > for (i in 1:n){ # 2nd pass

  1   2   >