[R] A question on Unit Root Test using "urca" toolbox

2012-02-02 Thread jpm miao
Hello, I have a question on unit root test with urca toolbox. First, to run a unit root test with lags selected by BIC, I type: > CPILD4UR<-ur.df(x1$CPILD4[5:nr1], type ="drift", lags=12, selectlags ="BIC") > summary(CPILD4UR) The results indicate that the optimal lags selected by BIC

Re: [R] Contour plot with messy field data.

2012-02-02 Thread chuck.01
This is ugly, but I think it works.: z.2 <- data.frame(data.interp[[3]]) diff_y <- unique(round(diff(data.interp[[2]]), 4)) diff_x <- unique(round(diff(data.interp[[1]]), 4)) total_area <- length(which(z.2!="NA"))*diff_y*diff_x # percent of total area less than -.5 (as I wanted) Per_neg_0.5 <- (

Re: [R] Contour plot with messy field data.

2012-02-02 Thread chuck.01
Ok, I've since found this: # called previously posted dataset "dat" attach(dat) library(akima) data.interp <- interp(x,y,z) contour(data.interp) any idea how to calculate area within specified contour lines? Thanks chuck.01 wrote > > Hello, > I have some data that will be in the form:

[R] Logistic population growth and deSolve

2012-02-02 Thread Gorillagorilla
Hello, I am new to R and I am having problems trying to model logistic population growth with the deSolve package. I would like to run the model for four populations with the same initial population and carrying capacity but with different growth rates and put the results into a data frame. When I

Re: [R] Need to Write a Code that can find the molecular weight of various compounds

