Re: [R] what does this err mean and how to solve it? Error in file(file, ifelse(append, "a", "w"))

2010-10-06 Thread Prof Brian Ripley
On Wed, 6 Oct 2010, Peter Langfelder wrote: you should close files that you do not use anymore. the maximum number of open files is likely 4000 or so. Use close(file) before you open the next one. He/she said he did that, and as the limit on open connections is 128, that cannot be the sole ca

Re: [R] what is the "NOT IN" operator

2010-10-06 Thread Bill.Venables
Try !(group %in% C("A", ...)) A slightly cuter way is to define your own operator. > `%ni%` <- Negate(`%in%`) > letters[1:3] %ni% letters[3:5] [1] TRUE TRUE FALSE > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Emily

Re: [R] Quantile question

2010-10-06 Thread Joshua Wiley
Hi, This should do it, for details, see ?apply a <- matrix(rnorm(1),100,100) t(apply(a, 1, quantile, probs = c(.3, .5))) Basically you apply() the quantile function to each row (the 1, 2 would indicate columns) in the object 'a'. HTH, Josh On Wed, Oct 6, 2010 at 10:20 PM, Takos wrote: >

[R] Quantile question

2010-10-06 Thread Takos
Simple Question I have 100x100 matrix and I want to calculte each row's 30,50% quantile ex) a=matrix(rnorm(1),100,100) quantile(a[1,],c(0.3,0.5)) quantile(a[2,],c(0.3,0.5)) . . . . I want get results at once. so I try quantile(a[1:100,],c(0.3,0.5)) but I can get what I exactly want. How

Re: [R] DateDiff

2010-10-06 Thread Dennis Murphy
Hi: Here's a toy example: dat <- seq(as.Date('1990/05/01'), to = as.Date('1990/12/01'), by = 'week') ddf <- data.frame(datBegin = dat[-length(dat)], datEnd = dat[-1]) ddf <- transform(ddf, datDiff = datEnd - datBegin) Alternatively, if you don't want the data frame route, datDiff <- diff(dat) l

[R] evir package problem

