[R] Regular Expressions

2010-11-04 Thread Noah Silverman
Hi, I'm trying to figure out how to use capturing parenthesis in regular expressions in R. (Doing this in Perl, Java, etc. is fairly trivial, but I can't seem to find the functionality in R.) For example, given the string:"10 Nov 13.00 (PFE1020K13)" I want to capture the first to digits

Re: [R] Plotting a grid of directly specified colours

2010-11-04 Thread Jim Lemon
On 11/05/2010 03:00 AM, Peter Davenport wrote: Dear R-help, Could any of you direct me to a function for plotting a grid of colours, directly specified by a matrix of hex colour codes? In other words I'm looking for a heatmap() or image()-like function to which I can specify the colour of each

Re: [R] setting attributes

2010-11-04 Thread Johannes Huesing
David Winsemius [Fri, Nov 05, 2010 at 05:18:23AM CET]: [...] > If you were trying for something else, then please explain in plain > English rather than simply showing code that throws an error. > Well, code never hurts. But it should be accompanied with a hint towards what it is meant to do. -

Re: [R] postForm() in RCurl and library RHTMLForms

2010-11-04 Thread sayan dasgupta
Thanks a lot thats exactly what I was looking for Just a quick question I agree the form gets submitted to the URL "http://www.nseindia.com/marketinfo/indices/histdata/historicalindices.jsp"; and I am filling up the form in the page "http://www.nseindia.com/content/indices/ind_histvalues.htm"; H

Re: [R] Loop

2010-11-04 Thread Petr PIKAL
Hi the list/loop solution given below enables to give you both. You can transform it to data,frame data.frame(do.call(cbind, lll),sapply(lll, names)) and add appropriate names or you can use Jim's solution and combine those 2 steps Regards Petr Matevž Pavlič napsal dne 05.11.2010 00:05:00

Re: [R] setting attributes (SOLVED)

2010-11-04 Thread Stephen Liu
From: Erik Iverson To: r-help@r-project.org Sent: Fri, November 5, 2010 1:09:19 PM Subject: Re: [R] setting attributes (SOLVED) >> The learning curve of R is rather steep at start. >Yes, it can be. I think the general advice would be >to get a good Intro to R book if you're just starting >out.

[R] NaN, ncdf

2010-11-04 Thread Sashi Challa
Dear All, Can anyone please let me know how exactly ncdf deals with NaN. I am trying to pass in a vector of data that has some NaN in it, into a variable in NetCDF. dimX <- dim.def.ncdf("X","count",(1:6)) dimY <- dim.def.ncdf("Y","count",(1:3)) var1 <- var.def.ncdf("genotype","freq",list(dimX,

Re: [R] setting attributes (SOLVED)

2010-11-04 Thread Erik Iverson
The learning curve of R is rather steep at start. Yes, it can be. I think the general advice would be to get a good Intro to R book if you're just starting out. That's certainly my advice. Or, get a book on some methods you're interested in that uses R (the Springer useR! series is really us

Re: [R] setting attributes (SOLVED)

2010-11-04 Thread Stephen Liu
Hi Mike, I got it done. Thanks Your advice:- > z <- rep(0:9, each = 10) > z [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]012345678 9 [2,]012345678 9 [3,]01234567

Re: [R] setting attributes

2010-11-04 Thread Michael Sumner
David did help already, but if you want literally what the Introduction uses then you'll need a vector with as many elements as the final matrix (in David's example recyling applies to give 100 elements from the original 10). z <- rep(0:9, each = 10) attr(z, "dim") <- c(10,10) That's simply a di

Re: [R] setting attributes

2010-11-04 Thread Stephen Liu
Hi David, I'm learning R following the tutorial mentioned, nothing else. I got an error running the code. Please help. B.R. Stephen L - Original Message From: David Winsemius To: Stephen Liu Cc: r-help@r-project.org Sent: Fri, November 5, 2010 12:18:23 PM Subject: Re: [R] settin

Re: [R] setting attributes

2010-11-04 Thread David Winsemius
On Nov 5, 2010, at 12:05 AM, Stephen Liu wrote: Hi folks, An Introduction to R 3.3 Getting and setting attributes http://cran.r-project.org/doc/manuals/R-intro.html#Vectors-and-assignment z <- 0:9 z [1] 0 1 2 3 4 5 6 7 8 9 attr(z, "dim") <- c(10,10) Error in attr(z, "dim") <- c(10, 10)

Re: [R] Plotting a vector data

2010-11-04 Thread Tal Galili
Hi Nasrin, 1) You didn't define mean.radiation in your code (for example using mean.radiation<-NULL) 2) Also, you're using "attach", which is a good recipe for forgetting something in your environment which will lead into troubles. 3) You didn't define i (for example i <- 1:30) Tal -

