Re: [R] Help creating a correlation matrix

2008-05-21 Thread Moshe Olshansky
Hi, I tried the following one: z - outer(1:14,1:14,function(i,j) eval(parse(text=paste(cor(D2_,i,,D2_,j,),sep= but this doen not work (why?). Two alternatives which work are either x - matrix(0,length(D2_1,14) for (i in 1:14) x[,i] - eval(parse(text=paste(D2_,i,sep=))) z - cor(x) or z -

[R] an unknown error message when using gamm function

2008-05-21 Thread Lung-Chang Chien
Dear everyone, I'm encountering an unknown error message when using gamm function: fitoutput - gamm(cvd~as.factor(dow)+pm10+s(time,bs=cr,k=15,fx=TRUE)+s(tmean,bs=cr,k=7,fx=TRUE) + ,correlation=corAR1(form=~1|city),family=poisson,random=list(city=~pm10),data=mimp) Maximum number of

[R] R help needed

2008-05-21 Thread Kamlesh Kumar
Dear Sir/Madam, I have tried to upload data in R but it showing some error in command window. It's should be noted that I am using Mac version of R. I am using Mac-text for writing my data. I am getting following message on the command window.

Re: [R] R help needed

2008-05-21 Thread Simon Blomberg
Try: dat - read.table(/Users/kamleshkumar/Desktop/DS1.txt, header=TRUE) Please also read the F documentation. The use of read.table is in An Introduction to R for example. Simon. On Wed, 2008-05-21 at 08:13 +0200, Kamlesh Kumar wrote: Dear Sir/Madam, I have tried to upload data

Re: [R] Converting Data Types

2008-05-21 Thread Martin Maechler
EW == Edward Wijaya [EMAIL PROTECTED] on Wed, 21 May 2008 11:52:17 +0900 writes: EW Hi Peter, EW Thanks. EW as.matrix() does the trick. and ... again my perennial remark to the above trick : Do use data.matrix(dd) instead of as.matrix(dd) if dd is a data

[R] Insufficient memory

2008-05-21 Thread Roy Williams
Dear Sir/Madam, I have only started using a R-written script for modeling the distribution of disease vector species. Part of the script is to make a large GIS grid for use with GIS software, but it seems I have a memory problem. I get the following message: Reached total allocation of

[R] Problem in converting natural numbers to bits and others

2008-05-21 Thread Jason Lee
Hi, I just started using R for about one week and I have few problems. i)I have a problem in finding right function to convert a table of natural numbers to bitwise. For a simple example; I have the below table:- Column Col1 Col2 Col3 Sample1 57 10 Sample2 02 1

Re: [R] an unknown error message when using gamm function

2008-05-21 Thread Simon Wood
What version of mgcv are you using, please? On Wednesday 21 May 2008 06:16, Lung-Chang Chien wrote: Dear everyone, I'm encountering an unknown error message when using gamm function: fitoutput - gamm(cvd~as.factor(dow)+pm10+s(time,bs=cr,k=15,fx=TRUE)+s(tmean,bs=cr,k =7,fx=TRUE) +

[R] Odp: Problem in converting natural numbers to bits and others

2008-05-21 Thread Petr PIKAL
Hallo [EMAIL PROTECTED] napsal dne 21.05.2008 09:42:40: Hi, I just started using R for about one week and I have few problems. i)I have a problem in finding right function to convert a table of natural numbers to bitwise. For a simple example; I have the below table:- Column Col1

[R] Proportional axes

2008-05-21 Thread Agustin Lobo
Hi! If I'm plotting 2 variables with the same units (i.e. wing length of 2 species), how can I force that X and Y axes have the same size for length unit? For example, if X ranges from 0 to 10 and Y ranges from 10 to 30, I want Y axis to be twice as long as X axis. I know I can just put xlim and

[R] need some help in plotting xy graph

2008-05-21 Thread Kurapati, Ravichandra (Ravichandra)
fdf dataframe contains the data as follows bin rate overlay x 1 90 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate (04/01/08 16:02:30) 2 93 Assign First/cc _from_SN_53 RNC_20_to_SN_50 RNC_21_Success Rate (04/01/08 16:07:30) 1 90

Re: [R] Insufficient memory

2008-05-21 Thread Prof Brian Ripley
Presumably you are using Windows without telling us. Please study the appropriate section of the rw-FAQ (and also the posting guide). On Wed, 21 May 2008, Roy Williams wrote: Dear Sir/Madam, I have only started using a R-written script for modeling the distribution of disease vector

Re: [R] Proportional axes

2008-05-21 Thread Ivar Herfindal
Hello. Try the to set asp=1 (aspect ratio between y- and x-axis): plot(runif(10, 0, 10), runif(10, 10, 30), asp=1) Best Ivar Herfindal Agustin Lobo skrev: Hi! If I'm plotting 2 variables with the same units (i.e. wing length of 2 species), how can I force that X and Y axes have the same

Re: [R] Proportional axes

2008-05-21 Thread Agustin Lobo
Thanks, I looked into the man pages of par() and did not into the ones of plot() Sorry about it, Agus Richard Rowe escribió: plot(runif(10,0,10),runif(10,10,30),xlim=c(0,10),ylim=c(10,30), asp=1) asp is the aspect parameter and ensures x y metrics are the same (try the plot without it). To

[R] Search a string and modify it in a .txt file

2008-05-21 Thread Romain
Hi there, I use R and I would like to be able to modify a file .txt init_file like this one : # # # Parameters A # # # Parameter 1 PA1 = 15

[R] number of trading days

2008-05-21 Thread threshold
Hi, I work on the date format: mmdd. I would like to calculate the number of (working or trading) days between two of such specified dates in specific year at US stock exchange OR at least with respect to 252-days year. What I did so far was the conversion (example): x-20060213; y-20060402 #

Re: [R] number of trading days

2008-05-21 Thread Dirk Eddelbuettel
On Wed, May 21, 2008 at 04:44:32AM -0700, threshold wrote: Hi, I work on the date format: mmdd. I would like to calculate the number of (working or trading) days between two of such specified dates in specific year at US stock exchange OR at least with respect to 252-days year. What I

Re: [R] Sweave / Latex per-chapter output

2008-05-21 Thread Brett Presnell
Anne-Marie Ternes [EMAIL PROTECTED] writes: What I would like to do, is to be able to get 2 types of output with the same code (I'm lazy ;-) ): ... 2. a PDF and HTML file *per chapter*, for displaying on our website and allowing people to download individual chapters ... BTW, I'm

Re: [R] mixed effects models with nested factors

2008-05-21 Thread Luis Cayuela
Thanks for the help provided to fit the model. I still have two questions: 1) What is the syntax for nested fixed and random factors. I have tried using the %in% operator but it does not work. The model I want to fit would be as follow: lmer 1 - lmer(Growing ~ Seed + Species%in%Seed +

[R] scheduling - algorithm solution or iterate?

2008-05-21 Thread SocialProgrammer
Our final year students rank 5 classes (1st, 2nd, ..., 5th), and are allocated 3, based on their choices and a minimum class size. We want to maximise satisfaction (students getting their higher preferences), but have a minimum viable class size. Is there an algorithm out there to help, in R

[R] 'Extracting' plot area

2008-05-21 Thread Tine
Hi! Does anyone know hot to save (to png, pdf, ...) only plot area. That is without box around, titles, axis, ... I tried: par(mar=c(0,0,0,0)) and it works for internal viewer (linux and windows). But when I save the image in png it adds that annoying margin around plot area. Any ideas? by,

Re: [R] 'Extracting' plot area

2008-05-21 Thread Marc Schwartz
on 05/21/2008 08:02 AM Tine wrote: Hi! Does anyone know hot to save (to png, pdf, ...) only plot area. That is without box around, titles, axis, ... I tried: par(mar=c(0,0,0,0)) and it works for internal viewer (linux and windows). But when I save the image in png it adds that annoying margin

Re: [R] 'Extracting' plot area

2008-05-21 Thread Duncan Murdoch
On 5/21/2008 9:02 AM, Tine wrote: Hi! Does anyone know hot to save (to png, pdf, ...) only plot area. That is without box around, titles, axis, ... I tried: par(mar=c(0,0,0,0)) and it works for internal viewer (linux and windows). But when I save the image in png it adds that annoying margin

Re: [R] Rank Values in a Matrix

2008-05-21 Thread Marianne Promberger
On 05/19/08 13:46, Jens Oldeland wrote: Dear All, a short and maybe simple question: I have to rank all values in a matrix from 0 to X, [1] [2] [3] [4] [1] 0.1 2 03 [2] 50 3 31 [3] 100 1 10 [4] 100 2 20 0-0 0.1-1 2-2 3-3 50-4 100-5 (X=5) Does

Re: [R] Search a string and modify it in a .txt file

2008-05-21 Thread jim holtman
Instead of trying to modify the file, why not generate it from the data that you have. Is the array in your mail an example of one of many that have the configuration data? If so, why don't you just create the output file from that data. You can just loop through and do 'writeLines' to create

Re: [R] Odp: Problem in converting natural numbers to bits and others

2008-05-21 Thread Vincent Goulet
Le mer. 21 mai à 04:38, Petr PIKAL a écrit : Hallo [EMAIL PROTECTED] napsal dne 21.05.2008 09:42:40: Hi, I just started using R for about one week and I have few problems. i)I have a problem in finding right function to convert a table of natural numbers to bitwise. For a simple

Re: [R] Search a string and modify it in a .txt file

2008-05-21 Thread jim holtman
Here is an example of how to create the init files: x - read.table(textConnection( PA1 PA2 PA3 PB1 j=1 122 15 j=2 103 24 j=3 114 36), header=TRUE) closeAllConnections()

Re: [R] Sweave / Latex per-chapter output

2008-05-21 Thread Jean lobry
Dear Anne-Marie, we had a similar problem to handle the LaTeX book that ships with the seqinr package (http://pbil.univ-lyon1.fr/software/seqinr/seqinr_1_1-5.pdf). Here is basically the approach we have used: o Each book chapter is written first as a LaTeX article produced by Sweaving its

[R] problems with data frames, factors and lists

2008-05-21 Thread Karin Lagesen
I have a function that creates a list based on some clustered data: mix - function(Y, pid) { hc = gethc(Y,pid) maxheight = max(hc$height) noingrp = processhc(hc) one = noingrp$one two = noingrp$two twoisone = one if (two != 1) twoisone = more out = list(pid = pid,one = noingrp$one, two =

Re: [R] an unknown error message when using gamm function

2008-05-21 Thread Lung-Chang Chien
The version is mgcv 1.3-27. Last night, I dropped out many arguments from my program to test which part might be the source of causing this error message, and found that the program works when just using corAR1(). This program has no this kind of problem in the beginning, but doesn't work after I

[R] split character string in matrix into character vector and numeric vector

2008-05-21 Thread Kim Milferstedt
Hello, I've got a matrix consisting of one column with n rows. Each field in the matrix is filled with a character vector. I would like to convert this matrix into a character vector containing the B03_MAH-type entries from the beginning of each row and a data.frame that contains the

Re: [R] split character string in matrix into character vector and numeric vector

2008-05-21 Thread Christos Hatzis
x - B03_MAH 0.2115 0.2087 0.2087 0.2147 0.2115 0.2176 strsplit(x, +) [[1]] [1] B03_MAH 0.2115 0.2087 0.2087 0.2147 0.2115 0.2176 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kim Milferstedt Sent: Wednesday, May 21,

Re: [R] how to do pairwise sums in a matrix

2008-05-21 Thread Henrique Dallazuanna
Try this: t(rowsum(t(Mat), substr(colnames(Mat), 1, 1))) On Wed, May 21, 2008 at 2:22 PM, Gregory Gentlemen [EMAIL PROTECTED] wrote: I am looking for an efficient way to solve the following problem. I have a large matrix of continuous values with a small proportion of missing values.

[R] Labeling a plot's x-axis with 12 strings, vertically oriented.

2008-05-21 Thread John
Hello, I really enjoy using R for my plotting. I have a modest plot, containing 24 data points, across 2 lines,12 points each. Ideally, the x-axis would be labeled with a series of strings, oriented vertically. Here is the R container holding the Search strings: Search [1] Route To: NCENGR

Re: [R] Labeling a plot's x-axis with 12 strings, vertically oriented.

2008-05-21 Thread Greg Snow
Here is one example: y - rnorm(12) x - 1:12 par(mar=c(10, 4, 4, 1)+0.1) plot(x,y, xlab='', xaxt='n') axis(1, at=x, labels=month.name, las=2) See help on par and axis for details. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801)

Re: [R] Labeling a plot's x-axis with 12 strings, vertically oriented.

2008-05-21 Thread Duncan Murdoch
On 5/21/2008 2:56 PM, John wrote: Hello, I really enjoy using R for my plotting. I have a modest plot, containing 24 data points, across 2 lines,12 points each. Ideally, the x-axis would be labeled with a series of strings, oriented vertically. Here is the R container holding the Search

[R] how to write fac.design (S-plus) in R

2008-05-21 Thread Becky lin
hi, Anyone here know well of the fac.design of S-plus? I need to rewrite the following code in R code in S-plus *pt.design = fac.design( c(2,2,3,2),factor.names = list(Hs=c(I,II),lef = c(0,1),lep = c(0,1,2),Type=c(gt,sy))) c.design=fac.design(

[R] Course of R in Brazil

2008-05-21 Thread Ana Carol Nunes
Hello! I´m Ana Carolina from UNICAMP (Campinas - SP - Brazil) and wonders, if there is someone interested and qualified, to give a course of R during one week in UNICAMP for the Department of Social and Preventive Medicine. We need to be some lessons on use of mgcv, gam and VGAM packages. If

[R] fac.design in R

2008-05-21 Thread Becky lin
hi, Anyone here know well of the fac.design of S-plus? I need to rewrite the following code in R code in S-plus *pt.design = fac.design( c(2,2,3,2),factor.names = list(Hs=c(I,II),lef = c(0,1),lep = c(0,1,2),Type=c(gt,sy))) c.design=fac.design(

[R] Converting a 'difftime' to integer - How to???

2008-05-21 Thread Martin Hvidberg
I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like: d - as.Date(2006-03-13) - as.Date(2006-01-01) +1 d Time difference of 72 days So far so good. But d is a 'difftime' object. How do I get an Integer value

Re: [R] Converting a 'difftime' to integer - How to???

2008-05-21 Thread Henrique Dallazuanna
Try : as.numeric(d) or also: unclass(d) On Wed, May 21, 2008 at 5:04 PM, Martin Hvidberg [EMAIL PROTECTED] wrote: I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like: d - as.Date(2006-03-13) -

Re: [R] Converting a 'difftime' to integer - How to???

2008-05-21 Thread Erik Iverson
Or, convert your object of class Date to POSIXlt, and then use the yday element of the resulting list. Example: today - Sys.Date() as.POSIXlt(today)$yday Erik Martin Hvidberg wrote: I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data

Re: [R] Converting a 'difftime' to integer - How to???

2008-05-21 Thread Peter Dalgaard
Martin Hvidberg wrote: I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like: d - as.Date(2006-03-13) - as.Date(2006-01-01) +1 d Time difference of 72 days So far so good. But d is a 'difftime'

[R] generating help files

2008-05-21 Thread Erin Hodgess
Hi R People! Is there a quick way to generate help files for functions, please? I know that if you use package.skeleton, that will work. However, I'm not using that for a new package. (Hope this make sense) this is for SUSE10.1, please. thanks, Erin -- Erin Hodgess Associate Professor

Re: [R] generating help files

2008-05-21 Thread baptiste Auguié
Hi, try prompt(yourFunction) hope thus helps, baptiste On 21 May 2008, at 21:40, Erin Hodgess wrote: Hi R People! Is there a quick way to generate help files for functions, please? I know that if you use package.skeleton, that will work. However, I'm not using that for a new package.

Re: [R] Converting qqplot2 qplot() to grammar?

2008-05-21 Thread hadley wickham
Now that this part is working there are two more aspects of the plot I would like to remove: (in order of importance) * The row/column facetting labels. You should be able to find that using grid.ls() * the whitespace that surrounds the plot. I'd like the ggsave output to resemble the

Re: [R] xlab at top in xyplot()

2008-05-21 Thread Deepayan Sarkar
On 5/21/08, Michael Kubovy [EMAIL PROTECTED] wrote: Dear R-helpers, (1) How do I add a 'top' label symmetric with the 'bottom' label' in: axis.td - function(side, ...) { ylim - current.panel.limits()$ylim switch(side, bottom = {

[R] automation of R? running an R script at a certain time each night?

2008-05-21 Thread Thomas Pujol
I am using R in a Windows environment. I store my data in a Microsoft SQL database that gets updated automatically nightly. Once my SQL db is updated, I wish to automatically run an R script Any tips on good ways to approach this task? Is there an easy way to launch an R script using the

Re: [R] automation of R? running an R script at a certain time each night?

2008-05-21 Thread Edward Wijaya
You might try cron job under Windows. http://drupal.org/node/31506 HTH. - Edward On Thu, May 22, 2008 at 8:51 AM, Thomas Pujol [EMAIL PROTECTED] wrote: I am using R in a Windows environment. I store my data in a Microsoft SQL database that gets updated automatically nightly. Once my SQL

[R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Edward Wijaya
Hi, I tried to compute maximum likelihood under gamma distribution, using nlm function. The code is this: __BEGIN__ vsamples- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4) mlogl - function(alpha, x) { if (length(alpha) 1) stop(alpha must be scalar) if (alpha = 0) stop(alpha must be

Re: [R] Cumulative average

2008-05-21 Thread Jacques Wagnor
Thank you! Your interpretation was correct. I'll remember to be more specific next time. Thank you for being patient and understanding. Jacques On 5/21/08, jim holtman [EMAIL PROTECTED] wrote: Not sure exactly what you want since you did not provide any data or an example of the expected

Re: [R] Cumulative average

2008-05-21 Thread Andrew Robinson
Jacques, you should be able to construct a solution from cumsum(). Cheers Andrew On Wed, May 21, 2008 at 08:48:29PM -0500, Jacques Wagnor wrote: Dear List, Does there exist a function that calculates a cumulative average? Neither running() from library(gregmisc) nor running.mean() from

Re: [R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Charilaos Skiadas
Try: mlogl_out - nlm(mlogl, mean(vsamples), vsamples) or mlogl_out - nlm(mlogl, mean(vsamples), x=vsamples) The argument vsamples=vsamples is passed to mlogl, since nlm does not recognize it. But mlogl doesn't have a vsamples argument, only alpha and x arguments. So you have to either

Re: [R] Computing Maximum Loglikelihood With nlm Problem

2008-05-21 Thread Edward Wijaya
Thanks so much. - Edward On Thu, May 22, 2008 at 11:17 AM, Charilaos Skiadas [EMAIL PROTECTED] wrote: Try: mlogl_out - nlm(mlogl, mean(vsamples), vsamples) or mlogl_out - nlm(mlogl, mean(vsamples), x=vsamples) The argument vsamples=vsamples is passed to mlogl, since nlm does not