Re: [R] LOOping problem with R

2010-08-29 Thread Joshua Wiley
Hi, I would also like to point out that you flipped the first two the values of theta in the R vs. FORTRAN versions. This fixes part of your differences (and makes it easy to see that the differences occur when j < i, as David and Mario point out). Josh On Sun, Aug 29, 2010 at 10:27 PM, Nam Let

Re: [R] log y 'axis' of histogram

2010-08-29 Thread David Scott
On 30/08/2010 1:58 p.m., Derek M Jones wrote: All, I have been trying to get calls to hist(...) to be plotted with the y-axis having a log scale. I have tried: par(ylog=TRUE) I have also looked at the histogram package. Suggestions welcome. You appear to be looking for a log-histogram func

Re: [R] LOOping problem with R

2010-08-29 Thread Mario Valle
When j==1 for loops from i down to zero. 5:0 is valid and means c(5,4,3,2,1,0) Hope it helps mario Nam Lethanh wrote: > Dear Guys, > > I do converting codes from Fortran into R and got stuck in solving LOOPING > procedure with R. In FORTRAN, it is (DO and END DO) for loopi

Re: [R] LOOping problem with R

2010-08-29 Thread David Winsemius
On Aug 30, 2010, at 1:27 AM, Nam Lethanh wrote: Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). Looking at the results (namely the 1's from t

Re: [R] Question regarding significance of a covariate in a coxme survival

2010-08-29 Thread C. Peng
What statistical measure(s) tend to be answering ALL(?) question of practical interest? -- View this message in context: http://r.789695.n4.nabble.com/Re-Question-regarding-significance-of-a-covariate-in-a-coxme-survival-tp2399386p2399577.html Sent from the R help mailing list archive at Nabbl

Re: [R] sum of some matrix columns

2010-08-29 Thread David Winsemius
On Aug 29, 2010, at 8:47 PM, Lorenzo Cattarino wrote: Hi, I have the following matrix cc <- matrix (1:21, 3) cc[,3:4]<- 0 cc [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,]1400 13 16 19 [2,]2500 14 17 20 [3,]3600 15 18 21

Re: [R] Read in a all-character file and specify field separator and records separator

2010-08-29 Thread David Winsemius
On Aug 30, 2010, at 12:18 AM, Yong Wang wrote: Dear list I used to use python or awk do preliminary process and then feed into R. In some circumstances, the data transmission becomes quite a pain. I am wondering if there is a convenient way to read in R text file (not data, text file in common

Re: [R] Read in a all-character file and specify field separator and records separator

2010-08-29 Thread Joshua Wiley
On Sun, Aug 29, 2010 at 9:18 PM, Yong Wang wrote: > Dear list > > I used to use python or awk do preliminary process and then feed into > R. In some circumstances, the data transmission becomes quite a pain. > I am wondering if there is a convenient way to read in R text file > (not data, text fil

[R] LOOping problem with R

2010-08-29 Thread Nam Lethanh
Dear Guys, I do converting codes from Fortran into R and got stuck in solving LOOPING procedure with R. In FORTRAN, it is (DO and END DO) for looping in the net. In R, it is (FOR with { }). I believe there is something wrong with my coding in R, do hope that you can help me solving following pr

Re: [R] Johansen test

2010-08-29 Thread Joshua Wiley
Hi, I believe what you are looking for is in the "teststat" slot sjd.v...@teststat sjd.v...@teststat[1] # first one etc. HTH, Josh On Sun, Aug 29, 2010 at 9:12 PM, aurumor wrote: > > Hi all, I am working on exporting "Johansen test statistics" (Johansen test: > "ca.jo" in package "urca")to E

[R] Read in a all-character file and specify field separator and records separator

2010-08-29 Thread Yong Wang
Dear list I used to use python or awk do preliminary process and then feed into R. In some circumstances, the data transmission becomes quite a pain. I am wondering if there is a convenient way to read in R text file (not data, text file in common sense) and specify field separator and records sep

Re: [R] Question regarding significance of a covariate in a coxme survival

2010-08-29 Thread cheng peng
What statistical measure(s) tend to be answering ALL(?) question of practical interest? -- View this message in context: http://r.789695.n4.nabble.com/Re-Question-regarding-significance-of-a-covariate-in-a-coxme-survival-tp2399386p2399524.html Sent from the R help mailing list archive at Nabb

Re: [R] Making cuts on multivariate data

2010-08-29 Thread David Winsemius
On Aug 30, 2010, at 12:57 AM, David Winsemius wrote: On Aug 29, 2010, at 10:50 PM, Erik Ramberg wrote: I'm a newbie to R and I was hoping someone could answer a simple question. I want to read in an ASCII file with 3 columns - x,y,z. Let's say there is a lot of data - 100,000 entries.

[R] sum of some matrix columns

2010-08-29 Thread Lorenzo Cattarino
Hi, I have the following matrix cc <- matrix (1:21, 3) cc[,3:4]<- 0 cc [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,]1400 13 16 19 [2,]2500 14 17 20 [3,]3600 15 18 21 and I would like to sum just the values in columns

[R] Johansen test

2010-08-29 Thread aurumor
Hi all, I am working on exporting "Johansen test statistics" (Johansen test: "ca.jo" in package "urca")to Excel. The problem is that the function output is not a number, but like this: # # Johansen-Procedure Unit Root / Cointegration Test # ##

Re: [R] Making cuts on multivariate data

2010-08-29 Thread David Winsemius
On Aug 29, 2010, at 10:50 PM, Erik Ramberg wrote: I'm a newbie to R and I was hoping someone could answer a simple question. I want to read in an ASCII file with 3 columns - x,y,z. Let's say there is a lot of data - 100,000 entries. I then want to histogram x values that pass arbitrary

Re: [R] while loop until end of file

2010-08-29 Thread Joshua Wiley
Hi Marcel, Not quite sure what you want the while loop for. Does this do what you want? mydat <- read.table(textConnection(" Pair group param1 1 D 10 1 D 10 1 R 10 1 D 10 2 D 10 2

Re: [R] while loop until end of file

2010-08-29 Thread Bill.Venables
Eh? ## First calculate the means: mns <- with(alldata, tapply(param1, list(Pair, group), mean)) ## now put the results into a data frame res <- data.frame(mns, dif = mns[, "D"] - mns[, "R"]) ## Then write it out if that's your thing. -Original Message- From: r-help-boun...@r-projec

[R] while loop until end of file

2010-08-29 Thread Marcel Curlin
Hi Guys, stumped by a simple problem. I would like to take a file of the form Pair group param1 1 D 10 1 D 10 1 R 10 1 D 10 2 D 10 2 D 10 2 D 10 2

[R] Making cuts on multivariate data

2010-08-29 Thread Erik Ramberg
I'm a newbie to R and I was hoping someone could answer a simple question. I want to read in an ASCII file with 3 columns - x,y,z. Let's say there is a lot of data - 100,000 entries. I then want to histogram x values that pass arbitrary (and complicated) cuts on y and/or z. Likewise, I want

Re: [R] log y 'axis' of histogram

2010-08-29 Thread Joshua Wiley
Hi Derek, Here is an option using the package ggplot2: library(ggplot2) x <- sample(x = 10:50, size = 50, replace = TRUE) qplot(x = x, geom = "histogram") + scale_y_log() However, the log scale is often inappropriate for histograms, because the y-axis represents counts, which could potentially b

[R] complete list of Sweave tags (control sequences)

2010-08-29 Thread heyi xiao
Hello all, Is there a complete list of Sweave tags (control sequences) and their usage? For instance, I know a few blow. But I don’t really know how to use them. It seems to me that there is nowhere to find further information. I would really appreciate any input. Thanks! Heyi   The fe

Re: [R] log y 'axis' of histogram

2010-08-29 Thread John Sorkin
How about computing the log of you variable and calling hist() on the log data. logy <- log(y) Hhist(logy) John John Sorkin Chief Biostatistics and Informatics Univ. of Maryland School of Medicine Division of Gerontology and Geriatric Medicine jsor...@grecc.umaryland.edu -Original Message

[R] log y 'axis' of histogram

2010-08-29 Thread Derek M Jones
All, I have been trying to get calls to hist(...) to be plotted with the y-axis having a log scale. I have tried: par(ylog=TRUE) I have also looked at the histogram package. Suggestions welcome. -- Derek M. Jones tel: +44 (0) 1252 520 667 Knowledge Software Ltd

Re: [R] Using termplot() with transformations of x

2010-08-29 Thread David Winsemius
On Aug 26, 2010, at 7:10 PM, Peter Dunn wrote: Hi all I was playing with termplot(), and came across what appears to be an inconsistency. It would appreciate if someone could enlighten me: # First, generate some data: y <- rnorm(100) x <- runif(length(y),1,2) # Now find the log of x:

Re: [R] Putting legend *outside* plotting area

2010-08-29 Thread Ben Tupper
Hi, On Aug 29, 2010, at 8:00 PM, Worik R wrote: > Is there a simple way to put a legend outside the plot area for a > simple > plot? > > I found... (at http://www.harding.edu/fmccown/R/) > > # Expand right side of clipping rect to make room for the legend > *par(xpd=T, mar=par()$mar+c(0,0,0,4)

[R] SVM comparison

2010-08-29 Thread Shane O'Mahony
I'm trying to run an epsilon regression model, and am comparing the results between e1071 and kernlab. I believe that I'm calling the ksvm and svm functions the same way but I'm getting different results: library(e1071); library(kernlab) ksvm(x=1:100, y=(1:100)/5, type="eps-svr", kpar=list(sigma=

[R] Putting legend *outside* plotting area

2010-08-29 Thread Worik R
Is there a simple way to put a legend outside the plot area for a simple plot? I found... (at http://www.harding.edu/fmccown/R/) # Expand right side of clipping rect to make room for the legend *par(xpd=T, mar=par()$mar+c(0,0,0,4))* # Graph autos (transposing the matrix) using heat colors, # pu

[R] CRAN (and crantastic) updates this week

2010-08-29 Thread Crantastic
CRAN (and crantastic) updates this week New packages * ProjectTemplate (0.1-2) Maintainer: John Myles White Author(s): John Myles White http://crantastic.org/packages/ProjectTemplate The ProjectTemplate package provides a function, create.project(), that automatically buil

Re: [R] Using termplot() with transformations of x

2010-08-29 Thread Peter Dunn
Hi >the two models are identical because of having the same independent > variable and dependent variable.they produce different termplot()s because > of they base on different variables,one is x,the other is logx.see the > lateral axis. Sure; this is all obvious from the code and the plots.

Re: [R] Question regarding significance of a covariate in a coxme survival

2010-08-29 Thread Norm Matloff
Using a p-value to make any kind of decision is questionable to begin with, and especially unreliable in choosing covariates in regression. Old studies, e.g. by Walls and Weeks and by Bendel and Afifi, have shown that if predictive ability is the criterion of interest and one wishes to use p-values

Re: [R] Finding functions of large dataset for numerical integration

2010-08-29 Thread David Winsemius
On Aug 29, 2010, at 3:42 PM, sam.e wrote: Hello everyone, I have been trying to figure out away to integrate under a spline produced by the package tps(fields). As the package does not output functions I am trying to do something similar to the trapezium rule. My data are 3D (x, y & z)

Re: [R] Finding source files automatically within a script

2010-08-29 Thread Gabor Grothendieck
On Sun, Aug 29, 2010 at 1:13 PM, Abhisek wrote: > Hi there, > > Ive tried trawling the lists for a solution but I could not find any > matches.  I am typing up all my code on a Linux machine and I call this > other script file from my script file using source("foo.r").  Now sometimes > i access my

Re: [R] glm prb (Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : )

2010-08-29 Thread David Winsemius
On Aug 29, 2010, at 3:13 PM, moleps wrote: glm(A~B+C+D+E+F,family = binomial(link = "logit"),data=tre,na.action=na.omit) Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to factors with 2 or more levels however, glm(A~B+C+D+E,family = binomial(li

Re: [R] Saving plot to tiff, with high resolution for publication ?

2010-08-29 Thread David Winsemius
On Aug 29, 2010, at 12:46 PM, Tal Galili wrote: Hello all. A Journal we are sending an article to is asking for the following: To ensure the best reproduction quality of your figures we would appreciate high resolution files. All figures should preferably be in TIFF or EPS format... and sh

Re: [R] Saving plot to tiff, with high resolution for publication ?

2010-08-29 Thread Joshua Wiley
Hi Tal, You have set the resolution, but you have not set the width/height. The res argument generally controls how many pixels per inch (PPI which is often used similarly to DPI). So if you want 800 DPI and you want it to be a 4 x 4 inch graph something like: tiff(file = "temp.tiff", width = 32

[R] glm prb (Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : )

2010-08-29 Thread moleps
glm(A~B+C+D+E+F,family = binomial(link = "logit"),data=tre,na.action=na.omit) Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to factors with 2 or more levels however, glm(A~B+C+D+E,family = binomial(link = "logit"),data=tre,na.action=na.omit) runs

[R] Finding functions of large dataset for numerical integration

2010-08-29 Thread sam.e
Hello everyone, I have been trying to figure out away to integrate under a spline produced by the package tps(fields). As the package does not output functions I am trying to do something similar to the trapezium rule. My data are 3D (x, y & z). I have extracted from the surface output by Tps the

Re: [R] Saving plot to tiff, with high resolution for publication ?

2010-08-29 Thread Barry Rowlingson
On Sun, Aug 29, 2010 at 5:46 PM, Tal Galili wrote: > Hello all. > > A Journal we are sending an article to is asking for the following: > >  To ensure the best reproduction quality of your figures we would appreciate > high resolution files. All figures should preferably be in TIFF or EPS > format

[R] Finding source files automatically within a script

2010-08-29 Thread Abhisek
Hi there, Ive tried trawling the lists for a solution but I could not find any matches. I am typing up all my code on a Linux machine and I call this other script file from my script file using source("foo.r"). Now sometimes i access my folder from my Windows machine at work (the files are on dr

[R] Interpreting cv.glm

2010-08-29 Thread M_miller
Hey! Just a quick question: How do you interpret cross-validation error? For my model the function cv.glm returns a cross validation error of 0.31 does this mean to say that model has an accuracy of 0.69 (69 Percent of points are correctly classified)? Thanks, Mark -- View this message i

[R] Saving plot to tiff, with high resolution for publication ?

2010-08-29 Thread Tal Galili
Hello all. A Journal we are sending an article to is asking for the following: To ensure the best reproduction quality of your figures we would appreciate high resolution files. All figures should preferably be in TIFF or EPS format... and should have the following resolution: Graph: 800 - 1200

Re: [R] Three-dimensional contingency table

2010-08-29 Thread David Winsemius
On Aug 28, 2010, at 10:58 PM, Randklev, Charles wrote: Hi, I am trying to assemble a three-way contingency table examining the presence/absence of mussels, water depth (Depth1 and Depth 2) and water velocity (Flow vs. No Flow). I have written the following code listed below; however, whe

Re: [R] take component names of a list

2010-08-29 Thread Dimitris Rizopoulos
check at the online help file of function ?names(), and then try this: names(list.a) I hope it helps. Best, Dimitris On 8/29/2010 5:51 PM, Hyunchul Kim wrote: Hi, all I want to take a vector of component names of a list. list.a<- list('x'=1, 'y'=2) how to get a c('x','y') from list.a? T

[R] need help for a repackaging problem!

2010-08-29 Thread Samy Khezami
Hy, I had a mistake on a function of a package i have created! I have solved it and then i repackaged and installed the modified package. I use to launch R from Excel! And so when i launch R, and next call my function from the workspace, i still find the problem on my function. And when i read on

Re: [R] take component names of a list

2010-08-29 Thread Henrique Dallazuanna
Try this: names(list.a) On Sun, Aug 29, 2010 at 12:51 PM, Hyunchul Kim wrote: > Hi, all > > I want to take a vector of component names of a list. > > list.a <- list('x'=1, 'y'=2) > > how to get a c('x','y') from list.a? > > Thanks in advance, > > Hyunchul > >[[alternative HTML version de

[R] take component names of a list

2010-08-29 Thread Hyunchul Kim
Hi, all I want to take a vector of component names of a list. list.a <- list('x'=1, 'y'=2) how to get a c('x','y') from list.a? Thanks in advance, Hyunchul [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://st

Re: [R] how to take a os.path.basename

2010-08-29 Thread Henrique Dallazuanna
Take a look on ?basename help page. On Sun, Aug 29, 2010 at 12:07 PM, Hyunchul Kim wrote: > Hi, all > > I made a simple R script to take the basename of a file without directory > names. > > path.splitted <- strsplit('/path/to/a_basename', '/') > path.length <- length(path.splitted[[1]]) > basena

[R] how to take a os.path.basename

2010-08-29 Thread Hyunchul Kim
Hi, all I made a simple R script to take the basename of a file without directory names. path.splitted <- strsplit('/path/to/a_basename', '/') path.length <- length(path.splitted[[1]]) basename <- path.splitted[[1]][path.length] # basename <- 'a_basename' Is there a simple function for this? so

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-29 Thread C. Peng
My suggestion for Teresa: If compare model 1 and model 2 with model 0 respectively, the (penalized) likelihood ratio test is valid. IF you compare model 2 with model 3, the (penalized) likelihood ratio test is invalid. You may want to use AIC/SBC to make a subjective decision. -- View this

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-29 Thread Cheng Peng
My suggestion: If compare model 1 and model 2 with model 0 respectively, the (penalized) likelihood ratio test is valid. IF you compare model 2 with model 3, the (penalized) likelihood ratio test is invalid. You may want to use AIC/SBC to make a subjective decision. -- View this message in con

Re: [R] Three-dimensional contingency table

2010-08-29 Thread Cheng Peng
I didn't see any error when I ran your code in my computer: > numbers <- c(1134,956,328,529,435,599,27,99) > dim(numbers) <- c(2,2,2) > numbers , , 1 [,1] [,2] [1,] 1134 328 [2,] 956 529 , , 2 [,1] [,2] [1,] 435 27 [2,] 599 99 > dimnames(numbers)[[3]] <-list("Mussels", "

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-29 Thread Cheng Peng
The likelihood ratio test is more reliable when one model is nested in the other. This true for your case. AIC/SBC are usually used when two models are in a hiearchical structure. Please also note that any decision made made based on AIC/SBC scores are very subjective since no sampling distributio

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-29 Thread C. Peng
The likelihood ratio test is more reliable when one model is nested in the other. This true for your case. AIC/SBC are usually used when two models are in a hiearchical structure. Please also note that any decision made made based on AIC/SBC scores are very subjective since no sampling distributi

Re: [R] extracting year from date

2010-08-29 Thread Henrique Dallazuanna
Try this: format(data$start, "%Y") On Sun, Aug 29, 2010 at 11:32 AM, André de Boer wrote: > Hi, > > Sorry for this simple question but I searched the internet and can't find > the answer. > > >From a date I want the year extracted: > > data$start[1 > [1] "2006-11-01" > > Thanks for the answer,

[R] extracting year from date

2010-08-29 Thread André de Boer
Hi, Sorry for this simple question but I searched the internet and can't find the answer. >From a date I want the year extracted: > data$start[1 [1] "2006-11-01" Thanks for the answer, Andre [[alternative HTML version deleted]] __ R-help@r-pr

Re: [R] Three-dimensional contingency table

2010-08-29 Thread Ista Zahn
Hi, Your example works fine for me. My guess is that you have one of wd, wv, MP, or Count defined as a global variable. This is the main reason the use of attach() is discouraged by many people on this list. The safer thing to do is model1 <- glm(Count~MP+wd+wv,poisson. data = frame) -Ista On Sat

Re: [R] About plot graphs

2010-08-29 Thread Stephen Liu
Hi David, Thanks for your advice. B.R. Stephen L - Original Message From: David Winsemius To: Stephen Liu Cc: "r-help@r-project.org" Sent: Sun, August 29, 2010 1:52:50 AM Subject: Re: [R] About plot graphs On Aug 28, 2010, at 9:15 AM, Stephen Liu wrote: > Hi Gavin, > > Lot of t

Re: [R] About plot graphs

2010-08-29 Thread Stephen Liu
Hi Greg, Thanks for your advice. > data(women) > women height weight 1 58115 2 59117 3 60120 4 61123 5 62126 6 63129 7 64132 8 65135 9 66139 10 67142 11 68146 12 69150 13 70154 14

Re: [R] calculations with dates

2010-08-29 Thread jim holtman
Try this: > x startdate enddate 1 27SEP2005 01JAN2006 > x$start <- as.Date(x$startdate, format="%d%b%Y") > x$end <- as.Date(x$enddate, format="%d%b%Y") > x startdate enddate startend 1 27SEP2005 01JAN2006 2005-09-27 2006-01-01 > x$duration <- x$end - x$start > x startdate

[R] calculations with dates

2010-08-29 Thread André de Boer
Hi, I have a data.frame with factors in columns like startdate enddate 27SEP2005 01JAN2006 How can I calculate the duration between those two dates and move this in a extra column in the data.frame. Thanks, André [[alternative HTML version deleted]] __

Re: [R] approxfun-problems (yleft and yright ignored)

2010-08-29 Thread Nora Muda
[[alternative HTML version deleted]] __ 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-c

Re: [R] Please sigh me out from the R-help. Thank you!

2010-08-29 Thread Johnson, Cedrick W.
https://stat.ethz.ch/mailman/listinfo/r-help At the bottom of the webpage. -c On 08/29/2010 03:58 AM, Kaigang Li wrote: [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-he

[R] Please sigh me out from the R-help. Thank you!

2010-08-29 Thread Kaigang Li
[[alternative HTML version deleted]] __ 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-co