[R] Equivalent of SAS's FIRST. And LAST. Variable in R?

2010-07-12 Thread Wang, Kevin (SYD)
Hi all, I'm just wondering if there is a equivalent of SAS's FIRST. and LAST. variables in R? For example, suppose this is a snapshot of the data: ClientCode CaseCode open closeImportant 1 37 28 2003-07-08 2003-09-021 2 37

Re: [R] ed50

2010-07-12 Thread Rubén Roa
> -Mensaje original- > De: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] En nombre de Dipa Hari > Enviado el: lunes, 12 de julio de 2010 22:19 > Para: r-help@r-project.org > Asunto: [R] ed50 > > I am using semiparametric Model >  library(mgcv) > sm1=gam(y~x1+s(x2)

[R] Three-way Panel Data Analysis

2010-07-12 Thread danice ng
Dear R users, I have panel data on the amount of money spent by travellers from 8 origin countries in 4 destinations. I would like to carry out analysis for destinations, origins and time. However, it seems to me that the package "plm" can only esitmate two-way panel data (indexed by a two-dimensi

[R] object of class madata

2010-07-12 Thread shabnam k
Hi, Am using maanova package for doing anova.But am getting error like this..plz, help me regarding this.. > TGR=read.madata("rmaexpr.dat",designfile="design.dat") Reading one color array. Otherwise change arrayType='twoColor' then read the data again Warning messages: 1: In read.madata("rmaexp

Re: [R] Fast string comparison

2010-07-12 Thread Hadley Wickham
strings <- replicate(1e5, paste(sample(letters, 100, rep = T), collapse = "")) system.time(strings[-1] == strings[-1e5]) # user system elapsed # 0.016 0.000 0.017 So it takes ~1/100 of a second to do ~100,000 string comparisons. You need to provide a reproducible example that illustrates

Re: [R] Fast string comparison

2010-07-12 Thread Ralf B
I am asking this question because String comparison in R seems to be awfully slow (based on profiling results) and I wonder if perhaps '==' alone is not the best one can do. I did not ask for anything particular and I don't think I need to provide a self-contained source example for the question. S

Re: [R] Xyplot or Tin-R problem?

2010-07-12 Thread RICHARD M. HEIBERGER
You missed FAQ 7.22 7.22 Why do lattice/trellis graphics not work? The most likely reason is that you forgot to tell R to display the graph. Lattice functions such as xyplot() create a graph object, but do not display it (the same is true of *ggplot2* graphics, and Trellis graphics in S-Plus). T

Re: [R] SAS Proc summary/means as a R function

2010-07-12 Thread RICHARD M. HEIBERGER
Please get a copy of R for SAS and SPSS Users *by* *Muenchen*, Robert A. http://www.springer.com/statistics/computanional+statistics/book/978-0-387-09417-5 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.e

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
I had tried that earlier and didn't work either, I probably have \Sexpr in the wrong place. See example: Column one header gets blank: \documentclass[11pt]{article} \usepackage{longtable,verbatim,ctable} \usepackage{longtable,pdflscape} \usepackage{fmtcount,hyperref} \usepackage{fullpage} \title

Re: [R] Accessing files on password-protected FTP sites

2010-07-12 Thread Jeff Newmiller
There is a standard notation for passwords in urls ... see for example http://www.devx.com/tips/Tip/5604 "Cliff Clive" wrote: > >Hello everyone, > >Is it possible to download data from password-protected ftp sites? I saw >another thread with instructions for uploading files using RCurl, but I

Re: [R] SAS Proc summary/means as a R function

2010-07-12 Thread Erik Iverson
On 07/12/2010 07:16 PM, Roger Deangelis wrote: Hi, I am new to R. I am trying to create an R function to do a SAS proc means/summary proc.means ( data=bsebal; class team year; var ab h; output out=BseBalAvg mean=;

[R] SAS Proc summary/means as a R function

2010-07-12 Thread Roger Deangelis
Hi, I am new to R. I am trying to create an R function to do a SAS proc means/summary proc.means ( data=bsebal; class team year; var ab h; output out=BseBalAvg mean=; run;) I have a solution if I quote the the

[R] Accessing files on password-protected FTP sites

2010-07-12 Thread Cliff Clive
Hello everyone, Is it possible to download data from password-protected ftp sites? I saw another thread with instructions for uploading files using RCurl, but I could not find information for downloading them in the RCurl documentation. I am using R 2.11 on a Windows XP 32-bit machine. Thanks

Re: [R] do the standard R analysis functions handle spatial "grid" data?

2010-07-12 Thread Steve Taylor
Have a look at the Task View for spatial data... http://cran.ms.unimelb.edu.au/web/views/Spatial.html >>> From: "chris howden" To:, Date: 13/Jul/2010 2:01p Subject: [R] do the standard R analysis functions handle spatial "grid" data? Hi everyone, I'm doing a resource function analysis with r

[R] do the standard R analysis functions handle spatial "grid" data?

2010-07-12 Thread chris howden
Hi everyone, I'm doing a resource function analysis with radio collared dingos and GIS info. The ecologist I'm working with wants to send me the data in a 'grid format'...straight out of ARCVIEW GIS. I want to model the data using a GLM and maybe a LOGISTIC model as well. And I was planning on u

[R] Correct function name for text display of S4 object

2010-07-12 Thread Andrew Liu
Hello, I am working on an R package for storing order book data. I currently have a display method that has the following output (ob is an S4 object): display(ob) Current time is 09:35:02 Price Ask Size -- 11.42 900

Re: [R] Xyplot or Tin-R problem?

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 6:26 PM, YANG, Richard ChunHSi wrote: I ran the following script from xyplot Examples using Tin-R on Windows and saw no plot produced. EE <- equal.count(ethanol$E, number=9, overlap=1/4) xyplot(NOx ~ C | EE, data=ethanol, prepanel = function(x,y) prepanel.loess(x, y, spa

Re: [R] Continuing on with a loop when there's a failure

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 6:18 PM, Josh B wrote: Hi R sages, Here is my latest problem. Consider the following toy example: x <- read.table(textConnection("y1 y2 y3 x1 x2 indv.1 bagels donuts bagels 4 6 indv.2 donuts donuts donuts 5 1 indv.3 donuts donuts donuts 1 10 indv.4 donuts donuts donuts 10

Re: [R] print.trellis draw.in - plaintext (gmail mishap)

2010-07-12 Thread Felix Andrews
The problem is that you have not pushed your viewport so it doesn't exist in the plot. (You only pushed the layout viewport). > grid.ls(viewports = TRUE) ROOT GRID.VP.82 Try this: vp <- vplayout(2,2) pushViewport(vp) upViewport() grid.ls(viewports = TRUE) #ROOT # GRID.VP.82 #GRID.VP.86 pr

Re: [R] Comparison of two very large strings

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 6:46 PM, David Winsemius wrote: On Jul 12, 2010, at 6:03 PM, harsh yadav wrote: Hi, I have a function in R that compares two very large strings for about 1 million records. The strings are very large URLs like:- http://query.nytimes.com/gst/sitesearch_selector.html

[R] Continuing on with a loop when there's a failure

2010-07-12 Thread Josh B
Hi R sages, Here is my latest problem. Consider the following toy example: x <- read.table(textConnection("y1 y2 y3 x1 x2 indv.1 bagels donuts bagels 4 6 indv.2 donuts donuts donuts 5 1 indv.3 donuts donuts donuts 1 10 indv.4 donuts donuts donuts 10 9 indv.5 bagels donuts bagels 0 2 indv.6 bagels

[R] Xyplot or Tin-R problem?

2010-07-12 Thread YANG, Richard ChunHSi
I ran the following script from xyplot Examples using Tin-R on Windows and saw no plot produced. EE <- equal.count(ethanol$E, number=9, overlap=1/4) xyplot(NOx ~ C | EE, data=ethanol, prepanel = function(x,y) prepanel.loess(x, y, span=1), xlab="Compression Ratio", ylab="NOx (micrograms/J

Re: [R] What is the degrees of freedom in an nlme model

2010-07-12 Thread Jun Shen
Hi, Bert, Thanks for your thoughtful explanation. I think the problem is quite over my head and maybe I should leave "how" for experts :) The situation is I have a group of sigmoid curves (let's say, they are supposed to be the same) but occasionally you will see a few curves kind of different. S

Re: [R] Comparison of two very large strings

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 6:03 PM, harsh yadav wrote: Hi, I have a function in R that compares two very large strings for about 1 million records. The strings are very large URLs like:- http://query.nytimes.com/gst/sitesearch_selector.html?query=US+Visa+Laws&type=nyt&x=25&y=8 . .. or of lar

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 5:45 PM, Felipe Carrillo wrote: Thanks for the quick reply Duncan. I don't think I have explained myself well, I have a dataset named "report" and my column headers are run1,run2,run3,run4 and so on. I know how to access the data below those columns with \Sexpr{report[

[R] Matrix Column Names

2010-07-12 Thread David Neu
Hi, Is there a way to create a matrix in which the column names are not checked to see if they are valid variable names? I'm looking something similar to the check.names argument to data.frame. If so, would such an approach work for the sparse matrix classes in the Matrix package. Many thanks!

[R] Comparison of two very large strings

2010-07-12 Thread harsh yadav
Hi, I have a function in R that compares two very large strings for about 1 million records. The strings are very large URLs like:- http://query.nytimes.com/gst/sitesearch_selector.html?query=US+Visa+Laws&type=nyt&x=25&y=8. .. or of larger lengths. The data-frame looks like:- id url 1 http:/

Re: [R] findInterval and data resolution

2010-07-12 Thread Bryan Hanson
Thanks Duncan... More appended at the bottom... On 7/12/10 5:38 PM, "Duncan Murdoch" wrote: > On 12/07/2010 5:25 PM, Bryan Hanson wrote: >> Hello Wise Ones... >> >> I need a clever way around a problem with findInterval. Consider: >> >> vec1 <- 1:10 >> vec2 <- seq(1, 10, by = 0.1) >> >> x1

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
Thanks for the quick reply Duncan. I don't think I have explained myself well, I have a dataset named "report" and my column headers are run1,run2,run3,run4 and so on. I know how to access the data below those columns with \Sexpr{report[1,1]} & &\Sexpr{report[1,2]} and so on, but I can't access

Re: [R] findInterval and data resolution

2010-07-12 Thread Steve Taylor
How about this: these = which(vec2 < x1[1] | vec2 > x1[2]) vec2[these] # Or using logical indexation directly: vec2[vec2 < x1[1] | vec2 > x1[2]] >>> From: Bryan Hanson To:R Help Date: 13/Jul/2010 9:28a Subject: [R] findInterval and data resolution Hello Wise Ones... I need a clever way aroun

[R] Question about food sampling analysis

2010-07-12 Thread Sarah Henderson
Greetings to all, and my apologies for a question that is mostly about statistics and secondarily about R. I have just started a new job that (this week, apparently) requires statistical knowledge beyond my training (as an epidemiologist). The problem: - We have 57 food production facilities in

Re: [R] findInterval and data resolution

2010-07-12 Thread Duncan Murdoch
On 12/07/2010 5:25 PM, Bryan Hanson wrote: Hello Wise Ones... I need a clever way around a problem with findInterval. Consider: vec1 <- 1:10 vec2 <- seq(1, 10, by = 0.1) x1 <- c(2:3) a1 <- findInterval(x1, vec1); a1 # example 1 a2 <- findInterval(x1, vec2); a2 # example 2 In the problem I'

[R] findInterval and data resolution

2010-07-12 Thread Bryan Hanson
Hello Wise Ones... I need a clever way around a problem with findInterval. Consider: vec1 <- 1:10 vec2 <- seq(1, 10, by = 0.1) x1 <- c(2:3) a1 <- findInterval(x1, vec1); a1 # example 1 a2 <- findInterval(x1, vec2); a2 # example 2 In the problem I'm working on, vec* may be either integer or n

Re: [R] How to select the column header with \Sexpr{}

2010-07-12 Thread Duncan Murdoch
On 12/07/2010 5:10 PM, Felipe Carrillo wrote: Hi: Since I work with a few different fish runs my column headers change everytime I start a new Year. I have been using \Sexpr{} for my row and columns and now I am trying to use with my report column headers. \Sexpr{1,1} is row 1 column 1, what can

[R] How to select the column header with \Sexpr{}

2010-07-12 Thread Felipe Carrillo
Hi: Since I work with a few different fish runs my column headers change everytime I start a new Year. I have been using \Sexpr{} for my row and columns and now I am trying to use with my report column headers. \Sexpr{1,1} is row 1 column 1, what can I use for headers? I tried \Sexpr{0,1} but swea

[R] SAS to R

2010-07-12 Thread trekvana
Hi everyone I dont know how to code in SAS but I do know how to code in R. Can someone please be kind enough to translate this into R code for me: proc mixed data = small method = reml; class id day; model weight = day/ solution ddfm = bw; repeated day/ subject=id type = unstructured; run; ==

Re: [R] What is the degrees of freedom in an nlme model

2010-07-12 Thread Bert Gunter
Jun: Short answer: There is no such thing as df for a nonlinear model (whether or not mixed effects). Longer answer: df is the dimension of the null space when the data are projected on the linear subspace of the model matrix of a **linear model ** . So, strictly speaking, no linear model, no df.

[R] Statistical Learning and Datamining Course October 2010 Washington DC

2010-07-12 Thread Trevor Hastie
Short course: Statistical Learning and Data Mining III: Ten Hot Ideas for Learning from Data Trevor Hastie and Robert Tibshirani, Stanford University Georgetown University Conference Center Washington DC, October 11-12, 2010. This two-day course gives a detailed overview of statistical m

Re: [R] exercise in frustration: applying a function to subsamples

2010-07-12 Thread Ted Byers
Thanks Jim, I acted on your suggestion and found the result unchanged. :-( Then I noticed that fitdist doesn't like a sample size of 1 either. If, then, "drop = TRUE" results in all empty combinations of m_id, year and week being excluded, then (noticing the requirement is actually that the sam

Re: [R] exercise in frustration: applying a function to subsamples

2010-07-12 Thread Ted Byers
OK, here is a stripped down variant of my code. I can run it here unchanged (apart from the credentials for connecting to my DB). Sys.setenv(MYSQL_HOME='C:/Program Files/MySQL/MySQL Server 5.0') > library(TSMySQL) > library(plyr) > library(fitdistrplus) > con <- dbConnect(MySQL(), user="rejbyers

[R] ed50

2010-07-12 Thread Dipa Hari
I am using semiparametric Model  library(mgcv) sm1=gam(y~x1+s(x2),family=binomial, f) How should I  find out standard error for ed50 for the above model ED50 =( -sm1$coef[1]-f(x2)) / sm1$coef [2]   f(x2) is estimated value for non parametric term.   Thanks [[alternative HTML vers

Re: [R] exercise in frustration: applying a function to subsamples

2010-07-12 Thread jim holtman
try 'drop=TRUE' on the split function call. This will prevent the NULL set from being sent to the function. On Mon, Jul 12, 2010 at 3:10 PM, Ted Byers wrote: > >From the documentation I have found, it seems that one of the functions from > package plyr, or a combination of functions like split a

Re: [R] How to create sequence in month

2010-07-12 Thread Gabor Grothendieck
On Mon, Jul 12, 2010 at 2:25 PM, Bogaso Christofer wrote: > Hi all, can anyone please guide me how to create a sequence of months? Here > I have tried following however couldn't get success > >> library(zoo) > >> seq(as.yearmon("2010-01-01"), as.yearmon("2010-03-01"), by="1 month") > There curren

Re: [R] ggplot2: How to change font of labels in geom_text

2010-07-12 Thread Edwin Sun
I have the same problem and I wonder if there is any answer from the community. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-How-to-change-font-of-labels-in-geom-text-tp991579p2286671.html Sent from the R help mailing list archive at Nabble.com. ___

[R] Robust regression error: Too many singular resamples

2010-07-12 Thread Alexandra Denby
Hello. I've got a dataset that may have outliers in both x and y. While I am not at all familiar with robust regression, it looked like the function lmrob in package robustbase should handle this situation. When I try to use it, I get: Too many singular resamples Aborting fast_s_w_mem() Looki

[R] What is the degrees of freedom in an nlme model

2010-07-12 Thread Jun Shen
Dear all, I want to do a F test, which involves calculation of the degrees of freedom for the residuals. Now say, I have a nlme object "mod.nlme". I have two questions 1.How do I extract the degrees of freedom? 2.How is this degrees of freedom calculated in an nlme model? Thanks. Jun Shen Some

Re: [R] exercise in frustration: applying a function to subsamples

2010-07-12 Thread Erik Iverson
Your code is not reproducible. Can you come up with a small example showing the crux of your data structures/problem, that we can all run in our R sessions? You're likely get much higher quality responses this way. Ted Byers wrote: From the documentation I have found, it seems that one of th

Re: [R] Subsetting Lists

2010-07-12 Thread Jorge Ivan Velez
Hi Andrew, Try sapply(lst, "[", 2) HTH, Jorge On Mon, Jul 12, 2010 at 3:12 PM, Andrew Leeser <> wrote: > I am looking for a way to create a vector which contains the second element > of > every vector in the list. However, not every vector has two components, so > I > need to generate an NA f

[R] Subsetting Lists

2010-07-12 Thread Andrew Leeser
I am looking for a way to create a vector which contains the second element of every vector in the list. However, not every vector has two components, so I need to generate an NA for those missing. For example, I have created the following list: lst <- list(c("a", "b"), c("c"), c("d", "e"), c("

[R] exercise in frustration: applying a function to subsamples

2010-07-12 Thread Ted Byers
>From the documentation I have found, it seems that one of the functions from package plyr, or a combination of functions like split and lapply would allow me to have a really short R script to analyze all my data (I have reduced it to a couple hundred thousand records with about half a dozen recor

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Joshua Wiley
I wanted to point out one thing that Ted said, about initializing the vectors ('s' in your example). This can make a dramatic speed difference if you are using a for loop (the difference is neglible with vectorized computations). Also, a lot of benchmarks have been flying around, each from a diff

[R] Error in storage.mode(test) <- "logical"

2010-07-12 Thread Heiman, Thomas J.
Hi There, I get the following error from the code pasted below: Error in storage.mode(test) <- "logical" : object 'HGBmt12_Natl_Ave_or_Facility' not found library(RODBC) library(car) setwd("c://temp//cms") a07.connect <- odbcConnectAccess2007("DFC.accdb") sqlTables(a07.connect) ##provides list

Re: [R] How to create sequence in month

2010-07-12 Thread Stefan Grosse
Am 12.07.2010 20:25, schrieb Bogaso Christofer: >> library(zoo) > >> seq(as.yearmon("2010-01-01"), as.yearmon("2010-03-01"), by="1 month") > seq(as.Date("2010-01-01"), as.Date("2010-03-01"), by="1 month") hth Stefan __ R-help@r-project.org mailing

Re: [R] eliminating constant variables

2010-07-12 Thread Setlhare Lekgatlhamang
What was the question and answer here? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of pdb Sent: Sunday, July 11, 2010 5:23 AM To: r-help@r-project.org Subject: Re: [R] eliminating constant variables Importance: Low Awsome! It mad

Re: [R] Calculating weibull's distribution mean, standard deviation, and variance

2010-07-12 Thread Peter Ehlers
Try fitdistr() in pkg MASS. -Peter Ehlers On 2010-07-12 11:17, Oscar Rodriguez wrote: Dear R community: Sorry if this question has a simple answer, but I am a new user of R. Do you know a command, or package that can estimate the weibull distribution's mean, standard deviation and variance

Re: [R] How to create sequence in month

2010-07-12 Thread MacQueen, Don
As in this example: > seq(as.Date("2000/1/1"), as.Date("2003/1/1"), by="mon") On 7/12/10 11:25 AM, "Bogaso Christofer" wrote: > Hi all, can anyone please guide me how to create a sequence of months? Here > I have tried following however couldn't get success > > > >> library(zoo) > >> seq(

[R] How to create sequence in month

2010-07-12 Thread Bogaso Christofer
Hi all, can anyone please guide me how to create a sequence of months? Here I have tried following however couldn't get success > library(zoo) > seq(as.yearmon("2010-01-01"), as.yearmon("2010-03-01"), by="1 month") Error in del/by : non-numeric argument to binary operator What is the cor

[R] Calculate confidence interval of the mean based on ANOVA

2010-07-12 Thread Paul
I am trying to recreate an analysis that has been done by another group (in SAS I believe). I'm stuck on one part, I think because my stats knowledge is lacking, and while it's OT, I'm hoping someone here can help. Given this dataframe; foo*<-*structure(list(OBS = structure(1:18, .Label = c("1

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Raghu
Thanks to you all. I stand corrected Ted and Manuela:) I am just an end user and trying to pick up from such forums. Many thanks sirs. On Mon, Jul 12, 2010 at 5:45 PM, Huso, Manuela wrote: > Using Ted Harding's example: > > news1o <- runif(100) > s2o<- runif(100) > > pt1 <- proc.tim

Re: [R] Compress string memCompress/Decompress

2010-07-12 Thread Erik Wright
Hi Seth, Can you recreate the example below using dbWriteTable? Thanks!, Erik On Jul 11, 2010, at 6:13 PM, Seth Falcon wrote: > On Sun, Jul 11, 2010 at 11:31 AM, Matt Shotwell wrote: >> On Fri, 2010-07-09 at 20:02 -0400, Erik Wright wrote: >>> Hi Matt, >>> >>> This works great, thanks! >>>

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Huso, Manuela
Using Ted Harding's example: news1o <- runif(100) s2o<- runif(100) pt1 <- proc.time() s <- numeric(length(news1o))-1 # Set all of s to -1 s[news1o>s2o] <-1# Change to 1 only those values of s # for which news1o>s2o pt2<-

[R] Calculating weibull's distribution mean, standard deviation, and variance

2010-07-12 Thread Oscar Rodriguez
Dear R community: Sorry if this question has a simple answer, but I am a new user of R. Do you know a command, or package that can estimate the weibull distribution's mean, standard deviation and variance? or can direct me to where to find it? Thanks in advance, Oscar Rodriguez Gon

Re: [R] densities greater than 1 for values within an (0, 1) intervall

2010-07-12 Thread Jeff Newmiller
There is no constraint on the magnitude of probability density values, though the area under the curve must be equal to one. You may be thinking of cumulative probability distributions? If so, take a look at smoothed.df() in library (cwhmisc). "Katja Hillmann" wrote: >Hello, > >I used the com

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Ken Takagi
Richardson, Patrick vai.org> writes: > > I'm trying to use multiple plotting colors in my code. My first "ifelse" statement successfully does what I > want. However, now I want anything less than -4.5 to be green and the rest black. I want another "col" > argument but can only use one. How could

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Richardson, Patrick
Steve, That worked perfectly. Thank You! Best regards, Patrick -Original Message- From: Steve Lianoglou [mailto:mailinglist.honey...@gmail.com] Sent: Monday, July 12, 2010 12:55 PM To: Richardson, Patrick Cc: r-help@r-project.org Subject: Re: [R] Multiple Ploting Colors Hi, On Mon,

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Steve Lianoglou
Ugh: > Depending on what you want the plot for, perhaps you might consider > changing your color palette from green -> black -> red to something > like blue -> black -> yellow, since many folks who are color can not > differentiate green from red all that well. ... folks who are color *blind* can

Re: [R] How do I move axis labels closer to plot box?

2010-07-12 Thread Ken Takagi
chen jia fisher.osu.edu> writes: > Check out the ?par(). Specifically mgp. HTH, Ken __ 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

[R] densities greater than 1 for values within an (0,1) intervall

2010-07-12 Thread Katja Hillmann
Hello, I used the command kdensity in order to calculate the density of fractions/ratios (e.g. number of longterm unemployed on total unemployment). Thus I try to calculate the denisty of values less than 1. However, the values of the kernel densitiy R provided (y-scale) are all greater than

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Steve Lianoglou
One more thing: On Mon, Jul 12, 2010 at 12:55 PM, Steve Lianoglou wrote: > Hi, > > On Mon, Jul 12, 2010 at 12:02 PM, Richardson, Patrick > wrote: >> I'm trying to use multiple plotting colors in my code. My first "ifelse" >> statement successfully does what I want. However, now I want anything

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Steve Lianoglou
Hi, On Mon, Jul 12, 2010 at 12:02 PM, Richardson, Patrick wrote: > I'm trying to use multiple plotting colors in my code. My first "ifelse" > statement successfully does what I want. However, now I want anything less > than -4.5 to be green and the rest black. I want another "col" argument but

[R] How to use mpi.allreduce() in Rmpi?

2010-07-12 Thread Eduardo García
Hi everybody! I have the next code which makes a reduction of the *a *variable in two slaves, using the Rmpi package. library(Rmpi) mpi.spawn.Rslaves(nslaves=2) reduc<-function(){ a<-mpi.comm.rank()+2 mpi.reduce(a,type=2, op="prod") return(paste("a=",a)) } mpi.bcast.Robj2slave(reduc) mpi

Re: [R] Multiple Ploting Colors

2010-07-12 Thread Ken Takagi
Richardson, Patrick vai.org> writes: > > I'm trying to use multiple plotting colors in my code. My first "ifelse" statement successfully does what I > want. However, now I want anything less than -4.5 to be green and the rest black. I want another "col" > argument but can only use one. How could

Re: [R] Compress string memCompress/Decompress

2010-07-12 Thread Seth Falcon
On Mon, Jul 12, 2010 at 9:17 AM, Erik Wright wrote: > Hi Seth, > > Can you recreate the example below using dbWriteTable? > Not sure if that is possible with the current dbWriteTable code (don't have time to explore that right now). You are welcome to poke around. You could wrap the example in a

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Ted Harding
On 12-Jul-10 14:09:30, Raghu wrote: > When I just run a for loop it works. But if I am going to > run a for loop every time for large vectors I might as well > use C or any other language. > The reason R is powerful is becasue it can handle large vectors > without each element being manipulated? Pl

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 10:09 AM, Raghu wrote: When I just run a for loop it works. But if I am going to run a for loop every time for large vectors I might as well use C or any other language. The reason R is powerful is becasue it can handle large vectors without each element being manipula

Re: [R] Can anybody help me understand AIC and BIC and devise a new metric?

2010-07-12 Thread Stephan Kolassa
Hi, one comment: Claeskens and Hjort define AIC as 2*log L - 2*p for a model with likelihood L and p parameters; consequently, they look for models with *maximum* AIC in model selection and averaging. This differs from the vast majority of authors (and R), who define AIC as -2*log L + 2*p and sea

Re: [R] a small puzzle?

2010-07-12 Thread Alain Guillet
In an if statement, you can use only elements. In your example, news1o and s2o are vectors so there is a warning saying the two vectors have a bigger length than one. If you don't send two messages about the same problem in two minutes, you can see what people answer you... For example, I adv

Re: [R] a small puzzle?

2010-07-12 Thread jim holtman
You probably want to use "ifelse" s <- ifelse(news1o>s2o, 1, -1) 'if' only handle a single logical expression. On Mon, Jul 12, 2010 at 10:02 AM, Raghu wrote: > I know the following may sound too basic but I thought the mailing list is > for the benefit of all levels of people. I ran a simple i

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Seeliger . Curt
> The reason R is powerful is becasue it can handle large vectors without each > element being manipulated? Please let me know where I am wrong. > > for(i in 1:length(news1o)){ > + if(news1o[i]>s2o[i]) > + s[i]<-1 > + else > + s[i]<--1 > + } You might give ifelse() a shot here. s <- ifelse(news

Re: [R] in continuation with the earlier R puzzle

2010-07-12 Thread Alain Guillet
I don't know what is wrong with your code but I believe you should use ifelse instead of a for loop: s <- ifelse(news1o > s2o, 1 , -1 ) Alain On 12-Jul-10 16:09, Raghu wrote: When I just run a for loop it works. But if I am going to run a for loop every time for large vectors I might as wel

[R] Multiple Ploting Colors

2010-07-12 Thread Richardson, Patrick
I'm trying to use multiple plotting colors in my code. My first "ifelse" statement successfully does what I want. However, now I want anything less than -4.5 to be green and the rest black. I want another "col" argument but can only use one. How could I go about getting separate colors for anyth

[R] How do I convert a XML file to a data.frame?

2010-07-12 Thread Magnus Statistik
Hi, I have a problem converting a XML file, via the XML package, to a data.frame. The XML file looks like this: I don't usually use XML files, but I have searched for an answer for quite a while. I have tried "xmlToDataFra

[R] How do I move axis labels closer to plot box?

2010-07-12 Thread chen jia
Hi there, I place a vector of strings as labels at the tick points by using axis(1,at=seq(0.1,0.7,by=0.1), labels=paste(seq(10,70,by=10),"%",sep=""), tick=FALSE) However, there is a large space between those labels and the boundary of plot box. I want to reduce this space so that the labels appe

[R] a small puzzle?

2010-07-12 Thread Raghu
I know the following may sound too basic but I thought the mailing list is for the benefit of all levels of people. I ran a simple if statement on two numeric vectors (news1o and s2o) which are of equal length. I have done an str on both of them for your kind perusal below. I am trying to compare t

[R] in continuation with the earlier R puzzle

2010-07-12 Thread Raghu
When I just run a for loop it works. But if I am going to run a for loop every time for large vectors I might as well use C or any other language. The reason R is powerful is becasue it can handle large vectors without each element being manipulated? Please let me know where I am wrong. for(i in 1

[R] Extract Clusters from Biclust Object

2010-07-12 Thread delfin13
Dear all, I share the problem Linda Garcia and Ram Kumar Basnet described; I have a biclust object, containing several clusters. For drawing a heatmap, it is possible to specify the cluster to be plotted. However, I'd like to extract the clusters in this manner: Cond.1 Cond.2 Gene - v

[R] Need help on date calculation

2010-07-12 Thread Daniel Murphy
If you want to use the mondate package you will need to specify the day of the month. Dates "March-2010" and "May-2010" are ambiguous. Recommend you choose last day of both months as "representative days." Then those days will be integer months apart. > a<-mondate("March 31, 2010", displayFormat="

Re: [R] [R-pkgs] New package "list" for analyzing list survey experiments

2010-07-12 Thread Spencer Graves
I encourage all authors and maintainers of packages that they use "findFn" in the "sos" package to search for other uses of a name you want to use. The "findFn" function searches for matches in the help pages of contributed packages, including all of CRAN plus some elsewhere. The "grepF

Re: [R] long to wide on larger data set

2010-07-12 Thread Matthew Dowle
Juliet, I've been corrected off list. I did not read properly that you are on 64bit. The calculation should be : 53860858 * 4 * 8 /1024^3 = 1.6GB since pointers are 8 bytes on 64bit. Also, data.table is an add-on package so I should have included : install.packages("data.table") requi

Re: [R] How to mean, min lists and numbers

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 11:19 AM, Duncan Murdoch wrote: On 12/07/2010 11:10 AM, g...@ucalgary.ca wrote: I would like to sum/mean/min a list of lists and numbers to return the related lists. -1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but sum(1,2*c(1,1,0),2,c(-1,10,-1)) returns 15 not a list.

Re: [R] print.trellis draw.in - plaintext (gmail mishap)

2010-07-12 Thread Mark Connolly
require("grid") require("lattice") fred = data.frame(x=1:5,y=runif(5)) vplayout <- function (x,y) viewport(layout.pos.row=x, layout.pos.col=y) grid.newpage() pushViewport(viewport(layout=grid.layout(2,2))) p = xyplot(y~x,fred) print( p,newpage=FALSE,draw.in=vplayout(2,2)$name) On Mon, Jul 12, 20

[R] Quantmod Error Message

2010-07-12 Thread Tyler Campbell
I am trying to create a model using the Quantmod package in R. I am using the following string of commands: > ema<-read.csv(file="ESU0 Jul 7 1 sec data.csv") > Bid=(ema$Bid) > twentysell=EMA(Bid,n=1200) > fortysell=EMA(Bid,n=2400) > sigup<-ifelse(twentysell>fortysell,1,0) > sigdn<-ifelse(twentysell

[R] Calculating Gwet's AC1 statistic

2010-07-12 Thread Pete St Marie
Hi, After searching the archives and Google and not turning up anything, I thought I'd ask here. Has anyone done an R package for calculating Gwet's AC1 statistic and variance? K.L. Gwet. Computing inter-rater reliability and its variance in the presence of high agreement. Br J Math Stat Psychol

Re: [R] How to mean, min lists and numbers

2010-07-12 Thread David Winsemius
On Jul 12, 2010, at 11:10 AM, g...@ucalgary.ca wrote: I would like to sum/mean/min a list of lists and numbers to return the related lists. You will advance in your understanding faster if you adopt the correct terminology: -1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but ... which is

Re: [R] How to mean, min lists and numbers

2010-07-12 Thread Duncan Murdoch
On 12/07/2010 11:10 AM, g...@ucalgary.ca wrote: I would like to sum/mean/min a list of lists and numbers to return the related lists. -1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but sum(1,2*c(1,1,0),2,c(-1,10,-1)) returns 15 not a list. Using the suggestions of Gabor Grothendieck, Reduce('+',l

Re: [R] make an model object (e.g. nlme) available in a user defined function (xyplot related)

2010-07-12 Thread Jun Shen
Dear Deepayan, Thank you for taking the time to look into this issue. I have a data object called "Data", please find it at the end of the message. Then I can run the code below separately in the console. #Construct the nlme object mod.nlme<-nlme(RESP~E0+(Emax-E0)*CP**gamma/(EC50**gamma+CP**gamm

[R] How to mean, min lists and numbers

2010-07-12 Thread guox
I would like to sum/mean/min a list of lists and numbers to return the related lists. -1+2*c(1,1,0)+2+c(-1,10,-1) returns c(2,13,0) but sum(1,2*c(1,1,0),2,c(-1,10,-1)) returns 15 not a list. Using the suggestions of Gabor Grothendieck, Reduce('+',list(-1,2*c(1,1,0),2,c(-1,10,-1))) returns what we

Re: [R] long to wide on larger data set

2010-07-12 Thread Matthew Dowle
Hi Juliet, Thanks for the info. It is very slow because of the == in testData[testData$V2==one_ind,] Why? Imagine someoone looks for 10 people in the phone directory. Would they search the entire phone directory for the first person's phone number, starting on page 1, looking at every single

Re: [R] long to wide on larger data set

2010-07-12 Thread jim holtman
You might want to do 'object.size' on myData to see how big it is and then if you do try to run reshape again take a look and see if there is any paging happening on your system which may be an indication that you don't have enough memory. Also with 53M observations, it may take a lot of time to d

[R] help me on discriminant analysis and Bayesian discriminant analysis in R

2010-07-12 Thread Mao Jianfeng
Dear R-listers, I have a set of plant multivariate morphological data (including thousands of individuals from several species) which may be identified as several units of morphological variation. Firstly, I want to defined the optimal number of such units Then, I want to choose proper discrimina

  1   2   >