[R] setting attributes

2010-11-04 Thread Stephen Liu
Hi folks, An Introduction to R 3.3 Getting and setting attributes http://cran.r-project.org/doc/manuals/R-intro.html#Vectors-and-assignment > z <- 0:9 > z [1] 0 1 2 3 4 5 6 7 8 9 > attr(z, "dim") <- c(10,10) Error in attr(z, "dim") <- c(10, 10) : dims [product 100] do not match the length o

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Immanuel > Sent: Thursday, November 04, 2010 4:54 PM > To: Charles C. Berry > Cc: r-help@r-project.org > Subject: Re: [R] count occurrence and distance of characters in string >

[R] (no subject)

2010-11-04 Thread Matilda Gogos
Matilda Gogos mgog...@gmail.com __ 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 c

Re: [R] map on irregular grids

2010-11-04 Thread Ben Bolker
Wolfgang Polasek gmail.com> writes: >how to find a function for plotting polygon surface, like > polgon3d(xc,yc,obs) > > xc, yc ... coordinates > obs observations > result: persp plot with grid net over the coordinates Don't know of an off-the-shelf solution. Generate a Delaunay tria

[R] Memory Management under Linux

2010-11-04 Thread ricardo souza
Dear all, I am using ubuntu linux 32 with 4 Gb.  I am running a very small script and I always got the same error message:  CAN NOT ALLOCATE A VECTOR OF SIZE 231.8 Mb. I have reading carefully the instruction in ?Memory.  Using the function gc() I got very low numbers of memory (please sea be

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread David Winsemius
On Nov 4, 2010, at 8:06 PM, Charles C. Berry wrote: On Fri, 5 Nov 2010, Immanuel wrote: Hey, thanks for the answer, actually I already typed an example but deleted it since I thought it's superfluous. regards - string <- "kjokllokkoadddo" # f1(string, "o") should return that "o" wa

Re: [R] postForm() in RCurl and library RHTMLForms

2010-11-04 Thread Duncan Temple Lang
On 11/4/10 2:39 AM, sayan dasgupta wrote: > Hi RUsers, > > Suppose I want to see the data on the website > url <- "http://www.nseindia.com/content/indices/ind_histvalues.htm"; > > for the index "S&P CNX NIFTY" for > dates "FromDate"="01-11-2010","ToDate"="02-11-2010" > > then read the html tab

[R] User defined function and nonlinear least-squares fit

2010-11-04 Thread Dick Harray
Hello, I'd like to fit a user defined function to a data set, but I have problems to find my problem. The user defined function is a combination of two rectangular functions, and the listing below gives an example for what I want to do. The problem is, that I get the error message for fit1 and fit

Re: [R] Loop

2010-11-04 Thread jim holtman
try this: The top half of the matrix is the counts and the bottom is the value: > x <- apply(mat, 2, function(a) c(sort(table(a)), > as.integer(names(sort(table(a)) > x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 4856 4906 4857 4877 4788 4880 4861 4851 4878 4841 [2,] 490

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread Charles C. Berry
On Fri, 5 Nov 2010, Immanuel wrote: Hey, thanks for the answer, actually I already typed an example but deleted it since I thought it's superfluous. regards - string <- "kjokllokkoadddo" # f1(string, "o") should return that "o" was found 4 times # f2(string, "o") should return that th

Re: [R] creating vectors with three variables out of three datasets

2010-11-04 Thread jim holtman
Is this what you want: > x V1 V2 V3 V4 1 ascii1: 11 12 13 2 ascii2: 14 15 16 3 ascii3: 17 18 19 > z <- as.matrix(x[,-1]) > z V2 V3 V4 [1,] 11 12 13 [2,] 14 15 16 [3,] 17 18 19 > as.vector(z) [1] 11 14 17 12 15 18 13 16 19 > On Thu, Nov 4, 2010 at 6:05 PM, DomDom wrote: > > okay sorr

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread Immanuel
Hey, thanks for the answer, actually I already typed an example but deleted it since I thought it's superfluous. regards - string <- "kjokllokkoadddo" # f1(string, "o") should return that "o" was found 4 times # f2(string, "o") should return that the distances between the "o"'s found is

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread Charles C. Berry
On Thu, 4 Nov 2010, Immanuel wrote: Hello all, I want to know how often one character occurs in a given string and the distance from between every two occurences. (distance = other characters between them). You should provide "commented, minimal, self-contained, reproducible code" as asked.

Re: [R] count occurrence and distance of characters in string

2010-11-04 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Immanuel > Sent: Thursday, November 04, 2010 3:42 PM > To: r-help@r-project.org > Subject: [R] count occurrence and distance of characters in string > > Hello all, > > I want to

[R] NA values in package KFAS or SSPIR

2010-11-04 Thread feder
Hi, I tried to manage exponential family state-space model with the packages KFAS and sspir. The problem is that my data set includes some NA observation and it seems not working. Any suggestion? Thanks in advance, Federico -- View this message in context: http://r.789695.n4.nabble.com/NA-val

Re: [R] Loop

2010-11-04 Thread Matevž Pavlič
Hi Jim, Actually, this is better, but both values are what i am looking for. Count and the value of the count. Is there a way to just paste those two together? Thanks, m -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, November 04, 2010 9:59 PM To: Mat

[R] count occurrence and distance of characters in string

2010-11-04 Thread Immanuel
Hello all, I want to know how often one character occurs in a given string and the distance from between every two occurences. (distance = other characters between them). thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

[R] NA values

2010-11-04 Thread feder
Hi, I tried to manage exponential family state-space model with the packages KFAS. The problem is that my data set includes some NA observation and it seems not working. Any suggestion? Thanks in advance, Federico -- View this message in context: http://r.789695.n4.nabble.com/R-pkgs-New-packa

[R] mgui

2010-11-04 Thread Luis Felipe Parra
Hello I am using the mgui function in the following way: mgui ( graf_cuenta_margen_interfaz,title=c("Gráficas","Histogramas valoración (No lineal) Cuenta de Margen"),exec="Graficar",argText=list(fecha_adelante="Fecha adelante"),closeOnExec=TRUE,output=NULL,,helps=list(fecha_adelante=paste("La valo

Re: [R] creating vectors with three variables out of three datasets

2010-11-04 Thread DomDom
okay sorry. i´ve got three ascii files with pixel values without any header information. so if the first line of the three ascii files are: ascii1: 11 12 13 ascii2: 14 15 16 ascii3: 17 18 19 i would like a new matrix with: 11,14,17;12,15,18;13,16,19; thx -- View this message in context: ht

Re: [R] creating vectors with three variables out of three datasets

2010-11-04 Thread Erik Iverson
DomDom wrote: Hi there, i´ve got a problem with how to create a vector with three variables out of three seperate ascii files. These three ascii files contain pixel information of the same image but different bands and i need a matrix of vectors, with each vector containing the corresponding

[R] creating vectors with three variables out of three datasets

2010-11-04 Thread DomDom
Hi there, i´ve got a problem with how to create a vector with three variables out of three seperate ascii files. These three ascii files contain pixel information of the same image but different bands and i need a matrix of vectors, with each vector containing the corresponding pixel values for

Re: [R] Loop

2010-11-04 Thread jim holtman
Is this closer to what you want, assuming that it is the value of the most frequently occurring: > apply(mat, 2, function(x) head(names(sort(table(x), decreasing=T)),5)) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] "1" "14" "5" "1" "4" "14" "6" "18" "11" "19" [2,] "3" "3" "1

Re: [R] avoid a loop

2010-11-04 Thread Joshua Wiley
And to wrap it up and help you choose, here are four functions based on these emails (the first one is my own slight variant): library(ecodist) a <- sample(1:1000, 10^4, replace = TRUE) b <- sample(letters[1:6], 10^4, replace = TRUE) foo1 <- function() { x <- table(a, b) return(x %*% t(x)) }

Re: [R] avoid a loop

2010-11-04 Thread Dennis Murphy
Hi: To mimic Sarah Goslee's reply within base R, either of these work: crossprod(t(as.matrix(xtabs( ~ a + b crossprod(t(as.matrix(table(a, b HTH, Dennis On Thu, Nov 4, 2010 at 12:42 PM, cory n wrote: > Let's suppose I have userids and associated attributes... columns a and b > > a <-

Re: [R] Loop

2010-11-04 Thread Matevž Pavlič
Hi again, Stil don't qute get it... Here's what i did : >mat<-read.csv("litologija.csv", dec=".", sep=";") >apply(mat, 2, function(x) head(sort(table(x),decreasing=T),10)) With that i get a table(list/matrix...) which gives the highest count of occurances of each value in a table (at least i

Re: [R] avoid a loop

2010-11-04 Thread David Winsemius
On Nov 4, 2010, at 4:24 PM, Sarah Goslee wrote: Here's one possibility: library(ecodist) a <- c(1,1,1,2,2,3,3,3,3) b <- c("a","b","c","a","d","a", "b", "e", "f") x <- crosstab(a, b, rep(1, length(a))) x a b c d e f 1 1 1 1 0 0 0 2 1 0 0 1 0 0 3 1 1 0 0 1 1 x %*% t(x) 1 2 3 1 3 1 2 2 1 2

Re: [R] avoid a loop

2010-11-04 Thread Sarah Goslee
Here's one possibility: > library(ecodist) > a <- c(1,1,1,2,2,3,3,3,3) > b <- c("a","b","c","a","d","a", "b", "e", "f") > > x <- crosstab(a, b, rep(1, length(a))) > x a b c d e f 1 1 1 1 0 0 0 2 1 0 0 1 0 0 3 1 1 0 0 1 1 > x %*% t(x) 1 2 3 1 3 1 2 2 1 2 1 3 2 1 4 Sarah On Thu, Nov 4, 2010 at

[R] avoid a loop

2010-11-04 Thread cory n
Let's suppose I have userids and associated attributes... columns a and b a <- c(1,1,1,2,2,3,3,3,3) b <- c("a","b","c","a","d","a", "b", "e", "f") so a unique list of a would be id <- unique(a) I want a matrix like this... [,1] [,2] [,3] [1,]312 [2,]121 [3,]2

Re: [R] ANOVA table and lmer

2010-11-04 Thread Mark Difford
Hi Jim, >> The decomposition of the sum of squares should be the same regardless of >> whether block is treated as random of fixed. Should it? By whose reckoning? The models you are comparing are different. Simple consideration of the terms listed in the (standard) ANOVA output shows that this

[R] glmnet_1.5 uploaded to CRAN

2010-11-04 Thread Trevor Hastie
This is a new version of glmnet, that incorporates some bug fixes and speedups. * a new convergence criterion which which offers 10x or more speedups for saturated fits (mainly effects logistic, Poisson and Cox) * one can now predict directly from a cv.object - see the help files for cv.glmnet

Re: [R] How to do bootstrap for the complex sample design?

2010-11-04 Thread Thomas Lumley
On Fri, Nov 5, 2010 at 3:51 AM, Tim Hesterberg wrote: > Faye wrote: >>Our survey is structured as : To be investigated area is divided into >>6 regions, within each region, one urban community and one rural >>community are randomly selected, then samples are randomly drawn from >>each selected ura

[R] plotting time series for particular months!

2010-11-04 Thread govindas
Hi all,  I have a matrix as given below... year month day prec 1   1980    10   1 13.4 2   1980    10   2  0.0 3   1980    10   3  0.0 4   1980    10   4  0.0 5   1980    10   5  0.0 6   1980    10   6  0.0 7   1980    10   7  0.0 8   1980    10   8  0.0 9   1980    10   9  0.0 10  1980    10 

Re: [R] matlab code into R

2010-11-04 Thread Phil Spector
Well, there's the obvious: N = matrix(0,n-1,n-1) for(i in 2:(n-1)) N[1,i] = 1/(pi * (i-1)) for(i in 2:(n-2)) for(j in i:(n-1)) N[i,j] = N[i-1,j-1] for(i in 2:(n-1)) for(j in 1:i) N[i,j] = -N[j,i] - Phil Spector

[R] Echo to file using Rscript

2010-11-04 Thread Bernd Wiese
I use R 2.12.0 in Windows XP. For debugging and control I am trying to get a file with contains the echo when code is copied into the R Gui. This works e.g. with the command: R CMD BATCH --no-restore D:\path\script.r then a file called script.Rout is generated in the same folder. It contain

Re: [R] ggplot output

2010-11-04 Thread Dennis Murphy
Hi: This isn't very difficult if you use a little imagination. We want three separate plots of monthly means by variable with attached error bars. This requires faceting, so we need to create a factor whose levels are the variable names. We also need to generate enough data to summarize by mean an

[R] Plotting a vector data

2010-11-04 Thread Nasrin Pak
Hi; I have 30 data sets and I managed to take the average of a variable in each set and put them in a vector like variable(It contains NaN data as well). x<- matrix( list.files("C:/updated_CFL_Rad_files/2007/11",full=TRUE)) for(i in 1:30) { radiation.data <-read.table(x[i], header = TRUE,sep = "

[R] matlab code into R

2010-11-04 Thread Marcelo Lima
Hello, I'm trying to write the following matlab code into R: N = zeros(n-1); for i=2:(n-1) N(1,i) = 1/(pi * (i-1)); end for i=2:(n-2) for j=i:(n-1) N(i,j) = N(i-1,j-1); end; end for i=2:(n-1) end for j=1:i N(i,j) = -N(j,i); end; any suggestions? Thanks can i just add the following l

[R] map on irregular grids

2010-11-04 Thread Wolfgang Polasek
Hi all how to find a function for plotting polygon surface, like polgon3d(xc,yc,obs) xc, yc ... coordinates obs observations result: persp plot with grid net over the coordinates W.Polasek [[alternative HTML version deleted]] __ R-help

[R] ANOVA table and lmer

2010-11-04 Thread James Booth
The following output results from fitting models using lmer and lm to data arising from a split-plot experiment (#320 from "Small Data Sets" by Hand et al. 1994). The data is given at the bottom of this message. My question is why is the sum of squares for variety (V) different in the ANOVA t

[R] candisc plot subset of all groups

2010-11-04 Thread farful
Hello, I'm doing CDA, and want to view a plot one group at a time. How can I plot just one group? Example: iris.mod <- lm(cbind(Petal.Length, Sepal.Length, Petal.Width, Sepal.Width) ~ Species, data=iris) iris.can <- candisc(iris.mod, data=iris) plot(iris.can) In this example the plot shows all

Re: [R] how to work with long vectors

2010-11-04 Thread Changbin Du
Thanks Phil, that is great! I WILL try this and let you know how it goes. On Thu, Nov 4, 2010 at 10:16 AM, Phil Spector wrote: > Changbin - > Does > >100 * sapply(matt$reads,function(x)sum(matt$reads >= > x))/length(matt$reads) > > give what you want? > >By the way, if you want to use

Re: [R] how to work with long vectors

2010-11-04 Thread Phil Spector
Changbin - Does 100 * sapply(matt$reads,function(x)sum(matt$reads >= x))/length(matt$reads) give what you want? By the way, if you want to use a loop (there's nothing wrong with that), then try to avoid the most common mistake that people make with loops in R: having your result grow

Re: [R] how to work with long vectors

2010-11-04 Thread Changbin Du
Thanks Martin, I will try this. On Thu, Nov 4, 2010 at 10:06 AM, Martin Morgan wrote: > On 11/04/2010 09:45 AM, Changbin Du wrote: > > Thanks, Jim! > > > > This is not what I want, What I want is calculate the percentage of > reads > > bigger or equal to that reads in each position.MY output is

Re: [R] how to work with long vectors

2010-11-04 Thread Martin Morgan
On 11/04/2010 09:45 AM, Changbin Du wrote: > Thanks, Jim! > > This is not what I want, What I want is calculate the percentage of reads > bigger or equal to that reads in each position.MY output is like the > following: Hi Changbin -- I might be repeating myself, but the Bioconductor packages IR

Re: [R] how to work with long vectors

2010-11-04 Thread Changbin Du
HI, Henrique, Thanks for the great help! I compared the output from your codes: > te<-rev(100 * cumsum(matt$reads > 1) / length(matt$reads) ) > te [1] 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 [19] 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66

Re: [R] Plotting a grid of directly specified colours

2010-11-04 Thread Barry Rowlingson
On Thu, Nov 4, 2010 at 4:00 PM, Peter Davenport wrote: > Dear R-help, > > Could any of you direct me to a function for plotting a grid of colours, > directly specified by a matrix of hex colour codes?  In other words I'm > looking for a heatmap() or image()-like function to which I can specify the

Re: [R] how to work with long vectors

2010-11-04 Thread Changbin Du
Thanks, Jim! This is not what I want, What I want is calculate the percentage of reads bigger or equal to that reads in each position.MY output is like the following: for row 1, all the reads is >= 4, so the cover_per is 100, for row 2, 99 % reads >=4, so the cover_per is 99. > head(final) cove

Re: [R] Plotting a grid of directly specified colours

2010-11-04 Thread baptiste Auguié
Hi, try this, library(grid) grid.raster(matrix(colors(),ncol=50),interp=F) HTH, baptiste On Nov 4, 2010, at 5:00 PM, Peter Davenport wrote: > Dear R-help, > > Could any of you direct me to a function for plotting a grid of colours, > directly specified by a matrix of hex colour codes? In o

Re: [R] how to work with long vectors

2010-11-04 Thread Henrique Dallazuanna
Try this: rev(100 * cumsum(matt$reads > 1) / length(matt$reads) ) On Thu, Nov 4, 2010 at 1:46 PM, Changbin Du wrote: > HI, Dear R community, > > I have one data set like this, What I want to do is to calculate the > cumulative coverage. The following codes works for small data set (#rows = > 1

Re: [R] how to work with long vectors

2010-11-04 Thread jim holtman
Is this what you want: > x id reads 1 Contig79:1 4 2 Contig79:2 8 3 Contig79:313 4 Contig79:414 5 Contig79:517 6 Contig79:620 7 Contig79:725 8 Contig79:827 9 Contig79:932 10 Contig79:1033 11 Contig79:1134 > x$percent <- x$re

Re: [R] Matrix Manipulation

2010-11-04 Thread emj83
Many thanks-its worked a treat :-) Emma -- View this message in context: http://r.789695.n4.nabble.com/Matrix-Manipulation-tp3027266p3027307.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

Re: [R] Matrix Manipulation

2010-11-04 Thread jim holtman
try this: > x V2 V3 V4 [1,] 1 1 1 [2,] 2 2 2 [3,] 3 3 3 [4,] 4 4 4 [5,] 5 NA 5 [6,] NA NA 6 [7,] NA NA NA > offset <- c(0,2,1) > # add the control to the data and make two copies so we can offset > x.new <- rbind(offset, x, x) > result <- apply(x.new, 2, function(.col){ + .

[R] Plotting a grid of directly specified colours

2010-11-04 Thread Peter Davenport
Dear R-help, Could any of you direct me to a function for plotting a grid of colours, directly specified by a matrix of hex colour codes? In other words I'm looking for a heatmap() or image()-like function to which I can specify the colour of each grid location directly, rather than providing a n

Re: [R] Loop

2010-11-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.11.2010 15:49:31: > Hi all, > > I understand that you most of you this is a peice of cake but i am a complete > newbie in thisso any example would be greatly aprpeciated and also any > hint as how to get around in R. Frankly i sometimes see

Re: [R] Sorting data from one column with strings

2010-11-04 Thread jim holtman
try sqldf: > x Sample_no Species Nitrogen Carbon 1 1 Cod 15.2 -19.0 2 2 Haddock 14.8 -20.2 3 3 Cod 15.6 -18.5 4 4 Cod 13.2 -20.1 5 5 Haddock 14.3 -18.8 > require(sqldf) > sqldf("select Species, avg(Nitrogen) Nitrogen, a

[R] Matrix Manipulation

2010-11-04 Thread emj83
Hi, Is there a quick way to go from this matrix: > A [,1] [,2] [,3] [1,]111 [2,]222 [3,]333 [4,]444 [5,]5 NA5 [6,] NA NA6 [7,] NA NA NA to this matrix: > B [,1] [,2] [,3] [1,]1 NA NA [2,]2 NA1 [3,

[R] how to work with long vectors

2010-11-04 Thread Changbin Du
HI, Dear R community, I have one data set like this, What I want to do is to calculate the cumulative coverage. The following codes works for small data set (#rows = 100), but when feed the whole data set, it still running after 24 hours. Can someone give some suggestions for long vector? id

Re: [R] Sorting data from one column with strings

2010-11-04 Thread Mike Rennie
(apologies for any double hits; forgot to reply all...) Or, you could just go back to basics, and write yourself a general loop that goes through whatever levels of a variable and gives you back whatever statistics you want... below is an example where you estimate means for each level, but you co

Re: [R] Converting Strings to Variable names

2010-11-04 Thread Mike Rennie
Hi Anand, Try creating a variable where you can store your data, and append it in your loop. See added lines of code to include below... On Thu, Nov 4, 2010 at 9:43 AM, Anand Bambhania wrote: > Hi all, > > I am processing 24 samples data and combine them in single table called > CombinedSamples

Re: [R] Problems with points in plots when importing from pdf to an SVG editor

2010-11-04 Thread Rafael Björk
Hi Erik! I googled and found that very helpful message on this adress: http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/pdf.html But when i type ?pdf I get directed here: http://127.0.0.1:29358/library/grDevices/html/pdf.html which doesn't contain that information. Thanks for the help

Re: [R] postForm() in RCurl and library RHTMLForms

2010-11-04 Thread Santosh Srinivas
I don’t have the implementation in the way you want it …. Sorry … but someone here will definitely know The group showed me to do it this way though …. library(zoo) library("RCurl") sNiftyURL = "http://nseindia.com/content/indices/histdata/S&P%20CNX%20NIFTY01-01-2000-02 -11-2010.csv" Nifty_Dat =

Re: [R] Converting Strings to Variable names

2010-11-04 Thread Erik Iverson
Anand Bambhania wrote: Hi all, I am processing 24 samples data and combine them in single table called CombinedSamples using following: CombinedSamples<-rbind(Sample1,Sample2,Sample3) Please use reproducible examples. Now variables Sample1, Sample2 and Sample3 have many different columns

Re: [R] Loop

2010-11-04 Thread Erik Iverson
Hello, The best way to get help from people on the list is for you to give us *reproducible* examples of exactly what is you want. Usually, you can come up with some sample data and code that corresponds to your situation, and that we can run directly by cutting and pasting from the email. You

Re: [R] Problems with points in plots when importing from pdf to an SVG editor

2010-11-04 Thread Erik Iverson
Just read the help page :). This is under "Note" in the ?pdf. On some systems the default plotting character ‘pch = 1’ is displayed in some PDF viewers incorrectly as a ‘"q"’ character. (These seem to be viewers based on the ‘poppler’ PDF rendering library). This may be due

Re: [R] density() function: differences with S-PLUS

2010-11-04 Thread William Dunlap
I suspect that R's help("density") will tell about the difference between its bw and width arguments. In Splus help("density") says about "width" width width of the window. ... The standard error of a Gaussian window is width/4. For the other windows width is the width of the in

Re: [R] ggplot output

2010-11-04 Thread Abhijit Dasgupta
The other way (in the same spirit as par(mfrow = ...) in base graphics) is to use the grid.arrange function in the gridExtra package. See it's documentation for examples. On Nov 4, 2010, at 9:36 AM, ashz wrote: > > Dear All, > > I have this script: > > dat <- data.frame(Month = hstat$Date,

Re: [R] removing indexing

2010-11-04 Thread Duncan Murdoch
On 04/11/2010 10:53 AM, Luis Ridao wrote: R-help, I was wondering how to remove indexing from an output, e.g., > aVector<-1:10 > aVector [1] 1 2 3 4 5 6 7 8 9 10 > someFunction(aVector) 1 2 3 4 5 6 7 8 9 10 The cat() function gives you lots of flexibility in how things

Re: [R] How to do bootstrap for the complex sample design?

2010-11-04 Thread Tim Hesterberg
Faye wrote: >Our survey is structured as : To be investigated area is divided into >6 regions, within each region, one urban community and one rural >community are randomly selected, then samples are randomly drawn from >each selected uran and rural community. > >The problems is that in urban/rural

[R] removing indexing

2010-11-04 Thread Luis Ridao
R-help, I was wondering how to remove indexing from an output, e.g., > aVector<-1:10 > aVector [1] 1 2 3 4 5 6 7 8 9 10 > someFunction(aVector) 1 2 3 4 5 6 7 8 9 10 Thanks in advance [[alternative HTML version deleted]] __

Re: [R] Loop

2010-11-04 Thread Matevž Pavlič
Hi all, I understand that you most of you this is a peice of cake but i am a complete newbie in thisso any example would be greatly aprpeciated and also any hint as how to get around in R. Frankly i sometimes see the help files kinda confusing. M -Original Message- From: Petr PIK

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
Have a look at the ggplot2 website. It has a lot of examples http://had.co.nz/ggplot2/ look at the bottom of this page for facet_grid() and facet_wrap() http://had.co.nz/ggplot2/facet_wrap.html direct link to facet_wrap() --

Re: [R] How to do bootstrap for the complex sample design?

2010-11-04 Thread Robert A LaBudde
At 01:38 AM 11/4/2010, Fei xu wrote: Hello; Our survey is structured as : To be investigated area is divided into 6 regions, within each region, one urban community and one rural community are randomly selected, then samples are randomly drawn from each selected uran and rural community. Th

[R] Converting Strings to Variable names

2010-11-04 Thread Anand Bambhania
Hi all, I am processing 24 samples data and combine them in single table called CombinedSamples using following: CombinedSamples<-rbind(Sample1,Sample2,Sample3) Now variables Sample1, Sample2 and Sample3 have many different columns. To make it more flexible for other samples I'm replacing above

Re: [R] Loop

2010-11-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.11.2010 14:21:38: > Hi David, > > I am still having troubles with that loop ... > > This code gives me (kinda) the name of the column/field in a data frame. Filed > names are form W1-W10. But there is a space between W and a number --> "W 10", >

Re: [R] ggplot output

2010-11-04 Thread ashz
Dear Thierry, Your solution looks very elgant but I can not find a proper example. Can you provide me one? Thx -- View this message in context: http://r.789695.n4.nabble.com/ggplot-output-tp3027026p3027108.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Problems with points in plots when importing from pdf to an SVG editor

2010-11-04 Thread Ivan Calandra
Hi, Try with RSvgDevice::devSVG() I don't have any problems with either Inkscape or Illustrator (CS4) HTH, Ivan Le 11/4/2010 15:04, Rafael Björk a écrit : Dear R-users When trying to import graphics from an pdf-file to a Vector graphics editor (I use Inkscape, but i've confirmed the same prob

Re: [R] avoiding too many loops - reshaping data

2010-11-04 Thread Hadley Wickham
> Beware of facile comparisons of this sort -- they may be apples and nematodes. And they also imply that the main time sink is the computation. In my experience, figuring out how to solve the problem using takes considerably more time than 18 / 1000 seconds, and so investing your energy in learn

[R] Problems with points in plots when importing from pdf to an SVG editor

2010-11-04 Thread Rafael Björk
Dear R-users When trying to import graphics from an pdf-file to a Vector graphics editor (I use Inkscape, but i've confirmed the same problem on adobe products), all points in the graphics turn out as "q"s. This example displays the beaviour: pdf(file="points are weird.pdf") plot(1:5) dev.off()

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
Split.screen() and par() don't work with ggplot2 ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Fo

Re: [R] ggplot output

2010-11-04 Thread ONKELINX, Thierry
The easiest way it to create one long dataset with four variables: Month, avg, stdev and type. Type will be either K, C or S. Then you just need to add some facetting to your code ggplot(data = dat, aes(x = Month, y = avg, ymin = avg - stdev, ymax = avg + stdev)) + geom_point() + geom_line()

Re: [R] ggplot output

2010-11-04 Thread Eigenhuis, Annemarie
Have you tried ?split.screen Annemarie Eigenhuis, MSc University of Amsterdam Department of Psychology, clinical area Roetersstraat 15 1018 WB Amsterdam The Netherlands phone: +31(0)205256815 email: a.eigenh...@uva.nl -Original Message- From: r-help-

[R] ggplot output

2010-11-04 Thread ashz
Dear All, I have this script: dat <- data.frame(Month = hstat$Date,C_avg = hstat$C.avg,C_stdev = hstat$C.stdev) ggplot(data = dat, aes(x = Month, y = C_avg, ymin = C_avg - C_stdev, ymax = C_avg + C_stdev)) + geom_point() + geom_line() + geom_errorbar() dat <- data.frame(Month = hstat$D

[R] (no subject)

2010-11-04 Thread Roes Da
hello,i'm roesda from indonesia I have trouble when they have to perform parameter estimation by MLE method using the R programming.because, the distribution that will be used instead of not like the distribution that already known distributions such as gamma distribution, Poisson or binomial. th

Re: [R] Sorting data from one column with strings

2010-11-04 Thread Eigenhuis, Annemarie
Try tapply(). For example: tapply(data$Nitrogen,factor(data$Species),mean) For the Nitrogen column, the mean is calculated for each Species. (if the data frame below is in the object data) Regards, Annemarie Eigenhuis -Original Message- From: r-help-boun...@r-project.org [mailto:r-he

Re: [R] Loop

2010-11-04 Thread David Winsemius
On Nov 4, 2010, at 9:21 AM, Matevž Pavlič wrote: Hi David, I am still having troubles with that loop ... This code gives me (kinda) the name of the column/field in a data frame. Filed names are form W1-W10. But there is a space between W and a number --> "W 10", and column (field) names d

Re: [R] Loop

2010-11-04 Thread Matevž Pavlič
Hi David, I am still having troubles with that loop ... This code gives me (kinda) the name of the column/field in a data frame. Filed names are form W1-W10. But there is a space between W and a number --> "W 10", and column (field) names do not contain numbers. >for(i in 1:10) >{ >vari <-

  1   2   >