2010-10-06 Thread norazman
Hello, i have run this program but it give me error: x<- data[,7] x [1] 24.81 11.70 13.60 24.81 15.20 8.00 8.00 24.81 14.20 10.20 24.81 18.00 [13] 3.40 8.60 24.81 6.00 8.30 24.81 6.90 4.50 4.50 24.81 15.50 24.81 [25] 18.00 out=gev(x) Error in optim(theta, negloglik, hessian = TRUE, ...

[R] Vector replace 0 elements without using a loop

2010-10-06 Thread rivercode
Hi, With a vector like: x = c (22, 23, 22.5, 0,0,24, 0, 23.2, 23.5, 0,0,0, 26) How can I replace the 0's with the previous last value without looping through the vector ? Something tells me I am missing the obvious. Thanks, Chris -- View this message in context: http://r.789695.n4.nabble.co

[R] Thanks for help

2010-10-06 Thread aquanyc
Martin, Thank you very much for posting a great reply. Cheers, Chris Bartlett __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide com

Re: [R] Loop too slow for Bid calc - BUT cannot figure out how to do with matrix

2010-10-06 Thread rivercode
Duncan and Martin, Thank you for your replies. I went with Martin's suggestion as it did not require loops and is probably the fastest...though it did take me 3 hours to figure out exactly how it was working !!! Here is what I am now using: bids = cbind(bids, timeCalc) orderBids = bids[order(

Re: [R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Joshua Wiley
On Wed, Oct 6, 2010 at 9:04 PM, Jeffrey Spies wrote: > Hi, Michael, > > When I teach/preach on R, I emphasize the language's focus on data, > both in its objects and operations. It might seems basic, but it's > fundamental to most of the features you and others have mentioned. As > a statistical p

Re: [R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Jeffrey Spies
Hi, Michael, When I teach/preach on R, I emphasize the language's focus on data, both in its objects and operations. It might seems basic, but it's fundamental to most of the features you and others have mentioned. As a statistical programming language, what we intend to do with R is often very na

Re: [R] how to change the font size of x and y axis labels?

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 11:40 PM, Hongwei Dong wrote: Dear R users, Anyone can tell me how to change the font size of X and Y axis labels in "plot" function? Thanks. ?par # cex.lab -- David. Gary __ R-help@r-project.org mailing list https://stat

Re: [R] DateDiff

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 11:07 PM, Santosh Srinivas wrote: Dear List, I have a column of dates say: test$date1 <- seq(19900511, to = 19900521) Those aren't dates. (but if they were the methods should be the same) I want the next column to have the number of days between each subsequent date

Re: [R] problem with abline

2010-10-06 Thread Dennis Murphy
Hi: See below. On Wed, Oct 6, 2010 at 2:56 PM, Gerard Smits wrote: > Hi All, > > I am running a scatter plot and trying to add a best fit line. I use an > abline function, but get no line drawn over the points. I also get no > error. I arm using V 2.10.0 on Windows 7. > > Here is my code, in

Re: [R] ggplot2 Pareto plot (Barplot in decreasing frequency)

2010-10-06 Thread Dennis Murphy
Hi: # Generate a factor and a random set of counts/frequencies df <- data.frame(gp = LETTERS[1:20], frq = rpois(20, 30)) # bar plot in lexicographic order of factor levels ggplot(df, aes(x = gp)) + geom_bar(aes(y = frq), stat = 'identity') # bar plot in increasing order of frequency ggplot(df, aes

[R] how to change the font size of x and y axis labels?

2010-10-06 Thread Hongwei Dong
Dear R users, Anyone can tell me how to change the font size of X and Y axis labels in "plot" function? Thanks. Gary [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Looking for a book/tutorial with the following context:

2010-10-06 Thread Tal Galili
Hello Alex, I recently published a post titled: "Managing a statistical analysis project – guidelines and best practices " This post might prove useful to you: http://www.r-statistics.com/2

Re: [R] Linear Integration

2010-10-06 Thread Michael Bedward
Hi Alex, > In the picture are depicted the areas that I need to calculate somehow. Of > course the easiest way would be to use some already implemented function > which does not seem to exist. That was why I posted a function to calculate polygon area in my previous reply :) Have you tried that

[R] DateDiff

2010-10-06 Thread Santosh Srinivas
Dear List, I have a column of dates say: test$date1 <- seq(19900511, to = 19900521) I want the next column to have the number of days between each subsequent date i.e days between r(i+1) and r(i) Any easy way to do this? (I've done it in a roundabout way but just wondering if there is any way m

Re: [R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Hadley Wickham
On Wed, Oct 6, 2010 at 4:05 PM, Michael Friendly wrote: >  I'm giving a talk about some aspects of language and conceptual tools for > thinking about how > to solve problems in several programming languages for statistical computing > and graphics. I'm particularly > interested in language feature

Re: [R] what is the "NOT IN" operator

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 9:03 PM, Christian Raschke wrote: Put the "!" in front of the whole expression, not just the %in% function. I.e. sub <- mydata[!(mydata$group %in% c("A", "B", "E", "G")),] You can also look at the match help page where %in% and its negation, %w/o% , are illustrated. --

Re: [R] what does this err mean and how to solve it? Error in file(file, ifelse(append, "a", "w"))

2010-10-06 Thread Peter Langfelder
you should close files that you do not use anymore. the maximum number of open files is likely 4000 or so. Use close(file) before you open the next one. Peter On Wed, Oct 6, 2010 at 4:55 PM, Yong Wang wrote: > Dear List > I am running a loop downloading  web pages and save the html to a > tempor

Re: [R] hclust with method = “ward”

2010-10-06 Thread PeterB
Thanks, Christian. This is really helpful. I was not aware of that equality, but now I can see it. I think you mean the inner sum over all distances in the distance matrix (for that cluster), which means that each distance is counted twice (which is why we divide by 2). Peter Christian Hennig

Re: [R] selected value in a vector to make bold

2010-10-06 Thread Joe P King
I am wondering, if I want the output in bold in the console, to hold in an object, can I use the expression() command? Joe King 206-913-2912 j...@joepking.com "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt -Original Message-

Re: [R] what is the "NOT IN" operator

2010-10-06 Thread Christian Raschke
Put the "!" in front of the whole expression, not just the %in% function. I.e. sub <- mydata[!(mydata$group %in% c("A", "B", "E", "G")),] Christian On Thu, 2010-10-07 at 09:17 +1000, Emily Deomano wrote: > Good day, > I need to subset a data by removing several rows. I know the %in% operator,

Re: [R] How to iterate through different arguments?

2010-10-06 Thread Gabor Grothendieck
On Wed, Oct 6, 2010 at 10:16 AM, lord12 wrote: > > Thanks a lot! I have one other question,however. If I want to have two > garchFits,  garchFit(~aparch(1,1), data = sunspot.year) and > garchFit(~arma(2,1)+apaarch(1,1), data = sunspot.year), how do I automate > the creation of these models? > > fo

[R] what is the "NOT IN" operator

2010-10-06 Thread Emily Deomano
Good day, I need to subset a data by removing several rows. I know the %in% operator, i.e. sub <- mydata[group %in% c("A","B","E","G"), ] What I need is the opposite, that is remove rows and/or columns. What is the operator for "NOT IN"? I tried (i)! %in% and (ii) ^%in% and both resulted in

Re: [R] Johnson Distribution Fit

2010-10-06 Thread Abey George
I am trying to only fit this distribution to the data to see how well it fits it. Getting the parameters is secondary. Did correct the square brackets in the exponential equation but still get the same result. There is only 1 variable to data2 and that is points. I am trying to fit this distributio

[R] what does this err mean and how to solve it? Error in file(file, ifelse(append, "a", "w"))

2010-10-06 Thread Yong Wang
Dear List I am running a loop downloading  web pages and save the html to a temporary file (use download.file() )  then read (using readLines)  it in for processing; finally write useful info from each processed page to a unique file the problem is once the loop runs up to somewhere near  5000, it

Re: [R] Multivariate Contrasts

2010-10-06 Thread Michael Friendly
On 10/6/2010 6:07 PM, Ali S wrote: Hi, I am interested in running multivariate contrasts from manova. Here is the code I have currently for a one-way Manova. I would like to run multivariate contrasts for the Year factor. Thanks! #Reduced model t14m1<-manova(as.matrix(t14c[,4:10])~t14c$Year)

Re: [R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Michael Friendly
On 10/6/2010 6:14 PM, David Winsemius wrote: Graphics: I realize you were focusing on "language" but the graphical tools are extremely important if one is describing how data exploration and summarization is done effectively. Well, I'm focusing on the language features that make it easy or

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread jim holtman
6000 pages/sec sounds very high, but if your CPU utilization is decreasing over time, this is one of the causes. The system is paging memory out and having to wait for I/O to complete and therefore is not using the CPU. What other I/O is your system doing? When you are partitioning the image, ar

Re: [R] Johnson Distribution Fit

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 7:38 PM, Abey George wrote: I am trying to only fit this distribution to the data to see how well it fits it. Getting the parameters is secondary. Did correct the square brackets in the exponential equation but still get the same result. There is only 1 variable to data2

Re: [R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Steve Lianoglou
Hi, On Wed, Oct 6, 2010 at 5:05 PM, Michael Friendly wrote: >  I'm giving a talk about some aspects of language and conceptual tools for > thinking about how > to solve problems in several programming languages for statistical computing > and graphics. For graphics, I'm guessing you'd mention so

Re: [R] problem with abline

2010-10-06 Thread Gerard Smits
Hi David, Just changed to the standard plot from xyplot and it worked fine. I'll check out panel.lmline. Thanks for your help. Gerard On Oct 6, 2010, at 3:27 PM, David Winsemius wrote: > > On Oct 6, 2010, at 5:56 PM, Gerard Smits wrote: > >> Hi All, >> >> I am running a scatter plot and

Re: [R] Display an image defined on a polar grid [SEC=UNCLASSIFIED]

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 7:08 PM, David Winsemius wrote: On Oct 6, 2010, at 6:30 PM, Justin Peter wrote: Dear R-help, I have a matrix of data values specified in polar coordinates, i.e. (r,theta). I know that I can transform this image to Cartesian coordinates and then use image to display

Re: [R] Display an image defined on a polar grid [SEC=UNCLASSIFIED]

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 6:30 PM, Justin Peter wrote: Dear R-help, I have a matrix of data values specified in polar coordinates, i.e. (r,theta). I know that I can transform this image to Cartesian coordinates and then use image to display the results, however, I want to display the image as

Re: [R] maximum matrix size if it runs with 64-bit R

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 6:08 PM, Carrie Li wrote: Thanks a lot!! Any integer is single element, Not the way I would have expressed it. An integer is a 4 byte number (range 2^31 + sign) and a double has a 8 byte floating point representation (probably specified by some IEEE designation that I

[R] Display an image defined on a polar grid [SEC=UNCLASSIFIED]

2010-10-06 Thread Justin Peter
Dear R-help, I have a matrix of data values specified in polar coordinates, i.e. (r,theta). I know that I can transform this image to Cartesian coordinates and then use image to display the results, however, I want to display the image as is, without any coordinate transformations. This would r

Re: [R] problem with abline

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 5:56 PM, Gerard Smits wrote: Hi All, I am running a scatter plot and trying to add a best fit line. I use an abline function, but get no line drawn over the points. xyplot is Lattice abline is base graphics I also get no error. I arm using V 2.10.0 on Windows 7. He

Re: [R] maximum matrix size if it runs with 64-bit R

2010-10-06 Thread Carrie Li
Thanks a lot!! Any integer is single element, whereas any number with decimal point is double element ? Is that right ? below is what I tried so, basically, simply force it to be integer would save some space ? P=1 a=rnorm(P*P)*1000 a=as.integer(a) D1=matrix(a, nrow=P) object.size(D1) >4000

[R] Multivariate Contrasts

2010-10-06 Thread Ali S
Hi, I am interested in running multivariate contrasts from manova. Here is the code I have currently for a one-way Manova. I would like to run multivariate contrasts for the Year factor.  Thanks! #Reduced model t14m1<-manova(as.matrix(t14c[,4:10])~t14c$Year) #get multivariate results summary.ma

Re: [R] How to run own R functions in JRI

2010-10-06 Thread jcress410
Sure, so, all I was saying about gedit is that it handles the R session for me, which is a neat feature but not mandatory to get the expected result, there's an rprofile.site file which describes your (user specific) preferences, you can manually edit this file to add functions at start up by d

Re: [R] ggplot2 Pareto plot (Barplot in decreasing frequency)

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 5:19 PM, Morten wrote: Hi all I have a large dataframe with (among others) a categorical variable of 52 levels and would like to create a barplot with the bars ordered in decreasing frequency of the levels. I belive it is referred to as a pareto plot. Consider a subs

Re: [R] Non-Parametric Adventures in R

2010-10-06 Thread Jamesp
Thanks for the leads. I had been looking at CrossTables for awhile, but they only seem to have one variable on each axis for each example I read. The Hmisc summary.formula looks very promising, so I will investigate it now. I think that might be the winner from looking at the examples you sugge

[R] problem with abline

2010-10-06 Thread Gerard Smits
Hi All, I am running a scatter plot and trying to add a best fit line. I use an abline function, but get no line drawn over the points. I also get no error. I arm using V 2.10.0 on Windows 7. Here is my code, including the SAS transport file import: require (foreign) require (chron) require

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread steven mosher
Thanks, haven't used valgrind in years, this should be fun. Steve On Wed, Oct 6, 2010 at 1:55 PM, Ben Bolker wrote: > steven mosher gmail.com> writes: > > > > > I know its no consolation, but I have a similar issue with R on a MAC, > also > > ploting > > out large numbers of raster layers.

Re: [R] Using as.polynomial() over a matrix

2010-10-06 Thread MacQueen, Don
That’s certainly more succinct than what I had! -Don On 10/5/10 10:35 PM, "bill.venab...@csiro.au" wrote: PS ... actually, now I think about it... > as.polylist(apply(m, 1, polynom)) List of polynomials: [[1]] 1 + 5*x + 9*x^2 + 13*x^3 [[2]] 2 + 6*x + 10*x^2 + 14*x^3 [[3]] 3 + 7*x + 11*x^2 +

[R] ggplot2 Pareto plot (Barplot in decreasing frequency)

2010-10-06 Thread Morten
Hi all I have a large dataframe with (among others) a categorical variable of 52 levels and would like to create a barplot with the bars ordered in decreasing frequency of the levels. I belive it is referred to as a pareto plot. Consider a subset where I keep only the categorical variable in qu

[R] R: Tools for thinking about data analysis and graphics

2010-10-06 Thread Michael Friendly
I'm giving a talk about some aspects of language and conceptual tools for thinking about how to solve problems in several programming languages for statistical computing and graphics. I'm particularly interested in language features that relate to: o expressive power: ease of translating what

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread Ben Bolker
steven mosher gmail.com> writes: > > I know its no consolation, but I have a similar issue with R on a MAC, also > ploting > out large numbers of raster layers. sometimes the problem lingers even > after I clear the workspace, do gc() etc. Almost as if R wont ask for > processor resources. >

Re: [R] ANOVA subject-wise means

2010-10-06 Thread Joshua Wiley
Dear Jake, An easy way to find the value of one variable by different levels of another is using by(). For example, turning to the good old mtcars data again: > by(mtcars$mpg, factor(mtcars$cyl), mean) factor(mtcars$cyl): 4 [1] 26.66364 ---

Re: [R] Does R have function/package works similar to SAS's 'PROC REG'?

2010-10-06 Thread Joshua Wiley
Hi CZ, The methods may not be the same, but you can use lm() for basic linear regression, and glm() for general linear models. Do you have a particular goal or statistical analysis in mind? Cheers, Josh On Wed, Oct 6, 2010 at 12:50 PM, CZ wrote: > > Hello, > > I am working on a variable selec

[R] ANOVA subject-wise means

2010-10-06 Thread Jake Kami
dear list, is there any function in R with which i can compute subject-wise means for a single factor level? for instance, i wanna have the mean for each subject for the first level of factor A, how can i get that? is there a straightforward way to solve this problem? kind regards jake

Re: [R] Empty data frame does not maintain column type

2010-10-06 Thread N David Brown
Thanks to all three of you for responding. Brilliant answer there, David - using the options() function as exemplified to set stringsAsFactors=FALSE universally solved the issue. Much appreciated, guys. On 6 October 2010 18:27, David Winsemius wrote: > > On Oct 6, 2010, at 1:00 PM, N David Brow

Re: [R] Converting scraped data

2010-10-06 Thread Brian Diggs
On 10/6/2010 8:52 AM, Simon Kiss wrote: Dear Colleagues, I used this code to scrape data from the URL conatined within. This code should be reproducible. require("XML") library(XML) theurl <- "http://www.queensu.ca/cora/_trends/mip_2006.htm"; tables <- readHTMLTable(theurl) n.rows <- unlist(lapp

Re: [R] Extract summary stats to table

2010-10-06 Thread nathan pellegrin
Chris, Here is an example. Please ignore the particulars of the models - they were built only to demonstrate sapply(): library(lme4) statedata <- data.frame(state.x77, state.region) #create empty list object mods <- list() #run the models, adding each one to the list mods$m1 <- glm(Income ~

Re: [R] misclassification matrix

2010-10-06 Thread Gregory Ryslik
Hi, Thanks for the help! The prop.table definitely will save some time but my question is how would you actually build the "mat" matrix. What I have now is 1000 matrices that are nx1 which have a predicted value for each of the n observations. I want to count then how many elements are really

Re: [R] Converting scraped data

2010-10-06 Thread Ethan Brown
Hi Simon, You'll notice the "test" data.frame has a whole mix of characters in the columns you're interested, including a "-" for missing values, and that the columns you're interested in are in fact factors. as.numeric(factor) returns the level of the factor, not the value of the level. (See ?le

Re: [R] How to run own R functions in JRI

2010-10-06 Thread lord12
I am still a little unsure of how I would do this. I do not want to install GEdit. Is there anyway in the retest in the included example that you can show me how I would do this? My function is: lol = function(x,y) { sum = x+y mod = sum %5 return mod } -- View this message in context:

[R] Does R have function/package works similar to SAS's 'PROC REG'?

2010-10-06 Thread CZ
Hello, I am working on a variable selection problem and I wonder whether there is some function or package in R works similar to the 'PROC REG' in SAS? Thank you. Some facts about 'PROC REG': PROC REG in SAS first composes a crossproducts matrix. The matrix can be calculated from input data,

Re: [R] RE : R getting slower until it breaks...

2010-10-06 Thread steven mosher
I know its no consolation, but I have a similar issue with R on a MAC, also ploting out large numbers of raster layers. sometimes the problem lingers even after I clear the workspace, do gc() etc. Almost as if R wont ask for processor resources. weird. On Wed, Oct 6, 2010 at 12:06 PM, Bastien F

Re: [R] Help to trafnsform data!

2010-10-06 Thread Henrique Dallazuanna
Another way: library(gsubfn) sapply(lapply(lapply(input, strapply, pattern = "\\d{2}", ~as.numeric(x), simplify = rbind), sweep, MARGIN = 2, STATS = c(1, 60, 3600), '/'), rowSums) On Wed, Oct 6, 2010 at 2:51 PM, Mehdi Zarrei wrote: > Dear R users, > > I have huge dataset lik

Re: [R] tapply output

2010-10-06 Thread Phil Spector
Geoffrey - The output you want is exactly what the aggregate() function provides: aggregate(myData$height, myData[c('class','group','name')],mean) class group namex 1 1 A Enzo 66.5 2 0 B Jane 58.5 3 1 B Mary 70.5 4 0 A Tom 62.5 It should be mentioned t

Re: [R] Help to trafnsform data!

2010-10-06 Thread Mehdi Zarrei
Hello Jim, Thanks. It works. Great. By the way, I am beginner in R. All the best, Mehdi --- On Wed, 10/6/10, jim holtman wrote: From: jim holtman Subject: Re: [R] Help to trafnsform data! To: "Mehdi Zarrei" Cc: r-help@r-project.org Date: Wednesday, October 6, 2010, 2:37 PM try this:

Re: [R] tapply output

2010-10-06 Thread Erik Iverson
Hello, You can use ddply from the very useful plyr package to do this. There must be a way using "base R" functions, but plyr is worth looking into in my opinion. > install.packages("plyr") > library(plyr) > ddply(myData, .(class, group, name), function(x) mean(x$height)) class group name V

Re: [R] tapply output

2010-10-06 Thread Henrique Dallazuanna
Try this: aggregate(height ~ class + group + name, data = myData, FUN = mean) On Wed, Oct 6, 2010 at 4:13 PM, Geoffrey Smith wrote: > Hello, I am having trouble getting the output from the tapply function > formatted so that it can be made into a nice table. Below is my question > written in R

[R] tapply output

2010-10-06 Thread Geoffrey Smith
Hello, I am having trouble getting the output from the tapply function formatted so that it can be made into a nice table. Below is my question written in R code. Does anyone have any suggestions? Thank you. Geoff #Input the data; name <- c('Tom', 'Tom', 'Jane', 'Jane', 'Enzo', 'Enzo', 'Mary',

Re: [R] selected value in a vector to make bold

2010-10-06 Thread Joe P King
oh sorry for not specifying, I want it returned in the console, another vector I can call. Joe King 206-913-2912 j...@joepking.com "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt -Original Message- From: Erik Iverson [mail

Re: [R] selected value in a vector to make bold

2010-10-06 Thread Erik Iverson
What output medium? On a graphic? In LaTeX ouput? Or do you mean in the R console? Joe P King wrote: I wasn't sure about the subject so I am sorry about the vagueness, but if I have a vector of values, how do I get a certain type of vectors to be bold or italics? So let x be a vector from

[R] RE : R getting slower until it breaks...

2010-10-06 Thread Bastien Ferland-Raymond
Thanks a lot for your quick answer. Here is my answer to your questions: Have you looked to see how fast your memory might be growing? BFR- Yes I did, it's not to bad, it's starts around 60 000ko, rise up to 120 000 at the most, so not too scary. Are you leaving around any large objects that

[R] subsets with a small cardinality for variable selection

2010-10-06 Thread CZ
Hello, I am working on a variable selection problem and would like to have some suggestions. Thank you. In my data, the number of observations/samples is much less than the number of variables. And I am not interested in generating only a few models, instead I will need a couple of hundred m

[R] selected value in a vector to make bold

2010-10-06 Thread Joe P King
I wasn't sure about the subject so I am sorry about the vagueness, but if I have a vector of values, how do I get a certain type of vectors to be bold or italics? So let x be a vector from -10 to 10, how would I tell it to bold the x values that are greater than 0? Or like absolute value of 5?

Re: [R] Assigning value to a vector from within a function

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 1:31 PM, Andrew Barr wrote: Hi all, I am having trouble assigning a value within a vector using a variable defined within a function. I suspect this has something to do with namespaces but I cannot figure it out. Please reply directly to me if you can help. ###begin co

Re: [R] Help to trafnsform data!

2010-10-06 Thread jim holtman
try this: > input <- read.table(textConnection("31;39;00N+65;40;00E T + 36;31;42N+69;04;21E T + 34;10;00N+69;41;00E T + 34;34;00N+69;06;00E T + 31;40;00N+65;44;00E T + 35;00;00N+69;07;00E T + 34;00;00N+69;53;00E T"), sep = "+", as.is = TRUE) > closeAllConnections() > result <- NULL > for (i in 1:2

Re: [R] Assigning value to a vector from within a function

2010-10-06 Thread Henrique Dallazuanna
See the replace function: index <- 3 test <- replace(test, index, 20) On Wed, Oct 6, 2010 at 2:31 PM, Andrew Barr wrote: > Hi all, > > I am having trouble assigning a value within a vector using a variable > defined within a function. I suspect this has something to do with > namespaces but I

Re: [R] Create variable by name

2010-10-06 Thread Ralf B
Hi all, I have scripts that have one variable called 'output', the script creates a data frame and stores this data frame in 'output'. Then the data frame is written to disk. This is simple when working with a single script. However, as soon as one script calls other, variables overwrite each othe

Re: [R] R getting slower until it breaks...

2010-10-06 Thread jim holtman
Have you looked to see how fast your memory might be growing? Are you leaving around any large objects that should be removed? Have you looked to see if you are paging? Is it your CPU time that is increasing, or your wall clock time? You may need to run perfmon to see what is happening. It soun

Re: [R] Assigning value to a vector from within a function

2010-10-06 Thread Peter Langfelder
> > #another simple function to update the value in a vector > update<-function(index){ > test[index]<- 20 > } > update(2) > test > #The update() function silently fails to accomplish the update Replace the '<-' by '<<-' and you'll be good to go if you call the function from a global environment.

[R] R getting slower until it breaks...

2010-10-06 Thread Bastien Ferland-Raymond
Hello R-users, I'm currently facing a pretty hard problem which I'm hopping you'll be able to help me with. I'm using R to create images. That alone is not the problem, the problem is that I'm using R to create 168 000 images... My code (which is given below) use different package (raster an

[R] Assigning value to a vector from within a function

2010-10-06 Thread Andrew Barr
Hi all, I am having trouble assigning a value within a vector using a variable defined within a function. I suspect this has something to do with namespaces but I cannot figure it out. Please reply directly to me if you can help. ###begin code #simple vector test<-c(4,5,6) #simple function to

Re: [R] How to run own R functions in JRI

2010-10-06 Thread jcress410
I think the basic answer here is "package it", which I did a couple of times but found inconvenient if I was going to change the function fairly often, i've taken a different tact, just including custom functions when R starts, i wrote a function that runs when I start the R session, loading the f

[R] Help to trafnsform data!

2010-10-06 Thread Mehdi Zarrei
Dear R users, I have huge dataset like the bellow (prepared in notepad in txt format: 31;39;00N+65;40;00E T 36;31;42N+69;04;21E T 34;10;00N+69;41;00E T 34;34;00N+69;06;00E T 31;40;00N+65;44;00E T 35;00;00N+69;07;00E T 34;00;00N+69;53;00E T These are geographical coordinates, degree minute, seco

Re: [R] ggplot2 barplot in decreasing frequency

2010-10-06 Thread Dennis Murphy
Hi: Another approach is: v1 = c(1.2, 1.4, 0.9, 1.0, 1.1, 1.0) v2 = c("aa", "cc", "bb", "bb", "cc", "bb") v3 = c(8, 10, 11, 9, 9, 10) df = data.frame(v1=v1, v2=v2, v3=v3) ggplot(df) + geom_bar(aes(x = reorder(v2, desc(v3 HTH, Dennis On Wed, Oct 6, 2010 at 2:09 AM, Morten wrote: > > Hi all,

Re: [R] misclassification matrix

2010-10-06 Thread Tom Fletcher
I think what you are looking for is ?table and/or ?prop.table So, let's say you have two matrices: ACTUAL and CLASS, you can ... table(ACTUAL, CLASS) Or, diag(1-prop.table(table(ACTUAL, CLASS), 1)) to get row percentages and take the diagonal. So, using your example: # table() as above w

Re: [R] Highly significant intercept and large standard error

2010-10-06 Thread Greg Snow
Large coefficients and large standard errors in logistic regression models can be indicative of the Hauk-Donner phenomenon. This is where the coefficient is highly significant, but the Wald Statistic is misleading because the likelihood curve is relatively flat in the area of the estimate givin

Re: [R] Looking for a book/tutorial with the following context:

2010-10-06 Thread Greg Snow
Start with "Writing R Extensions", part of the free documents that come with R. Much of what you ask is covered in there. After reading that, then you can look for the other resources. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408

Re: [R] Empty data frame does not maintain column type

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 1:00 PM, N David Brown wrote: Does anyone know why a data frame created with empty character columns converts them to integer columns? Quick answer: it's the strngsAsFactors demon but you have invoked that demon twice, Once with data.frame and the second rime with rbind.

Re: [R] Create variable by name

2010-10-06 Thread Greg Snow
Possible? Yes (as others have shown), advisable? No, see fortune(106), fortune(236), and possibly fortune(181). What is your ultimate goal? Maybe we can help you find a better way. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111

Re: [R] replaces a matrix of "NA"s in an array with the previous matrix with numbers

2010-10-06 Thread Henrique Dallazuanna
Try this: ab <- array(rnorm(3*3), dim = c(3,3,3)) ab[,,-1] <- NA ab[ , ,tail(seq(dim(ab)[3]), 2)] <- ab[, , 1] On Wed, Oct 6, 2010 at 12:49 PM, Farida Mostajabi wrote: > Dear list, > > Does anyone know if there is a function that replaces a matrix of "NA"s in > an array with the previous matrix

Re: [R] Empty data frame does not maintain column type

2010-10-06 Thread Jeffrey Spies
This should do it: df <- data.frame(a=character(0), b=character(0), stringsAsFactors=F) because: typeof(factor(0)) is "integer" while: typeof(character(0)) is "character". Cheers, Jeff. On Wed, Oct 6, 2010 at 1:00 PM, N David Brown wrote: > Does anyone know why a data frame created with

Re: [R] Looking for a book/tutorial with the following context:

2010-10-06 Thread Arun.stat
Patrick Burns has been my great source of resources in my R learnings. Most of the answers you would find from his stuffs only, see "http://www.burns-stat.com/";. However for functions and their executions/debugging related quires we might find John Chambers (http://www.springer.com/statistics/com

Re: [R] Empty data frame does not maintain column type

2010-10-06 Thread Henrique Dallazuanna
Try this: df <- data.frame(a=character(0),b=character(0), stringsAsFactors = FALSE) df[1,] <- c('a', 'a') On Wed, Oct 6, 2010 at 2:00 PM, N David Brown wrote: > Does anyone know why a data frame created with empty character columns > converts them to integer columns? > > > df<-data.frame(a=cha

Re: [R] Logical operator fails to recognize vector element

2010-10-06 Thread Phil Spector
Here's a simple example that might be instructive: x = 9.790001 y = 9.79 x [1] 9.79 y [1] 9.79 x == y [1] FALSE abs(x - y) < 1e-8 [1] TRUE all.equal(x,y) [1] TRUE And as others have said, FAQ 7.31 . - Phil Spector

Re: [R] Create variable by name

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 12:58 PM, David Winsemius wrote: On Oct 6, 2010, at 12:32 PM, Ralf B wrote: Can one create a variable through a function by name Isn't that what "<-" does? createVariable <- function(name) { outputVariable = name name <- NULL } after calling createVa

Re: [R] Adding a time variable prior to using reshape

2010-10-06 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard > Sent: Wednesday, October 06, 2010 7:22 AM > To: Henrique Dallazuanna > Cc: r-help@r-project.org; Andre Easom > Subject: Re: [R] Adding a time variable prior to us

[R] Empty data frame does not maintain column type

2010-10-06 Thread N David Brown
Does anyone know why a data frame created with empty character columns converts them to integer columns? > df<-data.frame(a=character(0),b=character(0)) > df<-rbind(df,c("a","a")) > typeof(df[1,1]) [1] "integer" AsIs doesn't help: > df<-data.frame(a=I(character(0)),b=I(character(0))) > df<-rbind

Re: [R] Create variable by name

2010-10-06 Thread David Winsemius
On Oct 6, 2010, at 12:32 PM, Ralf B wrote: Can one create a variable through a function by name Isn't that what "<-" does? createVariable <- function(name) { outputVariable = name name <- NULL } after calling createVariable("myVar") ?assign # and isn't this covered in

Re: [R] Create variable by name

2010-10-06 Thread Jeffrey Spies
An alternative to Peter's solution: createVariable <- function(name) {assign(name, NULL, envir=.GlobalEnv)} Jeff. On Wed, Oct 6, 2010 at 12:32 PM, Ralf B wrote: > Can one create a variable through a function by name > > createVariable <- function(name) { >        outputVariable = name >        

[R] How to Calculate the Pairwise LD for the given data?

2010-10-06 Thread jacki.flo
Dear all, I have the following data, which is the output from ms hudson software. segsites: 6 positions: 0.1256 0.3122 0.3218 0.4970 0.5951 0.7943 001010 110101 010100 001010 010100 I want to make R function to calculate the R-Square across pairs separated by <10% (the difference betwe

  1   2   3   >