2012-02-02 Thread H. Paul Benton
Matthew, My Fault I should have sent you to the current release cycle page. The link was for the old 2.6 Bioconductor release, sorry about that. :( Personally the easies way to install any bioconductor package is to open R copy and paste the following code: source("http://bioconductor.org/bioc

[R] Contour plot with messy field data.

2012-02-02 Thread chuck.01
Hello, I have some data that will be in the form: structure(list(station = structure(c(20L, 2L, 4L, 19L, 3L, 11L, 1L, 5L, 10L, 12L, 17L, 18L, 6L, 9L, 13L, 16L, 7L, 8L, 15L, 14L ), .Label = c("1", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "2", "3", "4", "5", "6", "7", "8", "9",

Re: [R] about error while using anova function

2012-02-02 Thread Dorian
I don't know what your data look like, but I recently ran into this error message while using Anova() in the {car} package, and I resolved in by replacing the categorical predictors in my model with orthogonal contrasts. I did something along these lines: fac <- factor(c("M","F","M","M","F"))

[R] Tukey Type III SS vs Type I SS

2012-02-02 Thread Vera Marjorie Velasco
Hi. I was looking for help on how to use Tukey multiple comparison on Type III SS because I read on Quick R that it is using Type I SS by default. I am wondering if the use of glht helps. Thanks for help. Vera __ R-help@r-project.org mailing list

[R] Nested? Two-way ANOVA with repeated measures

2012-02-02 Thread Vladimir Mikryukov
Dear R-users, I have 3 plant populations (fixed). Within each population there is the same number of “families” (random) – the seed progeny of the same plant. These families were exposed to 2 treatments (fixed) and their response was measured (mean values for 25 seedlings per family per treat

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-02 Thread Gabor Grothendieck
On Thu, Feb 2, 2012 at 8:07 PM, HC wrote: > Hi Gabor, > > Thank you very much for your guidance and help. > > I could run the following code successfully on a 500 mb test data file. A > snapshot of the data file is attached herewith. > > code start*** > library(sqldf) > library

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-02 Thread HC
Hi Gabor, Thank you very much for your guidance and help. I could run the following code successfully on a 500 mb test data file. A snapshot of the data file is attached herewith. code start*** library(sqldf) library(RSQLite) iFile<-"Test100.txt" con <- dbConnect(SQLite(),db

Re: [R] an unusual use for R

2012-02-02 Thread Carl Witthoft
Well, I have to say, how nice to find a valid use for "string theory" :-) . Now that we all know you are in fact the "mistress of skulls," guess we better tread lightly! Carl From: Sarah Goslee Date: Thu, 02 Feb 2012 17:54:04 -0500 I thought some of you might be amused by this. In my n

[R] auto.key and simpleTheme

2012-02-02 Thread Marcin Kozak
Dear all, parallel(~iris[1:4], groups = Species, iris, par.settings = simpleTheme(lwd = c(1,3,1), lty = c(1,1,2), col.line = 1), auto.key = T) Despite the use of par.settings and simpleTheme, the lines in the key and graph are not the same. Any suggestions why? Regards, Marcin [[alterna

Re: [R] an unusual use for R

2012-02-02 Thread Michael Bedward
Brilliant Sarah ! I love seeing such unexpected and creative applications. I'm not a weaver but am a knitter (and a knotter actually) and have mused about using R to help design elements of textured knitting patterns e.g. as seen in single-colour, traditional fisherman's jumpers from England and

[R] bigkmeans not parallel

2012-02-02 Thread huazi0204
I'm using bigkmeans in 'biganalytics' to cluster my 60,000 by 600,000 matrix. I'm using a 8 core Linux VM. I have register parallel backend with >registerDoMC() And I checked how many cores registered with >getDoParWorkers() It returns 8, which is the number of cores I have on my machine. And I

[R] How to run GLM with burr distribution?

2012-02-02 Thread Enriquez-Savery, Sherlene
I want to run the glm () function for my data but instead of using the family distributions in R, I need the 4P Burr distribution. Can some please explain how can I go about doing that. Or please provide me with an example. I'm new to R. Eg. Model1 <- glm(Postwt ~ Prewt + Treat + offset(Prewt)

[R] an unusual use for R

2012-02-02 Thread Sarah Goslee
I thought some of you might be amused by this. In my non-work time, I'm an avid weaver and teacher of weaving. I'm working on a project involving creating many detailed weaving patterns, so I wrote R code to automate it. Details here: http://stringpage.com/blog/?p=822 If the overlap between R us

Re: [R] Calculate the natural log of cdf between 2 intervals

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 01:18:42PM -0800, justin jarvis wrote: > Hello all, > I was wondering if there is an R function to do the following: > > [*] log(pnorm(x)-pnorm(y)), where x>y. > > I don't want all the area under the natural log of the normal pdf less than > x, I only want the area between

Re: [R] gsub syntax help

2012-02-02 Thread Benjamin Caldwell
Oh, perfect. I was running gsub(".sample.tif", "", avec). your change gsub("\\.sample\\.tif$", "", avec) did it. Thanks Sarah *Ben Caldwell* On Thu, Feb 2, 2012 at 1:48 PM, Sarah Goslee wrote: > In the example you gave, all that has to be done is > replace ".sample.tif" at the end of the

Re: [R] gsub syntax help

2012-02-02 Thread Sarah Goslee
In the example you gave, all that has to be done is replace ".sample.tif" at the end of the string with "", which is easy. > avec <- c("SPI1.S1.str1.P3.sample.tif", "SPI1.S1.STR2.P1.sample.tif") > gsub("\\.sample\\.tif$", "", avec) [1] "SPI1.S1.str1.P3" "SPI1.S1.STR2.P1" If your real data are mo

[R] gsub syntax help

2012-02-02 Thread Benjamin Caldwell
I have some elements in a vector with extraneous information (e.g. file name and sample IDs) that I'd like to strip from every element. For example, I would like "SPI1.S1.str1.P3.sample.tif" "SPI1.S1.STR2.P1.sample.tif" to read "SPI1.S1.str1.P3" "SPI1.S1.STR2.P1". Will someone help me with the

Re: [R] R-Project at university.

2012-02-02 Thread Jeff Newmiller
I suggest you read the GNU license included in the source code and on the CRAN website. The essence is that you are free to use it, and to change it, but if you pass your changes on to anyone else, you have to make the source code of those changes available to those whom you give it to. Most use

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of uday > Sent: Thursday, February 02, 2012 8:57 AM > To: r-help@r-project.org > Subject: Re: [R] time conversion from second to Y M D H M S format > > Dear Uwe , > Thanks for reply

Re: [R] how can i calculate the mean of my data which is only bigger than 75?

2012-02-02 Thread Yakamu Yakamu
Hi michael, thanks, but here is more explanations of my questions to have more help, (also pls have a look at the data below):   Three questions to give more concrete help: i) Is your data set stored as a matrix or a data.frame My data is in a data frame ii) What are you trying to get the mean o

Re: [R] how can i calculate the mean of my data which is only bigger than 75?

2012-02-02 Thread Yakamu Yakamu
Hi michael, thanks, but here is more explanations of my questions to have more help, (also pls have a look at the data below):   Three questions to give more concrete help: i) Is your data set stored as a matrix or a data.frame My data is in a data frame ii) What are you trying to get the mean o

[R] Calculate the natural log of cdf between 2 intervals

2012-02-02 Thread justin jarvis
Hello all, I was wondering if there is an R function to do the following: [*] log(pnorm(x)-pnorm(y)), where x>y. I don't want all the area under the natural log of the normal pdf less than x, I only want the area between y and x. I am aware of the ability to specify log.p=TRUE, which gives me th

Re: [R] pgfSweave doesn't lazyload my objects

2012-02-02 Thread Yihui Xie
I can reproduce it but I do not know why this happens. FWIW, I tried the knitr package and it worked well except that you have to write cache=TRUE or FALSE instead of true/false. library(knitr) knit('test_pgf.Rnw') Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Departmen

Re: [R] Post hoc test for lm() or glm() ?

2012-02-02 Thread Mark Na
Thank you Richard and Frank for your very quick and helpful replies. Cheers, Mark On Thu, Feb 2, 2012 at 2:58 PM, Frank Harrell wrote: > The R multcomp package provides one general approach to multiplicity > correction.  For general contrasts in lm and glm, the rms package's ols and > Glm funct

Re: [R] Post hoc test for lm() or glm() ?

2012-02-02 Thread Richard M. Heiberger
The glht function in the multcomp package is what you are looking for. There are additional examples in the ?MMC help file in the HH package. Rich On Thu, Feb 2, 2012 at 3:42 PM, Mark Na wrote: > Hi R-helpers, > > TukeyHSD() works for models fitted with aov(), but could anyone point > me to a f

Re: [R] Post hoc test for lm() or glm() ?

2012-02-02 Thread Frank Harrell
The R multcomp package provides one general approach to multiplicity correction. For general contrasts in lm and glm, the rms package's ols and Glm functions make this even easier to use. Frank Mark Na wrote > > Hi R-helpers, > > TukeyHSD() works for models fitted with aov(), but could anyone p

Re: [R] Problem with GMT+/- time zones

2012-02-02 Thread Andrew Digby
Wow. Thanks very much for pointing that out - I never would have guessed it was deliberate that + and - were reversed! For future reference for anyone else similarly confused by this departure from time zone and mathematic convention, here's the relevant part of en.wikipedia.org/wiki/Tz_databa

[R] Post hoc test for lm() or glm() ?

2012-02-02 Thread Mark Na
Hi R-helpers, TukeyHSD() works for models fitted with aov(), but could anyone point me to a function that performs a similar post hoc test for models fitted with lm() or glm()? Thanks in advance, Mark __ R-help@r-project.org mailing list https://stat.

Re: [R] Splitting up large set of survey data into categories

2012-02-02 Thread ak13
push (sorry ;-)) -- View this message in context: http://r.789695.n4.nabble.com/Splitting-up-large-set-of-survey-data-into-categories-tp4323327p4352611.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list h

Re: [R] Need to Write a Code that can find the molecular weight of various compounds

2012-02-02 Thread matthew.ttd.nguyen
I also tried downloading the JDK version of Java and received this new error when running it: Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dirname(this$RuntimeLib) error: a character vector argument expected Error: package/namespace load failed for ‘rJava’ -- View thi

[R] possibly Error in R version 2.12.1 (2010-12-16)

2012-02-02 Thread Frank Schwidom
Hi, the following Code demonstrates an possibly Error in R (or you can explain me, why this happens, thanks in advance) Code: # testClass <- function( stackData= c()) { list( write= function( ...) { sChain= "" for( s in c( stackData, ...)) {

Re: [R] Need to Write a Code that can find the molecular weight of various compounds

2012-02-02 Thread matthew.ttd.nguyen
Hi Paul! Thanks a lot! I tried downloading the Rdisop file and encountered this error: Error: package ‘Rdisop’ is not installed for 'arch=x64' I tried downloading directly from the source using R and got this error: Error in file(filename, "r", encoding = encoding) : cannot open the connecti

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread Berend Hasselman
On 02-02-2012, at 21:10, Berend Hasselman wrote: > > On 02-02-2012, at 19:23, R. Michael Weylandt wrote: > >> It works for me as well so there's something funny on your end: please >> run the following *verbatim* (in a vanilla R session): >> >> sink("ForRHelp.txt") >> print(sessionInfo()) >> c

Re: [R] Probit regression with limited parameter space

2012-02-02 Thread Ben Bolker
[cc'ing back to r-help again -- I do this so the answers can be archived and viewed by others] On 12-02-02 02:41 PM, Sally Luo wrote: > Prof. Bolker, > > Thanks for your quick reply and detailed explanation. > > I also ran the unrestricted model using glmfit <- > glm(y~x1+x2+x3+x4+x5+x6+x7+x8,

Re: [R] R-Project at university.

2012-02-02 Thread R. Michael Weylandt
Disclaimer: I am a lawyer so this all should be verified elsewhere, but best I understand it (and would welcome verification by someone who knows more about this): The R-Project (broadly taken) is an extensive collection of packages + a core interpreter. The interpreter, the base packages, and mos

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread Berend Hasselman
On 02-02-2012, at 19:23, R. Michael Weylandt wrote: > It works for me as well so there's something funny on your end: please > run the following *verbatim* (in a vanilla R session): > > sink("ForRHelp.txt") > print(sessionInfo()) > cat("\n") > print(.Platform) > time <-as.POSIXct(c( 126230400, 1

Re: [R] kernel smoothing of disease rates at locations

2012-02-02 Thread Bert Gunter
Caveat: Both of the following claims are subject to verification by true experts, which I am not. But I believe: 1. If all values being smoothed are positive, then the smoother must be also. If there are negative values, this is no longer true, and your question needs much more detail to get an an

[R] Fiedler

2012-02-02 Thread Massimo Franceschet
Hi. I am looking for a function in R for computing the Fiedler vector of a graph (the eigenvector associated with the second smallest eigenvalue of the Laplacian of the graph). Alternatively, I am searching for an efficient method to compute just few eigenvalues/vectors of a matrix (the smalles

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread R. Michael Weylandt
It works for me as well so there's something funny on your end: please run the following *verbatim* (in a vanilla R session): sink("ForRHelp.txt") print(sessionInfo()) cat("\n") print(.Platform) time <-as.POSIXct(c( 126230400, 126252000, 126273600), origin="2005-01-01", tz="GMT") print(time) cat(f

[R] Two-Way PERMANOVA with Repeated Measurements

2012-02-02 Thread Kallin Tea
Hello, I want to perform a permanova where the first factor called Treatment has four levels. The second factor involves sampling the same research plots for four consecutive years, hence the repeated measurements. I have been able to use the adonis function from the package vegan to run this ana

Re: [R] kernel smoothing of disease rates at locations

2012-02-02 Thread ioanna
Is it possible to apply a kernel smoothing regression whose estimator or indeed the confidence intervals cannot take negative values or values greater than 1? Best regards, Ioanna -- View this message in context: http://r.789695.n4.nabble.com/kernel-smoothing-of-disease-rates-at-locations-tp79

[R] Predict function

2012-02-02 Thread Davg
I've created a linear model and am trying to use the predict function to predict the outcome of a sports game. I have four explanatory variables a,b,c,d. where a,b relate to the home team and c,d relate to the away team. i'd like to know the probability that the home team wins (assuming no draw

[R] R-Project at university.

2012-02-02 Thread Sylhetrin
Dear reader, I'm a student on engineering studies at Silesian University of Technology in Gliwice in Poland, my field of study is Technology and Mechanical Engineering on Integrated process of manufacturing systems, also I held a Bachelor's degree on Automation and Robotics. However I have a view q

Re: [R] Probit regression with limited parameter space

2012-02-02 Thread Ben Bolker
[cc'ing back to r-help] On 12-02-02 01:56 PM, Sally Luo wrote: > I tried to adapt your code to my model and got the results as below. I > don't know how to fix the warning messages. It says "rearrange the lower > (or upper) bounds to match 'start'". The warning is overly conservative in th

Re: [R] Vertical string with horizontal letters

2012-02-02 Thread Tyler Rinker
I apologize for the improperly formatted submission. I had my hotmail set to plain text instead of rich text. x <- "output"y <- unlist(strsplit(x, NULL)) plot.new()text(.5, .5, paste(y, collapse="\n")) > From: tyler_rin...@hotmail.com > To: israelb...@hotmail.com; r-help@r-project.org > Date: T

Re: [R] Vertical string with horizontal letters

2012-02-02 Thread 538280
There are only a few graphics devices that honor the 'crt' setting to rotate characters differently from the string rotation (postscript is the only one I know of, and then not always). For your specific case you could do something like: > text(1,1, paste( unlist(strsplit('output','')), collapse=

Re: [R] The "less than" (<) operator doesnt seem to perform as expected

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 10:00:58AM +, Jonas Hal wrote: > The example here puzzles me. It seems like the < operator doesn't work as > expected. > > > l <- 0.6 > > u <- seq(0.4, 0.7, 0.1) > > u > [1] 0.4 0.5 0.6 0.7 > > mygrid <- expand.grid("l" = l, "u" = u) > > mygrid > l u > 1 0.6 0.4

Re: [R] Vertical string with horizontal letters

2012-02-02 Thread Tyler Rinker
One possible solution is to use strsplit to break on each character and then paste to put in a "\n" after each character.  Then when you plot the text should be in the format you desire. x <- "output"y <- unlist(strsplit(x, NULL))p <- cat(paste(y, collapse="\n")) plot.new()text(.5, .5, paste(y,

Re: [R] sqldf for Very Large Tab Delimited Files

2012-02-02 Thread Gabor Grothendieck
On Thu, Feb 2, 2012 at 3:11 AM, Gabor Grothendieck wrote: > On Wed, Feb 1, 2012 at 11:57 PM, HC wrote: >> Hi All, >> >> I have a very (very) large tab-delimited text file without headers. There >> are only 8 columns and millions of rows. I want to make numerous pieces of >> this file by sub-setti

[R] Vertical string with horizontal letters

2012-02-02 Thread Israel Byrd
I'm trying to format text on a plot such that the string is vertical but the letters are horizonal. I tried text(1,1,label="output", srt=270) This gives the string rotation I want, but that rotates the entire "output" so the letters are also rotated. I've also tried text(1,1,label="output", sr

Re: [R] Plotting bar graph over a geographical map

2012-02-02 Thread Greg Snow
If you are willing to use base graphics instead of ggplot2 graphs, then look at the subplot function in the TeachingDemos package. One of the examples there shows adding multiple small bar graphs to a map. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s.

Re: [R] Function to compute multi-response, multi-rater kappa?

2012-02-02 Thread Luk Arbuckle
This is very interesting, Brian, thanks. I was starting to wonder if the reason I can't find an implementation of Kraemer's approach might be that there are better methods. The key extension of kappa by Kraemer, for my purposes, was the jacknife estimate to improve on estimated standard errors (t

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread uday
Dear Uwe , Thanks for reply I have tried format function that u suggested (format(time_t1, "%Y %m %d %H %M %S") and I got format(time_t1, "%Y %m %d %H %M %S") [1] "126230400" "126252000" "126273600" "126295200" "126316800" "126338400" I think something is not working correct. -- View th

Re: [R] Function to compute multi-response, multi-rater kappa?

2012-02-02 Thread Brian S Cade
Luk: Don't know if this solves your desire for an implementation in R, but the most general extension of Cohen's kappa for testing agreement that I'm aware of are the extensions made by using multi-response randomized block permutation procedures (MRBP) developed by Pual Mielke and Ken Berry.

Re: [R] formula error inside function

2012-02-02 Thread Hugh Morgan
Hi, I have fixed this. I replaced the "=" with "<<-". I do not think this is the most elegant way, so if anyone else has any better ideas they would be very much apperitiaded. New lines: formulaGenotype <<- test_variable~Genotype + Gender formulaNull <<- test_variable~Gender Cheers,

Re: [R] Windows 7 installation of .qz package from SourceForge

2012-02-02 Thread Prew, Paul
Thank you Duncan, the 2nd instructions worked. The both probably would have worked, but I had some code (below) that threw an error. It's designed to automatically set the internet connection to my Windows setting, so R would know the proxy server used at my worksite. I had seen this suggesti

Re: [R] How to retrieve a column name of a data frame

2012-02-02 Thread R. Michael Weylandt
I'd use something like which(df == "b", arr.ind = TRUE) which, gives the column number in the second spot; this gives you colnames(df)[which(df == "b", arr.ind = TRUE)[2]] Michael On Thu, Feb 2, 2012 at 11:00 AM, ikuzar wrote: > Sorry, it was not clear: > > my program have to return column n

[R] Organizing Large Datasets

2012-02-02 Thread Andrei Dubovik
Recently I've run into memory problems while using data.frames for a reasonably large dataset. I've solved those problems using arrays, and that has provoked me to do a few benchmarks. I would like to share the results. Let us start with the data. There are N subjects classified into G groups. The

Re: [R] How to retrieve a column name of a data frame

2012-02-02 Thread ikuzar
Sorry, it was not clear: my program have to return column name corresponding to a value, for example 'b' (so, the corresponding column is c1) How to retrieve c1 ? Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-retrieve-a-column-name-of-a-data-frame-tp4351764p435186

[R] glmer question

2012-02-02 Thread jphughes
I would like to fit the following model: logit(p_{ij}) = \mu + a_i + b_j wherea_i ~ N(0, \sigma_a^2) , b_j ~ N(0, \sigma_b^2) and \sigma_a = \sigma_b. Is it possible to fit a model with such a constraint on the variance components in glmer? -- View this message in context: http://r.7

Re: [R] How to retrieve a column name of a data frame

2012-02-02 Thread Rainer Schuermann
> colnames( df )[2] [1] "c2" On Thursday 02 February 2012 07:31:33 ikuzar wrote: > Hi, > > I 'd like to know how to retrieve a column name of a data frame. For > instance : > > df = data.frame(c1=c('a','b'),c2=c(1,2)) > > > df > > c1 c2 > 1 a 1 > 2 b 2 > > I would like to retrieve th

Re: [R] The "less than" (<) operator doesnt seem to perform as expected

2012-02-02 Thread R. Michael Weylandt
It's likely an infelicity of floating point representations (R FAQ 7.31) but admittedly, not a case I would have expected to present itself. If you want it to work out as expected, try this: l <- 0.6 u <- seq(0.4, 0.7, 0.1) l.int <- (6L) / 10 u.int <- seq(4, 7) / 10 l < u l.int < u.int Michael

Re: [R] The "less than" (<) operator doesnt seem to perform as expected

2012-02-02 Thread Sarah Goslee
This is R FAQ 7.31, about machine representation of floating point numbers. > mygrid$u[3] - mygrid$l[3] [1] 1.110223e-16 So mygrid$l[3] < mygrid$u[3] is true, though the difference is very, very small and due solely to the limitations of computers. Sarah On Thu, Feb 2, 2012 at 5:00 AM, Jonas Ha

Re: [R] calculation of probability values from multivariate normal densities

2012-02-02 Thread R. Michael Weylandt
I'm not sure what you mean "probability values" but you can get a multivariate normal density from library(mvtnorm) ? dmvnorm The same package also provides a pmvnorm but one has to be slightly more comfortable handling CDFs in the multivariate case. Michael 2012/2/2 Michał Góralski : > Hi, > >

Re: [R] The "less than" (<) operator doesnt seem to perform as expected

2012-02-02 Thread William Dunlap
You need to back up a bit to see the root cause of the problem, which is that seq()'s calculations necessarily involve some roundoff error (since it works with 52 binary digits of precision): > u <- seq(from=0.4, to=0.7, by=0.1) > u - c(0.4, 0.5, 0.6, 0.7) [1] 0.00e+00 0.00e+00 1.1102

Re: [R] get mean of same elements in a data.frame

2012-02-02 Thread R. Michael Weylandt
There are *many* ways, but here's two: df = data.frame(x = c(1:10), y = rnorm(10,2,1), label = rep(c('a', 'b', 'c', 'd', 'e'),2)) with(df, ave(x, label)) # Returns the correct value in each spot (useful if you want to add a group-mean column to df with(df, tapply(x, label, mean)) # Probably more

Re: [R] How to retrieve a column name of a data frame

2012-02-02 Thread R. Michael Weylandt
colnames(df)[2] Michael On Thu, Feb 2, 2012 at 10:31 AM, ikuzar wrote: > Hi, > > I 'd like to know how to retrieve a column name of a data frame. For > instance : > > df = data.frame(c1=c('a','b'),c2=c(1,2)) >> df >  c1 c2 > 1  a  1 > 2  b  2 > > I would like to retrieve the column name which va

Re: [R] Troubles with stemming (tm + Snowball packages) under MacOS

2012-02-02 Thread Zhou Zhou
The Sys.setenv(NOAWT=TRUE) code indeed solved my problem which was excatly what Julien described. The key is you have to deactivate AWT BEFORE loading RWeka/Snowball. If I do so it will fire a few warning messages but that should not affect anything. I am running the lsa package which requires RW

[R] get mean of same elements in a data.frame

2012-02-02 Thread Martin Batholdy
Hi, I have the following data.frame: data.frame(x = c(1:10), y = rnorm(10,2,1), label = rep(c('a', 'b', 'c', 'd', 'e'),2)) in this data.frame there is a label-variable containing strings. Each string is represented two times. Now I would like to have the mean of the corresponding x (and y-val

[R] calculation of probability values from multivariate normal densities

2012-02-02 Thread Michał Góralski
Hi, I would like to know, if there's any R function, which allows calculation of probability values (0,1) from multivariate normal densities. I would be grateful for any output. Cheers, MG __ R-help@r-project.org mailing list https://stat.ethz.ch/

[R] How to retrieve a column name of a data frame

2012-02-02 Thread ikuzar
Hi, I 'd like to know how to retrieve a column name of a data frame. For instance : df = data.frame(c1=c('a','b'),c2=c(1,2)) > df c1 c2 1 a 1 2 b 2 I would like to retrieve the column name which value is 2 (here, the column is c2) thanks for your help -- View this message in context: h

[R] The "less than" (<) operator doesnt seem to perform as expected

2012-02-02 Thread Jonas Hal
The example here puzzles me. It seems like the < operator doesn't work as expected. > l <- 0.6 > u <- seq(0.4, 0.7, 0.1) > u [1] 0.4 0.5 0.6 0.7 > mygrid <- expand.grid("l" = l, "u" = u) > mygrid l u 1 0.6 0.4 2 0.6 0.5 3 0.6 0.6 4 0.6 0.7 > mygridcollapsed <- mygrid[mygrid$l < mygrid$u, ]

Re: [R] gee: suppress printout

2012-02-02 Thread Søren Højsgaard
I don't think it can be "removed", a message like this has been coming out for several years and there may be a good reason why it is there. Your best bet is probably to approach the package maintainer with a suggestion to alter the code. Regards Søren -Oprindelig meddelelse- Fra: r-

[R] pgfSweave doesn't lazyload my objects

2012-02-02 Thread Ludo Pagie
Hi all, I'm struggling a bit to get pgfSweave to lazyload objects when compiling a .Rnw file for a second time. Caching works fine except that for every run all objects get cached again and again. I've used cacheSweave which works fine; all cached objects from code-chunks with option cache = T

Re: [R] Writing out data

2012-02-02 Thread R. Michael Weylandt
I believe connections were designed to do this as efficiently as possible by keeping the i/o path "open" rather than reopening it each time like write.table(append = TRUE) would do, though I may be wrong on the details: see ?connections. Prof Ripley has a good article about them in R News 1.1 -- ht

Re: [R] matrix element position: from length to dim

2012-02-02 Thread R. Michael Weylandt
Also take a look at the arrayInd() function which is what's used by which() internally for the arr.ind = TRUE case. Michael On Thu, Feb 2, 2012 at 8:25 AM, Petr Savicky wrote: > On Thu, Feb 02, 2012 at 02:08:37PM +0100, Ana wrote: >> How can I pass from position in length inside a matrix to posi

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread Petr PIKAL
Hi > > Thanks to Berend and the others, > > I've found a solution which works fine for my problem. > > I have not only 2 vectors, but also 4. > Question is, if q1 and q2 is equal to w1 and w2. > The computational time is very short, also for large data. > > q1 <- c(9,5,1,5) > q2 <- c(9,2,1,5)

Re: [R] Stuck with levels while reassigning dataframe colnames?

2012-02-02 Thread jjap
Thanks for the advice, df<-read.table(infile, sep="," skip = 1, header=TRUE) is indeed much cleaner from the outset (and was my usual way to it). I was unaware that readLines(infile, n=1) could get me the first line without reading the whole file again. But I do need to get my head around th

Re: [R] matrix element position: from length to dim

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 02:08:37PM +0100, Ana wrote: > How can I pass from position in length inside a matrix to position in dim ? > > > a=matrix(c(1:999),nrow=9) > > which(a==87)#position in length 1:length(a) > 87 > > which(a==87,arr.ind=TRUE) #position in dim > row col > [1,] 6

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread David Winsemius
On Feb 2, 2012, at 6:55 AM, Chris82 wrote: Thanks to Berend and the others, I've found a solution which works fine for my problem. I have not only 2 vectors, but also 4. Question is, if q1 and q2 is equal to w1 and w2. The computational time is very short, also for large data. q1 <- c(9,5,1,

[R] matrix element position: from length to dim

2012-02-02 Thread Ana
How can I pass from position in length inside a matrix to position in dim ? a=matrix(c(1:999),nrow=9) which(a==87)#position in length 1:length(a) 87 which(a==87,arr.ind=TRUE) #position in dim row col [1,] 6 10 __ R-help@r-project.org ma

[R] Draw vertical line segments between pairs of points

2012-02-02 Thread Mohamed Lajnef
Dear all, How to add /*vertical*/ lines above bar graph to display p-values ( between pairs of points )? Regards ML -- Mohamed Lajnef,IE INSERM U955 eq 15# P?le de Psychiatrie# H?pital CHENEVIER # 40, rue Mesly

Re: [R] Writing out data

2012-02-02 Thread Ivan Calandra
Correct me if I'm wrong, but I think that write.csv() doesn't have an append argument; write.table() does though. Ivan -- Ivan CALANDRA Université de Bourgogne UMR CNRS/uB 6282 Biogéosciences 6 Boulevard Gabriel 21000 Dijon, FRANCE +33(0)3.80.39.63.06 ivan.calan...@u-bourgogne.fr Le 02/02/12

Re: [R] Writing out data

2012-02-02 Thread Paul Hiemstra
On 02/02/2012 11:40 AM, Thomas wrote: > What is the best way to write out comma separated data, as a program > is running (rather than waiting to the end using write.csv)? At the > moment I'm doing this, but I guess it's not the most efficient. The > data is in a column in the matrix postcount, and

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread Patrizio Frederic
Hey Chris, I would take advantage from the apply function: apply(cbind(q1,q2),1,function(x)any((x[1]==w1)&(x[2]==w2))) Regards PF On Thu, Feb 2, 2012 at 12:55 PM, Chris82 wrote: > Thanks to Berend and the others, > > I've found a solution which works fine for my problem. > > I have not only 2

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread Chris82
Thanks to Berend and the others, I've found a solution which works fine for my problem. I have not only 2 vectors, but also 4. Question is, if q1 and q2 is equal to w1 and w2. The computational time is very short, also for large data. q1 <- c(9,5,1,5) q2 <- c(9,2,1,5) w1 <- c(9,4,4,4,5) w1 <- c

[R] Writing out data

2012-02-02 Thread Thomas
What is the best way to write out comma separated data, as a program is running (rather than waiting to the end using write.csv)? At the moment I'm doing this, but I guess it's not the most efficient. The data is in a column in the matrix postcount, and I'm using a loop to write out each of

Re: [R] How to get intersection of multiple vectors?

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 01:55:07PM +0800, 孟欣 wrote: > v1<-c("a","b","c","d") > v2<-c("a","b","e") > v3<-c("a","f","g") > > > I want to get the intersection of v1,v2,v3,ie "a" > > > How can I do then? > > > What I know is only for 2 vectors via "intersect" function,but don't know how > to dea

Re: [R] How to get intersection of multiple vectors?

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 01:55:07PM +0800, 孟欣 wrote: > v1<-c("a","b","c","d") > v2<-c("a","b","e") > v3<-c("a","f","g") > > > I want to get the intersection of v1,v2,v3,ie "a" > > > How can I do then? > > > What I know is only for 2 vectors via "intersect" function,but don't know how > to dea

Re: [R] finding rows in a matrix that match a vector

2012-02-02 Thread Uwe Ligges
On 28.01.2012 05:43, Melissa Patrician wrote: Hi, Please excuse my inexperience, but I am just learning R (this is my very first day programming in R) and having a really hard time figuring out how to do the following: I have a matrix that is 1000 row by 6 columns (named 'table.combos') and a

Re: [R] Makefile to compile .so in src (was: Re: automated libR location)

2012-02-02 Thread Uwe Ligges
On 01.02.2012 03:37, Matyas Sustik wrote: Prof Brian Ripley wrote: 'library' in R has a different meaning: I've altered the subject to be more accurate 'libR'. This is what R CMD SHLIB is for: it does all this for you in a portable way. But if you want to DIY, you can use R CMD config to fin

Re: [R] User Interface Equivalent Code

2012-02-02 Thread Uwe Ligges
On 30.01.2012 20:26, Ajay Askoolum wrote: When I plot, the plot's user interface offers me a choice: File | Copy to the Clipboard | as a Bitmap. > What is the equivalent code for achieving this but without the plot interface becoming visible? For something *equivalent*, see ?dev.copy. Sin

Re: [R] time conversion from second to Y M D H M S format

2012-02-02 Thread Uwe Ligges
On 02.02.2012 09:26, uday wrote: I have some time data and which is in seconds time<-c( 126230400 126252000 126273600 126295200 126316800 126338400) now I wanted to convert this time to Y M D H M S format I have tried following codes but it does not give me the out put in Y M D H M S time

Re: [R] knncat broken on R 2.14?

2012-02-02 Thread Uwe Ligges
Works for me. Uwe Ligges On 02.02.2012 02:09, Nick Matzke wrote: Hi, Until recently I was using the knncat classifier function of knncat on an old computer (2.12, Mac OS X 10.4), and everything worked great. However, now that I have updated to R 2.14.1 (on Mac OS X 10.7), knncat seems broken.

Re: [R] "shifted" bar chart / battleship curve

2012-02-02 Thread Jim Lemon
On 02/02/2012 01:24 PM, Maltese, Adam Vincent wrote: What I want to do is create a horizontal bar chart matrix for a set of data that have a common set of variables (e.g., % of As, % of Bs, etc.) listed on the Y-axis and groups (e.g., Classes) on the X-axis. The key here is that the bars for ea

Re: [R] mgcv bam() with grouped binomial data

2012-02-02 Thread Simon Wood
Hi Casey, any chance that you could send me the data off list (under a strict undertaking to not use it for anything but this de-bugging of course)? I can't immediately reproduce the problem by simulating similar, but it certainly looks like a bug. best, Simon On 02/02/2012 01:54 AM, Casey

  1   2   >