Re: [R] Memory Utilization on R

2012-03-22 Thread R. Michael Weylandt
Well... what makes you think you are hitting memory constraints then? If you have significantly less than 3GB of data, it shouldn't surprise you if R never needs more than 3GB of memory. You could just be running your scripts inefficiently...it's an extreme example, but all the memory and gigaflop

Re: [R] Quicker way to apply values to a function

2012-03-22 Thread R. Michael Weylandt
I'd imagine one could solve this problem analytically (divergence/convergence *almost certainly* [hint cough!]closed form value seems hard) but perhaps you want to loop over a matrix instead: v <- matrix(NA, ncol = length(mymu), nrow = length(mysigma)) rownames(v) <- mysigma colnames(v) <- mym

Re: [R] barplot on map

2012-03-22 Thread Peter Ehlers
Check out the subplot() function in the TeachingDemos package. Peter Ehlers On 2012-03-22 12:28, Martin Renner wrote: I used the function stars() to make barplot-like plots on a map. Now editor wants us to use more traditional vertical barplots. Does anybody already have some code that would

Re: [R] Memory Utilization on R

2012-03-22 Thread R. Michael Weylandt
Use 64bit R? Michael On Thu, Mar 22, 2012 at 5:22 PM, Kurinji Pandiyan wrote: > Hello, > > I have a 32 GB RAM Mac Pro with a 2*2.4 GHz quad core processor and 2TB > storage. Despite this having so much memory, I am not able to get R to > utilize much more than 3 GBs. Some of my scripts take hour

Re: [R] question

