Re: [R] PERMANOVA+ and adonis in vegan package

2011-07-11 Thread Gavin Simpson
On Sat, 2011-07-09 at 09:35 -0700, VG wrote: > Hi, > > I was wondering if someone can tell me what is the difference between > "strata" argument (function "adonis" in "vegan" package) and > using random effects in PERMANOVA+ add-on package to PRIMER6 when doing > permutational MANOVA-s? Is the way

Re: [R] grey colored lines and overwriting labels i qqplot2

2011-07-11 Thread Dennis Murphy
Hi: I didn't save the original question, but I seem to recall it had something to do with overlapping labels. I don't know if this is exactly what you had in mind, but here's one approach. I named your data frame df below. library(ggplot2) ggplot(df, aes(x = year, y = total)) + geom_point()

Re: [R] Plot command overwrites existing plot in multiple figure plot

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 9:24 PM, marcel wrote: Hi all, I have a figure with 5 separate graphs in a stacked layout. While most of my plots drop into their appointed spots nicely, my last plot, using lattice and the plot(object) command insists on wiping out my current plot window altogether, a

Re: [R] grey colored lines and overwriting labels i qqplot2

2011-07-11 Thread Sigrid
Thank you, Dennis. This is my regenerated dput codes. They should be correct as I closed off R and re-ran them based on the dput output. structure(list(year = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1

[R] Plot command overwrites existing plot in multiple figure plot

2011-07-11 Thread marcel
Hi all, I have a figure with 5 separate graphs in a stacked layout. While most of my plots drop into their appointed spots nicely, my last plot, using lattice and the plot(object) command insists on wiping out my current plot window altogether, and just plotting the last figure by itself. The relev

[R] Spectral Coherence

2011-07-11 Thread Joseph Park
Greetings, I would like to estimate a spectral coherence between two timeseries. The stats : spectrum() returns a coh matrix which estimates coherence (squared). A basic test which from which i expect near-zero coherence: x = rnorm(500) y = rnorm(500) xts = ts(x, frequency

[R] Connecting to Empress DB using RODBC

2011-07-11 Thread Steve Parker
Hi there, I am using the RODBC library to connect to an Empress database. I have installed the ODBC data source with the server DNs number and port, and named the source "Trawl". It is the odbcDriverConnect that seems to have the problem, and I suspect one of the settings in my Data Source is wro

Re: [R] user input.

2011-07-11 Thread Bert Gunter
Please! help.search("prompt") ?readline -- Bert On Mon, Jul 11, 2011 at 3:33 PM, mousy0815 wrote: > try something like: > > > cat("\n","Enter your number","\n") # prompt > y<-scan(n=1) #scans the line before > > ? perhaps? > > > -- > View this message in context: > http://r.789695.n4.nabble.co

Re: [R] How to generate same type of graphs using the previously written commands for a few hundred similar data sets?

2011-07-11 Thread Ben Bolker
Susie hotmail.com> writes: > > I have a few hundred of data sets which are within one data file, I need to > first of all take the subsets of each data set, and I've written commands to > generate a graph and csv file. Then I want to generate the same type of > graphs and csv files for the rest

Re: [R] user input.

2011-07-11 Thread mousy0815
try something like: cat("\n","Enter your number","\n") # prompt y<-scan(n=1) #scans the line before ? perhaps? -- View this message in context: http://r.789695.n4.nabble.com/user-input-tp3660993p3661031.html Sent from the R help mailing list archive at Nabble.com. ___

[R] How to generate same type of graphs using the previously written commands for a few hundred similar data sets?

2011-07-11 Thread Susie
I have a few hundred of data sets which are within one data file, I need to first of all take the subsets of each data set, and I've written commands to generate a graph and csv file. Then I want to generate the same type of graphs and csv files for the rest of the data sets. I wonder if there's a

[R] invalid subscript type 'list'

2011-07-11 Thread Alessia Uboni
Hello. I'm using the RUF package for R and my input data come from a .csv file. I get this error: invalid subscript type 'list'. Here is the script I'm using: input<-read.csv("C://summer03_regr.csv",header=T) subset<-read.csv("C://summer03_subset.csv",header=T) ruf.fit(UD~veg+openness+el

[R] Matrix operation with apply family functions

2011-07-11 Thread Dimitris.Kapetanakis
Dear all, I am trying to use the apply family functions to improve the efficiency of my code, though it is a bit hard for me to find sometimes the solutions with these functions. The problem that I want to solve is: I have a matrix of replicated random generated data, e.g. if I have two control

Re: [R] Intransitive DAG

2011-07-11 Thread Thomas S. Dye
(Ted Harding) writes: > On 11-Jul-11 19:28:12, Thomas S. Dye wrote: >> Aloha all, >> >> I have an adjacency matrix for an acyclic digraph that >> contains transitive relations, e.g. (u,v), (v,w), (u,w). >> I want a DAG with only intransitive relations. Can someone >> point me to an R function th

Re: [R] Intransitive DAG

2011-07-11 Thread Thomas S. Dye
Peter Langfelder writes: > On Mon, Jul 11, 2011 at 12:28 PM, Thomas S. Dye wrote: >> Aloha all, >> >> I have an adjacency matrix for an acyclic digraph that contains >> transitive relations, e.g. (u,v), (v,w), (u,w).  I want a DAG with only >> intransitive relations.  Can someone point me to an

Re: [R] Intransitive DAG

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 7:25 PM, Thomas S. Dye wrote: David Winsemius writes: On Jul 11, 2011, at 3:28 PM, Thomas S. Dye wrote: Aloha all, I have an adjacency matrix for an acyclic digraph that contains transitive relations, e.g. (u,v), (v,w), (u,w). I want a DAG with only intransitive relat

Re: [R] Intransitive DAG

2011-07-11 Thread Thomas S. Dye
David Winsemius writes: > On Jul 11, 2011, at 3:28 PM, Thomas S. Dye wrote: > >> Aloha all, >> >> I have an adjacency matrix for an acyclic digraph that contains >> transitive relations, e.g. (u,v), (v,w), (u,w). I want a DAG with >> only >> intransitive relations. Can someone point me to an R

Re: [R] Intransitive DAG

2011-07-11 Thread Peter Langfelder
On Mon, Jul 11, 2011 at 12:28 PM, Thomas S. Dye wrote: > Aloha all, > > I have an adjacency matrix for an acyclic digraph that contains > transitive relations, e.g. (u,v), (v,w), (u,w).  I want a DAG with only > intransitive relations.  Can someone point me to an R function that will > take my adj

Re: [R] user input.

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 6:03 PM, Bansal, Vikas wrote: Dear all, I have a dataframe and I want to introduce a new column in it.but the value i want is from user.Like there should be a message to user "enter your number" and the number user will type should come in a new column in data frame f

Re: [R] Intransitive DAG

2011-07-11 Thread Ted Harding
On 11-Jul-11 19:28:12, Thomas S. Dye wrote: > Aloha all, > > I have an adjacency matrix for an acyclic digraph that > contains transitive relations, e.g. (u,v), (v,w), (u,w). > I want a DAG with only intransitive relations. Can someone > point me to an R function that will take my adjacency > matr

Re: [R] plot means ?

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 5:16 PM, Sam Steingold wrote: * David Winsemius [2011-07-11 15:50:04 -0400]: On Jul 11, 2011, at 3:36 PM, Sam Steingold wrote: * David Winsemius [2011-07-11 15:32:26 -0400]: On Jul 11, 2011, at 3:18 PM, Sam Steingold wrote: I need this plot: given: x,y - numerical

[R] user input.

2011-07-11 Thread Bansal, Vikas
Dear all, I have a dataframe and I want to introduce a new column in it.but the value i want is from user.Like there should be a message to user "enter your number" and the number user will type should come in a new column in data frame for all rows.I tries scan,menu and read.line but i did not

Re: [R] Intransitive DAG

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 3:28 PM, Thomas S. Dye wrote: Aloha all, I have an adjacency matrix for an acyclic digraph that contains transitive relations, e.g. (u,v), (v,w), (u,w). I want a DAG with only intransitive relations. Can someone point me to an R function that will take my adjacency m

Re: [R] Extract only the values from a row

2011-07-11 Thread Jeff Newmiller
A) Please remove "->" from your vocabulary. Also, always put spaces on either side of an assignment so the parser doesn't get confused. B) This is a pretty basic question. ("a"==my.data$letters.1.10.) is a vector of logical values. ( ("a"==my.data$letters.1.10.) & ("k"==my.data$letters.1.20.) ) i

Re: [R] GLS - Plotting Graphs with 95% conf interval

2011-07-11 Thread Frank Harrell
The Gls function in the rms package is a frontend to gls that allows you to use all the graphics and other methods available in rms. Frank SamiC wrote: > > Hi, I am trying to plot the original data with the line of the model using > the predict function. I want to add SE to the graph, but not su

Re: [R] Robust vce for heckman estimators

2011-07-11 Thread Achim Zeileis
On Mon, 11 Jul 2011, Mateus Rabello wrote: When using function heckit() from package ???sampleSelection???, is there anyway to make t-tests for the coefficients using robust covariance matrix estimator? By ???robust??? I mean something like if a had an object ???lm??? called ???reg??? and then

Re: [R] fitdistr() Error

2011-07-11 Thread Peter Maclean
I am trying to estimate a gamma function using real data and I am getting the following error messages. When I set a lower limit; the error message is "L-BFGS-B needs finite values of fn"   For other method the error message is: Error in optim(x = c(0.1052867, 0.3472275, 2.057625, 0.32967

Re: [R] plot means ?

2011-07-11 Thread Sam Steingold
> * David Winsemius [2011-07-11 15:50:04 -0400]: > > On Jul 11, 2011, at 3:36 PM, Sam Steingold wrote: > >>> * David Winsemius [2011-07-11 15:32:26 >>> -0400]: >>> >>> On Jul 11, 2011, at 3:18 PM, Sam Steingold wrote: >>> I need this plot: given: x,y - numerical vectors of length N

[R] Robust vce for heckman estimators

2011-07-11 Thread Mateus Rabello
When using function heckit() from package ‘sampleSelection’, is there anyway to make t-tests for the coefficients using robust covariance matrix estimator? By “robust” I mean something like if a had an object ‘lm’ called “reg” and then used: > coeftest(reg, vcov = vcovHC(reg)).

[R] Named numeric vectors with the same value but different names return different results when used as thresholds for calculating true positives

2011-07-11 Thread Lyndon Estes
Dear List, I have encountered an odd problem that I cannot understand. It stems from the calculation of true and false positives based on two input vectors x and y based on different thresholds of x, extracted using the quantile function. I am in certain cases getting different values of true posi

Re: [R] lm: mark sample used in estimation

2011-07-11 Thread Ted Harding
On 11-Jul-11 07:55:44, Anirban Mukherjee wrote: > Hi all, > > I wanted to mark the estimation sample: mark what rows (observations) > are deleted by lm due to missingness. For eg, from the original > example in help, I have changed one of the values in trt to be NA > (missing). > ># code below >#

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Bert Gunter
Josh: (assuming you have interpreted correctly) You are *absolutely* right -- I did not read carefully enough. Does index <- matrix(rep(grep("Document+.", yourfile, value = FALSE),e=3) + c(0,2,4),nc=3,byr=TRUE) do it for you? Sheepishly, Bert On Mon, Jul 11, 2011 at 12:33 PM, Joshua Wil

[R] Intransitive DAG

2011-07-11 Thread Thomas S. Dye
Aloha all, I have an adjacency matrix for an acyclic digraph that contains transitive relations, e.g. (u,v), (v,w), (u,w). I want a DAG with only intransitive relations. Can someone point me to an R function that will take my adjacency matrix and give me back one with only intransitive relations

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread Greg Snow
Note the warning on the help page for recordPlot. If your colleague is using a different version of R than you there could be problems. Another approach (or the start to one that you could build on) is the plot2script function in the TeachingDemos package (which uses recordPlot internally).

Re: [R] Extract only the values from a row

2011-07-11 Thread Sverre Stausland
Great - thanks for the explanation and for the solution using stringsAsFactors=FALSE in the data.frame function Sverre On Mon, Jul 11, 2011 at 3:57 PM, Sarah Goslee wrote: > Hi Sverre, > > On Mon, Jul 11, 2011 at 12:48 PM, Sverre Stausland > wrote: >> Dear helpers, >> >> how can I extract only

Re: [R] Ifelse statement

2011-07-11 Thread Sarah Goslee
Hi, You've got several things going on here. On Mon, Jul 11, 2011 at 3:39 PM, fre wrote: > Hello everyone, > > I have a (small) issue. I already googled a lot, so I decided to use ifelse > instead of if (){} else{} > > All the elements seem to work seperately, but combined in the ifelse > statem

Re: [R] Extract only the values from a row

2011-07-11 Thread Sarah Goslee
Hi Sverre, On Mon, Jul 11, 2011 at 12:48 PM, Sverre Stausland wrote: > Dear helpers, > > how can I extract only the values from a row in a data frame? Using > [X,] doesn't do the trick: > >> data.frame(letters[1:10],letters[11:20])->my.data >> my.data[1,] >  letters.1.10. letters.11.20. > 1      

Re: [R] Summation resulting in a list?

2011-07-11 Thread mousy0815
Use the tapply() function as in tapply(b,m,sum) HTH, Daniel Don't "b" and "m" have to be the same length then? What if they're not? And would I just put the tapply() instead of everything else in my summing function? (Sorry! I'm kind of newbie at this -_-;) -- View this message in context: h

[R] Ifelse statement

2011-07-11 Thread fre
Hello everyone, I have a (small) issue. I already googled a lot, so I decided to use ifelse instead of if (){} else{} All the elements seem to work seperately, but combined in the ifelse statement, it doesn't seem to work. #The price function is a function which is normally distributed with only

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 3:33 PM, Joshua Wiley wrote: On Jul 11, 2011, at 12:00, Bert Gunter wrote: Simon: Basic basic stuff (not grep -- the stuff thereafter) . Please read the docs, especially the tutorial, An Intro to R. ... and Josh's solution can be shortened to (as he knows): index <

Re: [R] scientific (statistical) foundation for Y-RANDOMIZATION in regression analysis

2011-07-11 Thread tauQSAR
Hello, I'm also working on a QSAR validation, and would like to confirm that my multiple least squares regression based on only 4 x-variables out of a pool of 300 x-variables is significant. I want to apply the y-randomization or y-scrambling permutation protocol using R, but I have not been able t

Re: [R] plot means ?

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 3:36 PM, Sam Steingold wrote: * David Winsemius [2011-07-11 15:32:26 -0400]: On Jul 11, 2011, at 3:18 PM, Sam Steingold wrote: I need this plot: given: x,y - numerical vectors of length N plot xi vs mean(yj such that |xj - xi|alternatively, discretize X as if for histo

Re: [R] plot means ?

2011-07-11 Thread Sam Steingold
> * David Winsemius [2011-07-11 15:32:26 -0400]: > > On Jul 11, 2011, at 3:18 PM, Sam Steingold wrote: > >> I need this plot: >> given: x,y - numerical vectors of length N >> plot xi vs mean(yj such that |xj - xi|> (running mean?) >> alternatively, discretize X as if for histogram plotting and plo

Re: [R] plot means ?

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 3:18 PM, Sam Steingold wrote: Hi, I need this plot: given: x,y - numerical vectors of length N plot xi vs mean(yj such that |xj - xi|alternatively, discretize X as if for histogram plotting and plot mean y over the center of the histogram group. It sounds as though you

[R] Summation resulting in a list?

2011-07-11 Thread mousy0815
Probability <- function(N, f, m, b, x, t) { #N is the number of lymph nodes #f is the fraction of Dendritic cells (in the correct node) that have the antigen #m is the number of time steps #b is the starting position (somewhere in the node or somewhere in the gap b

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Joshua Wiley
On Jul 11, 2011, at 12:00, Bert Gunter wrote: > Simon: > > Basic basic stuff (not grep -- the stuff thereafter) . Please read the > docs, especially the tutorial, An Intro to R. > > ... and Josh's solution can be shortened to (as he knows): > > index <- grep("Document+.", yourfile, value = FA

Re: [R] quantile regression: out of memory error

2011-07-11 Thread Brian S Cade
Using tau = -1 is causing rq() to try and estimate all possible quantiles and store the results. With 11253 observations this would be a formidable feat. Try estimating the model with say tau = 1:99/100 to give a more tractable number of estimates. Brian Brian S. Cade, PhD U. S. Geological

Re: [R] Summation resulting in a list?

2011-07-11 Thread Daniel Malter
Use the tapply() function as in tapply(b,m,sum) HTH, Daniel mousy0815 wrote: > > ... > > I wanted to get the sum of the probability at all the values of "b" (ie. > Probability(10, 0.1, 1, 1, 4, 5) + Probability(10, 0.1, 1, 2, 4, 5)... + > Probability(10, 0.1, 1, 9, 4, 5). For that I can just

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread Jeroen Ooms
> > You can also save a data (or function) object to an .Rdata file with > save(objname, file="filename.Rdata") and your colleagues could then > load("filename.Rdata") in R. > Thanks for the responses. I found an old post by Gabor Grothendieck that shows what I want. Basically the trick is to sav

Re: [R] running mean in blocks

2011-07-11 Thread Mateo Sanchez
Hi all, Thanks for the suggestions. What I ended up using was x=aggregate(dat,by=list(dat$DOY,dat$Hour),mean) where is my matrix and DOY is day of year. This gives me hourly means for each day (apologies for not being more specific with my question). This works for now but I'll probably want to

Re: [R] quantile regression: out of memory error

2011-07-11 Thread Roger Koenker
Paul, Yours is NOT a large problem, but it becomes a large problem when you ask for ALL the distinct QR solutions by specifying tau = -1. You probably don't want to see all these solutions, I suspect that only tau = 1:19/20 or so would suffice. Try this, and see how it goes. Roger url:ww

Re: [R] problem finding p-value for entropy in reldist package

2011-07-11 Thread VictorDelgado
Hi Amy Wesolowski, I don't have a straightfoward answer to you question. I have been working with reldist too, and the 'rpy' and 'rpluy' functions described by "Applying Relative Distribution Methods in R" are also not working here in my 2.9.1 R-version. I think its because they are reldist intern

[R] Extract only the values from a row

2011-07-11 Thread Sverre Stausland
Dear helpers, how can I extract only the values from a row in a data frame? Using [X,] doesn't do the trick: > data.frame(letters[1:10],letters[11:20])->my.data > my.data[1,] letters.1.10. letters.11.20. 1 a k I would like to be able to extract only the values "a" and

[R] plot means ?

2011-07-11 Thread Sam Steingold
Hi, I need this plot: given: x,y - numerical vectors of length N plot xi vs mean(yj such that |xj - xi|http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031 http://thereligionofpeace.com http://camera.org http://jihadwatch.org http://palestinefacts.org http://pmw.org.il http://ffii

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Bert Gunter
Simon: Basic basic stuff (not grep -- the stuff thereafter) . Please read the docs, especially the tutorial, An Intro to R. ... and Josh's solution can be shortened to (as he knows): index <- grep("Document+.", yourfile, value = FALSE) + c(2,4) -- Bert On Mon, Jul 11, 2011 at 11:19 AM, Joshua

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Joshua Wiley
Try this (untested as I'm on my iPhone now): index <- grep("Document+.", yourfile, value = FALSE) index <- c(index + 2, index + 4) You just need to make sure you avoid recycling, e.g., 1:10 + c(2, 4) # not what you want If you want a sufficient number of lines that manually writing index + beco

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 12:08 PM, jeroen00ms wrote: I am looking for a way to save a plot (graphics contents) to a file after the plot has been calculated but before it has been rendered. More specifically, assume that I made a plot that took a very long time to produce, I would like to save t

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Simon Kiss
Josh, that's amazing. Is there any way to have it grab two different lines after the grep, say the second and the fourth line? There's some other information in the text file I'd like to grab. I could do two separate commands, but I'd like to know if this could be done in one command... Simon K

Re: [R] quantile regression: out of memory error

2011-07-11 Thread Prew, Paul
Thank you, Roger, that was my problem. Specifying tau = 1:19/20 worked fine. Regards, Paul Paul Prew | Statistician 651-795-5942   |   fax 651-204-7504 Ecolab Research Center | Mail Stop ESC-F4412-A 655 Lone Oak Drive | Eagan, MN 55121-1560 -Original Message- From: Roger Koenk

Re: [R] problem with 'predict'

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 11:51 AM, Meesters, Christian wrote: Hi, I would like to tabulate the likelihood for an affection. For this, I retrieve indices of affected people and controls for my data set and proceed as follows: flags <- c(rep(1, length(patient_indices)), rep(0, length(control_

Re: [R] Help regarding tersvirta.test

2011-07-11 Thread Aravind R.N
Sorry, I had the wrong version of R. Thanks for the help. Regards, Aravind On Mon, Jul 11, 2011 at 8:14 AM, Dennis Murphy wrote: > Hi: > > Works for me: > >> library(tseries) > Loading required package: quadprog > Loading required package: zoo > >    ‘tseries’ version: 0.10-25 > >    ‘tseries’

[R] quantile regression: out of memory error

2011-07-11 Thread Prew, Paul
Hello, I’m wondering if anyone can offer advice on the out-of-memory error I’m getting. I’m using R2.12.2 on Windows XP, Platform: i386-pc-mingw32/i386 (32-bit). I am using the quantreg package, trying to perform a quantile regression on a dataframe that has 11,254 rows and 5 columns. > obje

Re: [R] Save generic plot to file (before rendering to device)

2011-07-11 Thread John Sorkin
After the plot is created, you can save the graph as a pdf document (file menu, save as). You can then send the pdf file to your colleagues. John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Me

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Joshua Wiley
If you know you can find the start of the document (say that line always starts with Document...), then: grep("Document+.", yourfile, value = FALSE) + 4 should give you 4 lines after each line where Document occurred. No loop needed :) On Mon, Jul 11, 2011 at 10:25 AM, Simon Kiss wrote: > Hi J

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Simon Kiss
Hi Josh, Sorry for the insufficient introduction. This might work, but I'm not sure. The file that I have includes up to 100 documents (Document 1, Document 2, Document 3Document 100) with the newspaper name following 4 lines below each Document number. I'm using readlines to get the text fil

Re: [R] problem with 'predict'

2011-07-11 Thread Dennis Murphy
Hi: The data frame you submit as newdata = to predict() has to have the same variables as the right hand side of the model formula. For example, if the model has covariates x1, x2, x3, then the data frame you create as the newdata has to consist of columns named x1, x2, x3. Another problem is that

Re: [R] best way to aggregate / rearrange data.frame with different data types

2011-07-11 Thread Dennis Murphy
Hi: Here's another approach using the plyr and reshape packages. (There are multiple ways to do this, BTW.) ## (1) library(plyr) > ddply(dat, .(Subject, gender, comment), summarise, mean_y = mean(y)) Subject gender comment mean_y 1 1 w comment A 3.881864 2 2 m comment

Re: [R] Referencing a vector of data labels in ggplot function

2011-07-11 Thread Ben Hunter
That did it. I just wanted the line names to be placed at the second to last date tick mark. Later I'll write something that adjusts the labels if there isn't room or if there is overlap. Thanks! On Sat, Jul 9, 2011 at 7:38 AM, Hadley Wickham wrote: > Maybe something like this? > > withNames <-

[R] Zero Columns/Rows in Hessian Matrix

2011-07-11 Thread eespinola
Hello R users, I am trying to get the Std. errors of some estimators using the optim function. But when computing them using sqrt(diag(solve(ans$hessian))) I get an error that says... Lapack routine dgesv: system is exactly singular. Or sometimes I also get that system is computationally singul

[R] Save generic plot to file (before rendering to device)

2011-07-11 Thread jeroen00ms
I am looking for a way to save a plot (graphics contents) to a file after the plot has been calculated but before it has been rendered. More specifically, assume that I made a plot that took a very long time to produce, I would like to save this plot to a generic file that I can later, on a differe

Re: [R] grep lines before or after pattern matched?

2011-07-11 Thread Joshua Wiley
Dear Simon, Maybe I don't understand properlyif you are doing this in R, can't you just pick the line you want? Josh ## print your data to clipboard cat("Document 1 of 100 \n \n \n Newspaper Name \n \n Day Date", file = "clipboard") ## read data in, and only select the 4th line to pass to gr

[R] problem with 'predict'

2011-07-11 Thread Meesters, Christian
Hi, I would like to tabulate the likelihood for an affection. For this, I retrieve indices of affected people and controls for my data set and proceed as follows: flags <- c(rep(1, length(patient_indices)), rep(0, length(control_indices))) # dataset is a data.frame and param the parameter to be

[R] grep lines before or after pattern matched?

2011-07-11 Thread Simon Kiss
Dear colleagues, I have a series of newspaper articles in a text file, downloaded from a text file. They look as follows: Document 1 of 100 \n \n \n Newspaper Name \n \n Day Date I have a series of grep scripts that can extract the date and convert it to a date object, but I can't figure out h

Re: [R] best way to aggregate / rearrange data.frame with different data types

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 11:55 AM, Martin Batholdy wrote: Hi, I have a data.frame that looks like this: Subject <- c(rep(1,4), rep(2,4), rep(3,4)) y <- rnorm(12, 3, 2) gender <- c(rep("w",4), rep("m",4), rep("w",4)) comment <- c(rep("comment A",4), rep("comment B",4), rep("comment C", 4)) dat

Re: [R] EXTERNAL: Re: subset with aggregate key

2011-07-11 Thread Jesse Brown
Matthew Dowle wrote: Hi, Try package 'data.table'. It has a concept of keys which allows you to do exactly that. http://datatable.r-forge.r-project.org/ Matthew Hi Matthew, Unfortunately, the load of that library fails (it builds successfully). I'm currently looking into why. Error outpu

Re: [R] How unzip all files?

2011-07-11 Thread SamiC
Hi, Im not really sure what you mean. but if you are just wanting to unzip files, wouldnt it be easier to unzip them using internet explorer (ie right click on the file and select extract all from one the heading in the list i think). Then read them into R? Im not sure if this is what you mean

Re: [R] NetCDF, open *.nc

2011-07-11 Thread Barry Rowlingson
On Mon, Jul 11, 2011 at 2:57 PM, kokavolchkov wrote: > mode="wb": AFAIK You have taken the professor somewhat too literally. "AFAIK" means "As Far As I Know". The 'mode="wb"' goes *inside* the download.file function call. It modifies the default behaviour of download.file. STL (SomeThing Lik

[R] best way to aggregate / rearrange data.frame with different data types

2011-07-11 Thread Martin Batholdy
Hi, I have a data.frame that looks like this: Subject <- c(rep(1,4), rep(2,4), rep(3,4)) y <- rnorm(12, 3, 2) gender <- c(rep("w",4), rep("m",4), rep("w",4)) comment <- c(rep("comment A",4), rep("comment B",4), rep("comment C",4)) data <- data.frame(Subject,y,gender,comment) data Subject

Re: [R] How unzip all files?

2011-07-11 Thread Uwe Ligges
On 11.07.2011 10:49, AnaA wrote: Hi I'm starting to use R in windows. I need unzip some files. Each of them are in different folders and subfolders. Names of folders have the same beginning of the name. [example:( ~ / M_ /P_ (...)/ (...)R(...)/*.zip)] I do not know the expression (character) ne

Re: [R] Stacked bar plot of frequency vs time

2011-07-11 Thread Marc Schwartz
On Jul 11, 2011, at 9:36 AM, marcel wrote: > Hi All, > New to R, but committed. I looked in a number of places but can't figure out > my current problem. I have date of the type: > > Time Type1 Type2 Type3 > 1.50 .25 .25 > 4.55 .25 .20 > 5.65 .2

Re: [R] Stacked bar plot of frequency vs time

2011-07-11 Thread Richard M. Heiberger
Marcel, tC <- textConnection(" Time Type1 Type2 Type3 1.50 .25 .25 4.55 .25 .20 5.65 .20 .15 ") tmp <- read.table(header=TRUE, tC) close.connection(tC) require(lattice) tmpdf <- data.frame(Time=rep(tmp$Time, 3), stack(tmp[,2:4])) tmpdf barc

Re: [R] NetCDF, open *.nc

2011-07-11 Thread Roy Mendelssohn
did you check that the file was actually downloaded correctly and is a valid netcdf file? My guess. particularly on Windows, is that for the download.file statement you need to add that mode="wb" to the command. -Roy M. On Jul 11, 2011, at 6:57 AM, kokavolchkov wrote: > Well, if I use this sc

Re: [R] Finding Confidence Intervals

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 10:51 AM, Abraham Mathew wrote: This is a very basic question, so please bear with me. (8.1, 11.8) # headline 1 (9.2, 12.7) # headline 2 # these confidence intervals for the two headlines overlap. # therefore, the variation (headline 2) isn't more effective # than the co

[R] GLS - Plotting Graphs with 95% conf interval

2011-07-11 Thread SamiC
Hi, I am trying to plot the original data with the line of the model using the predict function. I want to add SE to the graph, but not sure how to get them out as the predict function for gls does not appear to allow for SE=TRUE argument. Here is my code so far: f1<-formula(MaxNASC40_50~hu3+f

[R] Finding Confidence Intervals

2011-07-11 Thread Abraham Mathew
This is a very basic question, so please bear with me. I've been learning about AB Testing, which is largely used in internet marketing to examine the effectiveness of certain aspects of ads, websites, etc. Here's a couple links to people who want to know more about AB Testing: http://visualwebsi

[R] Stacked bar plot of frequency vs time

2011-07-11 Thread marcel
Hi All, New to R, but committed. I looked in a number of places but can't figure out my current problem. I have date of the type: Time Type1 Type2 Type3 1.50 .25 .25 4.55 .25 .20 5.65 .20 .15 etc which describe the frequency of types 1, 2 an

Re: [R] NetCDF, open *.nc

2011-07-11 Thread kokavolchkov
Well, if I use this script: library(ncdf) link <- "http://ibis.grdl.noaa.gov/SAT/SeaLevelRise/slr/slr_sla_gbl_free_all_66.nc"; dest <- "C:/temp/slr_sla_gbl_free_all_66.nc" mode="wb": AFAIK download.file(url=link,destfile=dest) nc1 <- open.ncdf(dest) compiler prints: Error in R_nc_open: Inva

[R] problem finding p-value for entropy in reldist package

2011-07-11 Thread Amy Wesolowski
Hi, I am using the reldist package and having problems determining the p-value for the entropy value from the reldist function. I am able to properly determine the entropy value, but cannot figure out what function to use to find the p-value. I have tried using rpy, rpluy (which provides p-value

[R] Getis-Ord Gi* (Hot Spot Analysis)

2011-07-11 Thread dab98
Hi, I'm trying to use the "spdep" package function globalG.test() to compute Z-scores using Get-Ord Gi* for a data frame of temperature values for the Northeast (after creating the listw object required), however I keep receiving an error explaining that I can't input negative values. I'm basical

Re: [R] deming regresion to make 2 variables comparable

2011-07-11 Thread Juliet Hannah
See if the following thread http://www.mail-archive.com/r-help@r-project.org/msg85070.html and the paper cited in it are helpful. Terry Therneau provides code for a Deming regression. On Thu, Jul 7, 2011 at 12:58 PM, devon woodcomb wrote: > Hi, > > I have a dataset which has var1 from 1 sours

Re: [R] running mean in blocks

2011-07-11 Thread David Winsemius
On Jul 11, 2011, at 9:23 AM, Joshua Wiley wrote: Hi, Take a look at package "zoo", perhaps something like: require(zoo) x <- rnorm(1) # hypothetical data m <- rollapply(zoo(x), width = 100, FUN = mean, by = 100) Definitely a better answer, but if all your rolling averages were of the f

Re: [R] running mean in blocks

2011-07-11 Thread peter dalgaard
On Jul 11, 2011, at 11:23 , M. B wrote: > Hello, > I am running R on Linux and have a column of data 1 points long. I would > like to take a moving average of say 100 points at a time, so I end up with > one column of 100 points. What is the simplest way of doing this? I would > like to be a

Re: [R] Sweave in R 2.13.1 doesn't support cp1250 encoding

2011-07-11 Thread Prof Brian Ripley
On Mon, 11 Jul 2011, Tomaz wrote: I upgraded R on windows xp from 2.12.2 to 2.13.1 and now I can not process Rnw files with windows cp1250 encoding. Sweave complains: Which is of course not an ISO Standard encoding. One way out is to use the ISO encoding latin2, which is supported. fil

Re: [R] NetCDF, open *.nc

2011-07-11 Thread Prof Brian Ripley
On Mon, 11 Jul 2011, kokavolchkov wrote: *Good day!* I'm using Vista(x64) and R 2.13.0(x64) (with ncdf and RnetCDF packs) *I have a problem:* I'm trying to open **.nc* file and I use this script (http://r.789695.n4.nabble.com/Problem-downloading-and-opening-netcdf-file-td3046897.html#a3046965)

Re: [R] running mean in blocks

2011-07-11 Thread Joshua Wiley
Hi, Take a look at package "zoo", perhaps something like: require(zoo) x <- rnorm(1) # hypothetical data m <- rollapply(zoo(x), width = 100, FUN = mean, by = 100) Another (bit more of a hack) option would be: ## convert vector to matrix byrows with 100 columns per row ## (where 100 is the n

[R] subset with aggregate key

2011-07-11 Thread Jesse Brown
Hello: I am working on trying to subset a data.frame using a vector of headings as a single 'key'. I have things to the point where I can get the unique sets of keys but I'm stuck on how to use these in a subset call. So far, I've got something similar to: cols <- c('V1','V2') keys <-

[R] NetCDF, open *.nc

2011-07-11 Thread kokavolchkov
*Good day!* I'm using Vista(x64) and R 2.13.0(x64) (with ncdf and RnetCDF packs) *I have a problem:* I'm trying to open **.nc* file and I use this script (http://r.789695.n4.nabble.com/Problem-downloading-and-opening-netcdf-file-td3046897.html#a3046965) library(ncdf) link <- "http://ibis.grdl.

[R] Sweave in R 2.13.1 doesn't support cp1250 encoding

2011-07-11 Thread Tomaz
I upgraded R on windows xp from 2.12.2 to 2.13.1 and now I can not process Rnw files with windows cp1250 encoding. Sweave complains: file.Rnw declares an encoding that Sweave does not know about What can I do beside downgrade R? When will Sweave support more encodings? Has anybody found a so

[R] running mean in blocks

2011-07-11 Thread M. B
Hello, I am running R on Linux and have a column of data 1 points long. I would like to take a moving average of say 100 points at a time, so I end up with one column of 100 points. What is the simplest way of doing this? I would like to be able to adjust the width of the averaging blocks. Th

Re: [R] Dataset in parts - how to join together?

2011-07-11 Thread majesty
Thanks a lot for both suggestions, I used region <- rbind(region1, region2..., region12), they were all already data frames. It worked well. -- View this message in context: http://r.789695.n4.nabble.com/Dataset-in-parts-how-to-join-together-tp3658088p3659138.html Sent from the R help mailing li

  1   2   >