2012-03-22 Thread R. Michael Weylandt
By googling. On Thu, Mar 22, 2012 at 11:37 PM, Anjana Thampi wrote: > How do you run a regression in R? > >        [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do

[R] Fixing error variance in a path analysis to model measurement error in scales using sem package

2012-03-22 Thread Kino Aguilar
Hi! I want to construct a path analysis model that can account for measurement error in totally aggregated parcels, which refer to parcels where all of the items in a scale are summed or averaged. If I am not mistaken, Bollen (1989) advocates the following formula for computing the error variance

[R] barplot on map

2012-03-22 Thread Martin Renner
I used the function stars() to make barplot-like plots on a map. Now editor wants us to use more traditional vertical barplots. Does anybody already have some code that would allow to make a small barplot at xy location within a larger plot? Best, Martin Martin Renner Post-doctoral Fellow

[R] question

2012-03-22 Thread Anjana Thampi
How do you run a regression in R? [[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 com

Re: [R] R (Bold font) and Latex

2012-03-22 Thread Manish Gupta
Great it works! But in my case i have to use text bf in loop (R). Since x is variable (row from file) which keeps on changing. How can i implement the above logic in loop. Regards -- View this message in context: http://r.789695.n4.nabble.com/R-Bold-font-and-Latex-tp4487535p4497610.html Sent

Re: [R] deSolve

2012-03-22 Thread Ben Bolker
Berend Hasselman xs4all.nl> writes: > > > On 22-03-2012, at 18:37, mhimanshu wrote: > > How to find best parameter values for deSolve function?? > > > > I assume you mean the deSolve package which has many options. > > I would suggest predicting which way the wind will blow the > day after

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
After go dinner...an non elegant "patch solution"... is working: /str(hbin) density <- table(hbin@count) cell <- table(hbin@cell) xcm <- table(hbin@xcm) ycm <- table(hbin@ycm) write.table(density, file="temp.density", sep="\t")/ ... and the same for xcm, ycm, cell the disadvantage is to work with

[R] Memory Utilization on R

2012-03-22 Thread Kurinji Pandiyan
Hello, I have a 32 GB RAM Mac Pro with a 2*2.4 GHz quad core processor and 2TB storage. Despite this having so much memory, I am not able to get R to utilize much more than 3 GBs. Some of my scripts take hours to run but I would think they would be much faster if more memory is utilized. How do I

[R] Quicker way to apply values to a function

2012-03-22 Thread casperyc
Hi all, myint=function(mu,sigma){ integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value } mymu=seq(-3,3,length(1000)) mysigma=seq(0,1,length(500))[-1] k=1 v=c() for (j in 1:length(mymu)) { for (i in 1:length(mysigma)) { v[k]=myint(mymu[j],mysigma[i])

Re: [R] Using "Compare" While Excluding Certain Columns

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 1:29 PM, Edgar Alminar wrote: Hello All, Is it possible to use compare (or something like it) and exclude certain columns in the csv's being compared? I have tried a bunch of different things and done some research, but couldn't find anything or get it to work. You w

Re: [R] Randomly select elements based on criteria

2012-03-22 Thread Peter Ehlers
Here's another way: With d1 as your data frame, library(plyr) d2 <- ddply(d1, .(fam), function(x) x[sample(nrow(x), 1), ]) d2[sample(nrow(d2), 2), ] If you have to take account of the 'only one family' case, you can wrap this in a function with an appropriate check: fish <- function(d){

[R] Computing High Order Derivatives (Numerically)

2012-03-22 Thread Gildas Mazo
Dear R users, Let f be a function over d variables x1,..,xd. I want to compute the k^th-order derivative with respect to x1,..,xk (k<=d). I have a by hand solution (see below) using an iterating code using D. However, I expect d to be high and f to be complicated. Then I want a vector x to be t

Re: [R] Randomly select elements based on criteria

2012-03-22 Thread Jorge I Velez
You could avoid the loop to run for ever by introducing a stop() check. Here is an example using Dr. Savicky's code: # function to sample B pairs of # fishes from different families # -- d has columns fam, born, spawn foo <- function(d, B){ # internal function foo <- function(d){

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hi Michael, This may be an ugly way of doing things but the "title = unique(paste( ..." bit in the code below automates the code for pattern, patient, and line. So now all I'd need is the looping part. If good ways of automating the code for pattern, patient, and line or of doing the looping a

Re: [R] Rcmd build -binary -- problem

2012-03-22 Thread Prof Brian Ripley
On 22/03/2012 17:33, Stephen Eick wrote: Hi. I need a bit of help. I'm running Windows 7 and "out of the box" versions of Rtools and R (version 2.14.2) and am trying to compile a package that worked before. When I run the command: Rcmd build -binary mypackage Warning: unknown option '-binary'

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hi Michael, Want to reverse the ordering of drugs on the y-axis. So tried scale_y_reverse() instead of scale_x_reverse(). Sure enough, the command exits. Unfortunately, it is "unsuitable for factors". I tried converting "drug" to character but this didn't work. Suspect scale_x_reverse() only wo

Re: [R] deSolve

2012-03-22 Thread Berend Hasselman
On 22-03-2012, at 18:37, mhimanshu wrote: > Hello all, > > How to find best parameter values for deSolve function?? > I assume you mean the deSolve package which has many options. I would suggest predicting which way the wind will blow the day after tomorrow. Berend

Re: [R] Randomly select elements based on criteria

2012-03-22 Thread Petr Savicky
On Thu, Mar 22, 2012 at 11:42:53AM -0700, aly wrote: > Hi, > > I want to randomly pick 2 fish born the same day but I need those > individuals to be from different families. My table includes 1787 fish > distributed in 948 families. An example of a subset of fish born in one > specific day would l

Re: [R] How to export hexbin tables?

2012-03-22 Thread R. Michael Weylandt
Grumble grumblestop triple postinggrumble grumble..damn nabblegrumble grumble It's inelegant, but if your Python-skills are up for it, you could do something like this: sapply(c("cell","count","xcm","ycm"), function(x) slot(HEXBINOBJECTNAME, x)) You'll have to reconstruct thi

Re: [R] trouble for parsing HTML files

2012-03-22 Thread R. Michael Weylandt
Please give sessionInfo() so we can know your version of XML. Michael On Thu, Mar 22, 2012 at 2:04 PM, Julien Velcin wrote: > I use mac OS 10.5.8 with this version of R: > > R version 2.14.1 (2011-12-22) > Platform: i386-apple-darwin9.8.0/i386 (32-bit) > > I've tried the command "RSiteSearch", b

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread R. Michael Weylandt
On Thu, Mar 22, 2012 at 4:47 PM, Paul Miller wrote: > Hi Michael, > > Made some progress but not there yet. > > Got point #1 by creating an ordered factor. There doesn't appear to be a > command called Scale_x_flip(). > Sorry, my mistake: I meant scale_x_reverse() ... > Still not sure how to de

Re: [R] How do you distinguish between characters on a pco plot?

2012-03-22 Thread Sarah Goslee
Hi, You can use eg pch and col in the plot command (see ?par for information). The help for pco even gives an example of doing so. Sarah On Thu, Mar 22, 2012 at 1:15 PM, leannehaggerty wrote: > I have a presence/absence matrix for which I create a distance matrix and > then perform pco analysi

Re: [R] how to avoid grid overlapping in a boxplot

2012-03-22 Thread Rui Barradas
Hello, Michael Weylandt wrote > > It's a bit of a hack, but you could just redraw the boxplot on top of > the grid lines: > > x <- rnorm(50) > boxplot(x) > grid() > boxplot(x, add = TRUE) > > Michael > > > On Thu, Mar 22, 2012 at 12:08 PM, maxbre wrote: >> Given the follow

[R] Order of terms in formula changes aov() results

2012-03-22 Thread Stuart Luppescu
Hello, This one is very perplexing. I have teacher observation data, with factors teacher ID, observer ID, component, grade and subject. When I do this, aov(data=ratings.prin.22, rating ~ obsid.f + tid.f + subject.f + grade.f + comp.f) I get this: Terms: obsid.f tid.f gr

Re: [R] plotting moving range control chart

2012-03-22 Thread iTrubin
My favorite Control chart is based on MASF - Multivariate Adaptive Statistical Filtering and it is called IT-Control Charts (good to use against date-time stamped data like System performance metrics. And that is actually based on moving range that MASF calls as a reference set. I have recent

Re: [R] read.zoo - combining two columns with date and time respectively into one index column?

2012-03-22 Thread knavero
Ah yes, sorry about that Gabor. Found a pretty good example in ?read.zoo where it has index = 1:3 and takes in times objects. I must have overlooked it out of impatience. Thanks for the quick and simple feedback however. -- View this message in context: http://r.789695.n4.nabble.com/read-zoo-comb

Re: [R] Multivariate control charts in R ?

2012-03-22 Thread iTrubin
My favorite Control chart is based on MASF - Multivariate Adaptive Statistical Filtering and it is called IT-Control Charts (good to use against date-time stamped data like System performance metrics. I have recently started using R to build IT-Control Chart and I am publishing my progress in my

Re: [R] glm.fit: fitted probabilities numerically 0 or 1 occurred?

2012-03-22 Thread ufuk beyaztas
Dear ted, thanks for your help. Now, everything is more clear. I read something about "linear separation" you mentioned, and my data set is very suitable for this problem. But, there is a confusing question for me; I can not controll the process adequately because of usage of bootstrap. So, this

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi Michael! thanks for your answer, but In fact I need to export the hexbin table (the set of hexagons' coordinates, "weights", etc) into an ASCII file. Not the workspace... but only the "table". I gonna handle it with python (this is the ASCII reason), and compare with some theorical pre

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi Michael! thanks for your answer, but In fact I need to export the hexbin table (the set of hexagons' coordinates, "weights", etc) into an ASCII file. Not the workspace... but only the "table". I gonna handle it with python (this is the ASCII reason), and compare with some theorical pre

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi Michael! thanks for your answer, but In fact I need to export the hexbin table (the set of hexagons' coordinates, "weights, etc) into an ASCII file. Not the workspace... but only the "table". I gonna hadle it with python (this is the ASCII reason), and comparing with some theorical predic

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi David! I tried with dump(), but it can't handle S4 objects (as hexbin is): > dump("hbin", file="123.R") Warning message: In dump("hbin", file = "123.R") : deparse of an S4 object will not be source()able Thanks 4 the help... please give me another idea! :) -- View this message in cont

[R] deSolve

2012-03-22 Thread mhimanshu
Hello all, How to find best parameter values for deSolve function?? Thanks in Advance, -- View this message in context: http://r.789695.n4.nabble.com/deSolve-tp4496292p4496292.html Sent from the R help mailing list archive at Nabble.com. __ R-help@

Re: [R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi David! I tried with dump(), but it can't handle S4 objects (as hexbin is): / > dump("hbin", file="123.R") Warning message: In dump("hbin", file = "123.R") : deparse of an S4 object will not be source()able/ Thanks 4 the help... please give me another idea! :) -- View this message in context

[R] Rcmd build -binary -- problem

2012-03-22 Thread Stephen Eick
Hi. I need a bit of help. I'm running Windows 7 and "out of the box" versions of Rtools and R (version 2.14.2) and am trying to compile a package that worked before. When I run the command: > Rcmd build -binary mypackage > Warning: unknown option '-binary' i get a warning and it creates the tar

[R] Using "Compare" While Excluding Certain Columns

2012-03-22 Thread Edgar Alminar
Hello All, Is it possible to use compare (or something like it) and exclude certain columns in the csv's being compared? I have tried a bunch of different things and done some research, but couldn't find anything or get it to work. Any help would be greatly appreciated. Thanks! Edgar Alminar C

[R] How do you distinguish between characters on a pco plot?

2012-03-22 Thread leannehaggerty
I have a presence/absence matrix for which I create a distance matrix and then perform pco analysis on. /library(ecodist) table <- read.table("matrix.pa") dist <- dist(table, method = "euclidean", diag = FALSE, upper = FALSE) dist.pco <- pco(dist)/ When I plot the pco analysis of the distance ma

Re: [R] trouble for parsing HTML files

2012-03-22 Thread Julien Velcin
I use mac OS 10.5.8 with this version of R: R version 2.14.1 (2011-12-22) Platform: i386-apple-darwin9.8.0/i386 (32-bit) I've tried the command "RSiteSearch", but with no result. BTW, I recall that the code I've posted works for some websites. Julien 2012/3/22, Milan Bouchet-Valat : > Le je

[R] Randomly select elements based on criteria

2012-03-22 Thread aly
Hi, I want to randomly pick 2 fish born the same day but I need those individuals to be from different families. My table includes 1787 fish distributed in 948 families. An example of a subset of fish born in one specific day would look like: >fish fam born spawn 25 46 43 25 46

Re: [R] how to hide code of any function

2012-03-22 Thread Greg Snow
See the 'petals' function in the TeachingDemos package for one example of hiding source from casual inspection (intermediate level R users will still easily be able to figure out what the key code is, but will not be able to claim that they stumbled across it on accident). This post gives another

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hi Michael, Made some progress but not there yet. Got point #1 by creating an ordered factor. There doesn't appear to be a command called Scale_x_flip(). Still not sure how to decrease vertical space between the line segments for each drug. Thought this would be necessary in order to get a f

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread Vihan Pandey
On 22 March 2012 21:06, David Winsemius wrote: > > On Mar 22, 2012, at 3:18 PM, Vihan Pandey wrote: > >> Hi all, >> >> I have the following R script : >> >> >> #!/usr/bin/Rscript >> >> out_file = "hybrid.pdf" >> pdf(out_file, height=8.5, width=11) > > > At this point (assuming that you want three

Re: [R] trouble for parsing HTML files

2012-03-22 Thread Julien Velcin
Sorry for the multiple messages. -- I use mac OS 10.5.8 with this version of R: R version 2.14.1 (2011-12-22) Platform: i386-apple-darwin9.8.0/i386 (32-bit) I've tried the command "RSiteSearch", but with no result. BTW, I recall that the code I've posted works for some websites. Julien _

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread Vihan Pandey
On 22 March 2012 20:54, Chris Snook wrote: > vihan, > > you jsut need to add the following statement in the subsequent plot > commands: > > add = TRUE > > so that your second and later plot commands look similar to: > > plot(myvalues_5M$num_sims_per_thread,myvalues_5M$time_per_sim,xlab="Number > o

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread Vihan Pandey
On 22 March 2012 20:23, R. Michael Weylandt wrote: > Don't use plot three times -- it opens a new page when pdf() is your > current device. Do the first with plot -- then use lines() online from > there to the end. Thanks a million that did the job! :-) Cheers! - vihan > > Michael > > On Thu,

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 3:18 PM, Vihan Pandey wrote: Hi all, I have the following R script : #!/usr/bin/Rscript out_file = "hybrid.pdf" pdf(out_file, height=8.5, width=11) At this point (assuming that you want three separate plots on the same page which is unclear but you do use different t

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread Chris Snook
vihan, you jsut need to add the following statement in the subsequent plot commands: add = TRUE so that your second and later plot commands look similar to: plot(myvalues_5M$num_sims_per_thread,myvalues_5M$time_per_sim,xlab="Number of Simulations per Thread",ylab="Time per 1 million Simulations

[R] substituting XML tags with custom values

2012-03-22 Thread filip
Hello, I have an xml document with a following element: ACAGTTGACACCCTT I would like to parse a new sequence of characters inside the "taxon" tags. I started looking into XML package documentation, but cannot find a simple solution yet. My code: # load packages require(

Re: [R] getting multiple plots on a single plot

2012-03-22 Thread R. Michael Weylandt
Don't use plot three times -- it opens a new page when pdf() is your current device. Do the first with plot -- then use lines() online from there to the end. Michael On Thu, Mar 22, 2012 at 3:18 PM, Vihan Pandey wrote: > Hi all, > > I have the following R script : > > > #!/usr/bin/Rscript > > ou

[R] getting multiple plots on a single plot

2012-03-22 Thread Vihan Pandey
Hi all, I have the following R script : #!/usr/bin/Rscript out_file = "hybrid.pdf" pdf(out_file, height=8.5, width=11) myvalues_1M <- read.csv("hybrid_sims_1M.csv",head=TRUE,sep=",") plot(myvalues_1M$num_sims_per_thread,myvalues_1M$time_per_sim,xlab="Number of Simulations per Thread",ylab="Tim

Re: [R] gamlss results for EXP and LNO seem to have reversed AIC scores

2012-03-22 Thread rigbyr
Global Deviance = -2*fitted log likelihood, AIC = Global deviance +2*number of parameters Choocing distribution with the lowest AIC selects the exponential -- View this message in context: http://r.789695.n4.nabble.com/gamlss-results-for-EXP-and-LNO-seem-to-have-reversed-AIC-scores-tp4409754p4496

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hi Bert, Seems I've not provided enough detail. Sometimes it's hard to know how much to put in. If you run all the code I sent, I think my data do make it into the "long" format. Let me begin by trying to explain my data as they appear prior to the melt() function. The data for patient 2 (pr

Re: [R] How to export hexbin tables?

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 12:31 PM, fco.pch wrote: Hi all! I'm trying to save an output of the HEXBIN process... is so much data (105k), and I need to export to an ASCII file. ?dump I tried to use: write.table() > Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce cla

Re: [R] Create weird type of sequences

2012-03-22 Thread Alaios
Thanks a lot.. that is the way to it . From: Richard M. Heiberger Cc: R help Sent: Thursday, March 22, 2012 7:09 PM Subject: Re: [R] Create weird type of sequences rep(1:4, c(1,2,4,8)) rep has additional arguments that might be helpful to you. ?rep De

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Bert Gunter
The message apparently sent itself before I was ready . :-( Here's the full version. I hope I have interpreted your intent correctly. Ignore if I have not. A general approach to this sort of thing is to get your data in "long" format, like this patientID   time   value  A 1

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread R. Michael Weylandt
Inline: On Thu, Mar 22, 2012 at 1:41 PM, Paul Miller wrote: > Hello All, > > Want very much to learn how to plot patient drug timelines. Trouble is I need > to figure out how to do this today. So not much time for me to struggle with > it. Hoping someone can just help me out a bit. > > Below ar

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Bert Gunter
Your data are still uninterpretable to me. A general approach to this sort of thing is to get your data in "long" format, like this patientID time value A On Thu, Mar 22, 2012 at 10:41 AM, Paul Miller wrote: > Hello All, > > Want very much to learn how to plot patient drug timelines. Trou

Re: [R] writing data to file

2012-03-22 Thread Peter Ehlers
On 2012-03-22 08:35, mail me wrote: Hi: I created a data frame df<- data.frame( person = c('John','Bob','Mary'), team = c('a','b','c'), stringsAsFactors = F); and obtained the expected output df person team 1 John a 2Bob b 3 Mary c now I want to save the whole

Re: [R] trouble for parsing HTML files

2012-03-22 Thread Milan Bouchet-Valat
Le jeudi 22 mars 2012 à 17:20 +0100, Julien Velcin a écrit : > Hi all, > > Using the XML package, I'm not able to parse some html webpages. Here > is my code and the error message: > > library("XML") > url <- "http://www.huffingtonpost.com/social/GraniteSkyline?action=fans"; > doc <- htmlParse(

[R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hello All, Want very much to learn how to plot patient drug timelines. Trouble is I need to figure out how to do this today. So not much time for me to struggle with it. Hoping someone can just help me out a bit. Below are some sample data and code that produces what I think is the beginning o

Re: [R] How to get the input of a function right?

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 12:14 PM, Sarah Goslee wrote: On Thu, Mar 22, 2012 at 11:55 AM, R. Michael Weylandt wrote: This is quite difficult without being able to see the function f . Michael I thought we had a fortune about telepathy, but I can't find it in the fortunes package. Using t

Re: [R] Automaticall adjust axis scales

2012-03-22 Thread R. Michael Weylandt
Simply calculate it before it's not hard: ylim = range(sapply(datalist, function(x) range(x$dataset$Utilization))) should work, but it's untested. Then pass that to plot(). If your data set is large enough that you want to do a single loop, simply create a list of the density objects and ge

Re: [R] Automaticall adjust axis scales

2012-03-22 Thread Alaios
Hmm.. this how my code looks like inside my function plot(density(100*datalist[[1]]$dataset$Utilization), xlab="Overall utilization [ % ]", main="", ...)     colorList=colors()[seq(10,100,10)]     colorList[1]="black"     if (length(datalist) > 1) {         for (i in 2:length(datalist)) {        

Re: [R] Create weird type of sequences

2012-03-22 Thread Uwe Ligges
On 22.03.2012 18:03, Alaios wrote: Dear all, I would like to create the following sequence of numbers 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 and so on (actually I double the number of same elements) the reason is that I want then to feed the sequence above to tapply(myVector, weirSeq, FUN = mean)

Re: [R] Create weird type of sequences

2012-03-22 Thread Richard M. Heiberger
rep(1:4, c(1,2,4,8)) rep has additional arguments that might be helpful to you. ?rep On Thu, Mar 22, 2012 at 1:03 PM, Alaios wrote: > Dear all, > I would like to create the following sequence of numbers > 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 and so on (actually I double the number of > same elements

Re: [R] Replace sub string

2012-03-22 Thread Ajay Askoolum
Thanks. 1. For consistency: I am using / everywhere else in my script. 2. For ease of use: I am passing the string to a client application (using rcom) where it is easeir to handle / than \\. See ?gsub But why would you do that? Both / and \\ are valid in a p

[R] Create weird type of sequences

2012-03-22 Thread Alaios
Dear all, I would like to create the following sequence of numbers 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4 and so on (actually I double the number of same elements) the reason is that I want then to feed the sequence above to  tapply(myVector, weirSeq, FUN = mean) and then average over those... Coul

Re: [R] how to avoid grid overlapping in a boxplot

2012-03-22 Thread R. Michael Weylandt
It's a bit of a hack, but you could just redraw the boxplot on top of the grid lines: x <- rnorm(50) boxplot(x) grid() boxplot(x, add = TRUE) Michael On Thu, Mar 22, 2012 at 12:08 PM, maxbre wrote: > Given the following chart: i.e. a boxplot with a grid > > boxplot(x~y) > grid(nx=NA,ny=NULL) >

Re: [R] how to avoid grid overlapping in a boxplot

2012-03-22 Thread Sarah Goslee
On Thu, Mar 22, 2012 at 12:08 PM, maxbre wrote: > Given the following chart: i.e. a boxplot with a grid > > boxplot(x~y) > grid(nx=NA,ny=NULL) > > my question: how to avoid the overlapping of boxes (and whiskers) by grid > lines? Don't draw a grid? Put the lines somewhere else? > thank you for

Re: [R] How to export hexbin tables?

2012-03-22 Thread R. Michael Weylandt
What do you need to use it again for? If you just want to get it back for a different R session (which I think is the only thing that makes sense) you might only need to save() the object and then you can load() it later. [Or perhaps better, saveRDS() and readRDS()] Michael On Thu, Mar 22, 2012 a

[R] how to avoid grid overlapping in a boxplot

2012-03-22 Thread maxbre
Given the following chart: i.e. a boxplot with a grid boxplot(x~y) grid(nx=NA,ny=NULL) my question: how to avoid the overlapping of boxes (and whiskers) by grid lines? thank you for any help pointing me in the right direction max -- View this message in context: http://r.789695.n4.nabble.c

[R] How to export hexbin tables?

2012-03-22 Thread fco.pch
Hi all! I'm trying to save an output of the HEXBIN process... is so much data (105k), and I need to export to an ASCII file. I tried to use: write.table() > Error in as.data.frame.default(x[[i]], optional = TRUE) : cannot coerce class 'structure("hexbin", package = "hexbin")' into a data

Re: [R] how to adjust gui window size

2012-03-22 Thread j verzani
mrzung gmail.com> writes: > > hi, i'm trying to make gui function by "aDialog" FUN. > What i want to do is adjusting the window size. > > my function is , > > aa<- aDialog(items=list( > ps=numericItem(), > number=numericItem(), > term=numericItem() > ), > OK_handler=function(.) { # . is refere

Re: [R] writing data to file

2012-03-22 Thread Gaurav Sood
look up dump On Thu, Mar 22, 2012 at 11:35 AM, mail me wrote: > Hi: > > I created a data frame > > df <- data.frame( person = c('John','Bob','Mary'), team = > c('a','b','c'), stringsAsFactors = F); > > and obtained the expected  output > >  df >  person   team > 1   John      a > 2    Bob      b

[R] trouble for parsing HTML files

2012-03-22 Thread Julien Velcin
Hi all, Using the XML package, I'm not able to parse some html webpages. Here is my code and the error message: library("XML") url <- "http://www.huffingtonpost.com/social/GraniteSkyline?action=fans"; doc <- htmlParse(url) Error: Namespace prefix ꛀ of attribute (null) is not defined I've

Re: [R] How to get the input of a function right?

2012-03-22 Thread Sarah Goslee
On Thu, Mar 22, 2012 at 11:55 AM, R. Michael Weylandt wrote: > This is quite difficult without being able to see the function f . > > Michael I thought we had a fortune about telepathy, but I can't find it in the fortunes package. Sarah -- Sarah Goslee http://www.functionaldiversity.org __

Re: [R] Suggestions for RAM for new box

2012-03-22 Thread Marc Schwartz
On Mar 22, 2012, at 10:26 AM, Neotropical bat risk assessments wrote: > Hi all, > > My main Dell melted down a month ago and I need to buy a new workstation. > It will be Win7 64 bit and fast graphics card with large RAM. > > For GIS (ArcGis) I am opting for 6 GB RAM. > Is there any advantage fo

Re: [R] How to get the input of a function right?

2012-03-22 Thread R. Michael Weylandt
This is quite difficult without being able to see the function f . Michael On Thu, Mar 22, 2012 at 11:43 AM, stella wrote: > Hi, > > I wrote a function with three inputs fun(x,y,z). > > x is a matrix of three vectors combined with cbind. e.g. > > x1<-(1,2,3,4) > x2<-(2,3,4,5) > x3<-(3,4,5,6)

[R] how to adjust gui window size

2012-03-22 Thread mrzung
hi, i'm trying to make gui function by "aDialog" FUN. What i want to do is adjusting the window size. my function is , aa<- aDialog(items=list( ps=numericItem(), number=numericItem(), term=numericItem() ), OK_handler=function(.) { # . is reference to dlg object values <- .$to_R() do.call("KOD",va

Re: [R] How to get the input of a function right?

2012-03-22 Thread Petr Savicky
On Thu, Mar 22, 2012 at 08:43:00AM -0700, stella wrote: > Hi, > > I wrote a function with three inputs fun(x,y,z). > > x is a matrix of three vectors combined with cbind. e.g. > > x1<-(1,2,3,4) > x2<-(2,3,4,5) > x3<-(3,4,5,6) > > x<-cbind(x1,x2,x3) > > y is a vector e.g > y<-c(7,8,9) > > z i

Re: [R] Recommendations regarding textbooks

2012-03-22 Thread Liviu Andronic
On Thu, Mar 22, 2012 at 1:17 PM, richard willey wrote: > I was hoping to get some advice regarding teaching R in an academic > environment. > > thinks regarding “An R Companion to Applied Regression”. > CAR features an excellent introduction to R programming. Liviu

[R] How to get the input of a function right?

2012-03-22 Thread stella
Hi, I wrote a function with three inputs fun(x,y,z). x is a matrix of three vectors combined with cbind. e.g. x1<-(1,2,3,4) x2<-(2,3,4,5) x3<-(3,4,5,6) x<-cbind(x1,x2,x3) y is a vector e.g y<-c(7,8,9) z is a real number e.g. z<-2.5 If a give the function an input like this, I get 'NA' in re

[R] writing data to file

2012-03-22 Thread mail me
Hi: I created a data frame df <- data.frame( person = c('John','Bob','Mary'), team = c('a','b','c'), stringsAsFactors = F); and obtained the expected output df person team 1 John a 2Bob b 3 Mary c now I want to save the whole content of df preserving its row and co

Re: [R] Error : package is not installed for 'arch=x64'

2012-03-22 Thread Uwe Ligges
On 22.03.2012 16:46, Li, Yan wrote: Hi Uwe, Thanks very much for your reply! It is in Windows OS and I read the manual, installed the latest version of RTools. I also have MinGW64 compiler installed. I still kept getting this errors. Then, please make your package available and tell us w

Re: [R] Error : package is not installed for 'arch=x64'

2012-03-22 Thread Li, Yan
Hi Uwe, Thanks very much for your reply! It is in Windows OS and I read the manual, installed the latest version of RTools. I also have MinGW64 compiler installed. I still kept getting this errors. Regards, Yan -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund

[R] Suggestions for RAM for new box

2012-03-22 Thread Neotropical bat risk assessments
Hi all, My main Dell melted down a month ago and I need to buy a new workstation. It will be Win7 64 bit and fast graphics card with large RAM. For GIS (ArcGis) I am opting for 6 GB RAM. Is there any advantage for R to boost this to 8 GB or will 6 GB be sufficient for R applications? There hav

Re: [R] Recommendations regarding textbooks

2012-03-22 Thread Peter Ehlers
On 2012-03-22 05:17, richard willey wrote: Hello I was hoping to get some advice regarding teaching R in an academic environment. What are the best choices with respect to textbooks? When this question was asked a few years back, people were primarily recommending “Modern Applied Statistics wi

[R] deSolve & optim, nlm function?

2012-03-22 Thread mhimanshu
Hi everyone. Can anyone please tell me how do i used optim or nlm function after solving a ode bx desolve package? I have a set of two differential equation, first i solved them with deSolve package and now i want to optimize my two parameter values for the same twoo differential equation? pleas

Re: [R] How to change colnames in xtable?

2012-03-22 Thread Rainer Schuermann
You can change the column names of a data frame with > colnames( df ) <- c( "my", "data", "frame" ) and from here, xtable() is your friend (or at least mine...). Rgds, Rainer On Thursday 22 March 2012 01:13:18 Manish Gupta wrote: > Hi, > > Can we change column names in latex table? > > Regar

Re: [R] Multiple data frames in single csv output

2012-03-22 Thread R. Michael Weylandt
To elaborate (because I've made this mistake before): one can use append = TRUE for write.table() but not write.csv(). You'll need to set the other arguments in write.table() to match the csv standard you're using. Michael On Thu, Mar 22, 2012 at 10:36 AM, David Winsemius wrote: > > On Mar 22, 2

Re: [R] Multiple data frames in single csv output

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 6:37 AM, Andreas Emanuelsson wrote: Hi everybody, I have a model that outputs 1) primary analysis results, 2) secondary analysis results and 3) model choice parameters. I would like to output them all together as one "spread sheet" to minimize my "copy paste time" since

[R] earth and linearly dependent regressors

2012-03-22 Thread Johann Hibschman
I'm trying to understand how the earth package treats linearly dependent regressors. I was surprised when switching between two linearly-dependent terms gave different results. Here's an example: > library(earth) > cars2 <- transform(cars, speed2=100-speed) > earth(dist ~ speed, data=cars2) Select

Re: [R] read.zoo - combining two columns with date and time respectively into one index column?

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 8:24 AM, knavero wrote: I have three columns in my raw data: date, time, and dry bulb temperature: http://r.789695.n4.nabble.com/file/n4495326/weathDataSDCoron.txt weathDataSDCoron.txt The date format is %Y%m%d and the time format is %H:%M. Any ideas on how to read it

Re: [R] read.zoo - combining two columns with date and time respectively into one index column?

2012-03-22 Thread Gabor Grothendieck
On Thu, Mar 22, 2012 at 8:24 AM, knavero wrote: > I have three columns in my raw data: date, time, and dry bulb temperature: > > http://r.789695.n4.nabble.com/file/n4495326/weathDataSDCoron.txt > weathDataSDCoron.txt > > The date format is %Y%m%d and the time format is %H:%M. Any ideas on how to >

Re: [R] Bubble chart

2012-03-22 Thread David Winsemius
On Mar 22, 2012, at 12:22 AM, ens wrote: I have a matrix of p-values for for each explanatory variable. Each row is an area of the response variable and each column is an explanatory variable. e.g. PSA pval_DOY pval_PDSIconcurrent pval_PDSIantecedent_annual_average pval_TMAXanomaly

Re: [R] Recommendations regarding textbooks

2012-03-22 Thread R. Michael Weylandt
What level are you looking to teach? MASS is fantastic but very terse; it presumes a good foundation in statistics and deals mainly with the computational aspects. My guess would be that this book would only really be suitable for a class with a good pre-existing background knowledge who are willi

  1   2   >