Re: [R] Estimation of an GARCH model with conditional skewness and kurtosis

2011-02-15 Thread Yohan Chalabi
"JL" == Johannes Lips on Tue, 15 Feb 2011 16:07:50 +0100 JL> Hello, JL> JL> I'm quite new to R but tried to learn as much as possible in JL> the last JL> few months. JL> My problem is that I would like to estimate the model of Leon JL> et al. (2005). JL> I have s

Re: [R] image() with a vector

2011-02-15 Thread baptiste auguie
Hi, rasterImage may alleviate the pdf artefacts in the viewer. This seems to produce a similar output, plot(range(x),range(y), t="n") rasterImage(t(rgb(colorRamp(heat.colors(7))(z/max(z))/255)), min(x),min(y),max(x),max(y), interpolate=FALSE) HTH, baptiste On 16 February 2011 05:43, Steven Cor

Re: [R] image() with a vector

2011-02-15 Thread Dieter Menne
Steven Cordwell wrote: > > However, transforming z into a matrix with two rows, where both rows are > the same as z above does seem to be a workaround. > > z <- matrix(c(z,z),2,length(z),byrow=TRUE) > y <- c(0.25,0.75) > image(x,y,t(z),zlim=c(1,7),col=heat.colors(7),xlab="Year",ylab="Action",ya

Re: [R] image() with a vector

2011-02-15 Thread Peter Langfelder
On Tue, Feb 15, 2011 at 8:43 PM, Steven Cordwell wrote: > Hi, > > I have a vectors x and z, for example, > > x <- 0:20 > z <- round(runif(20,1,7)) > y <- 0.5 > > and I want to display z as an image. However if I then call image() with a > vector > > image(x,y,t(z),zlim=c(1,7),col=heat.colors(7),x

[R] image() with a vector

2011-02-15 Thread Steven Cordwell
Hi, I have a vectors x and z, for example, x <- 0:20 z <- round(runif(20,1,7)) y <- 0.5 and I want to display z as an image. However if I then call image() with a vector image(x,y,t(z),zlim=c(1,7),col=heat.colors(7),xlab="Year",ylab="Action",yaxt="n",xaxs="r",yaxs="r") then I get the error E

[R] Constraints in projection pursuit regression

2011-02-15 Thread Manmohan Chandraker
Hi, I am solving a projection pursuit regression problem, of the form y = \sum_i f_i (a_i^T x), where a_i are unknown directions, while f_i are unknown univariate link functions. The following is known about each f_i: 1. f_i (0) = 0  (that is, each f_i passes through the origin) 2. f_i is m

Re: [R] distance between consecutive points

2011-02-15 Thread Richard M. Heiberger
built-in and idiomatic Mod(diff(x)+1i*diff(y)) or even better Mod(diff(x+1i*y)) Rich On Tue, Feb 15, 2011 at 10:24 PM, William Dunlap wrote: > > -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Darcy Webber > > Sent: Tu

Re: [R] distance between consecutive points

2011-02-15 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Darcy Webber > Sent: Tuesday, February 15, 2011 4:10 PM > To: r-help@r-project.org > Subject: [R] distance between consecutive points > > Dear R users, > > I have two coloumns o

Re: [R] new to R: don't understand errors

2011-02-15 Thread apc3n
Did you have any other warnings going on. I had this same error and fix it because I got a bunch of words that after stemming and number removal some of my files were blank. After deleting these files I made the textmatrix fine. I think when it tries to make the dataframe there is a mismatch be

Re: [R] distance between consecutive points

2011-02-15 Thread David Winsemius
On Feb 15, 2011, at 8:22 PM, Peter Alspach wrote: Tena koe D'Arcy You might find dist() more suited to your needs. HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Darcy Webber Sent: Wednesday, 16 Febru

[R] Confidence interval of Survival Curve of Weighted Cox Regression

2011-02-15 Thread jeanneyue
Hi, May I know how to obtain the confidence interval of the survival curve of weighted Cox regression model? I tried coxph, cph, and coxphw, but they did not work. Any help would be much appreciated. Thanks, Jeanne -- View this message in context: http://r.789695.n4.nabble.com/Confidence-in

Re: [R] string parsing

2011-02-15 Thread Mike Marchywka
> To: r-h...@stat.math.ethz.ch > From: s...@gnu.org > Date: Tue, 15 Feb 2011 17:20:11 -0500 > Subject: [R] string parsing > > I am trying to get stock metadata from Yahoo finance (or maybe there is > a better source?) search this for "yahoo", http://

Re: [R] getBM in biomaRt

2011-02-15 Thread Steve Lianoglou
Hi, On Tue, Feb 15, 2011 at 5:52 PM, Du, Ruofei wrote: > I'm using 'getBM' function in Bioconductor package 'biomaRt' to retrieve gene > ids based on known chromosome locations. > > The question is getBM just only return one gene id once a time,  even a query > is mapped to multiple genes. What

[R] R Crash -- R Gui crashes during MCMC iteration

2011-02-15 Thread Haillie
Hi I am posting to seek some advice regarding the R Gui 2.12.0 that keeps freezing on my pc. I have been trying to run MCMC ordinal factanal code on my PC but the window freezes everytime after 7001 iterations (total of 25 iterations). My operating system is window vista 64-bit with 4.0 gb of

Re: [R] summary for factors is not very informative

2011-02-15 Thread Thomas Lumley
It does print frequency stats, just not all of them. The reason it doesn't print all of them is that there could be thousands of them. If you want a table, use table() -thomas On Wed, Feb 16, 2011 at 11:31 AM, Sam Steingold wrote: > summary() for a factor prints: > >     ColName >  SNDK  :

Re: [R] R-help Digest, Vol 96, Issue 17

2011-02-15 Thread Alex Oh
__ 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 commented, minimal, self-contained, reproducible code.

Re: [R] selecting columns

2011-02-15 Thread Phil Spector
Clayton - From your explanation, it sounds like you want to create a new file removing the "Location" variable, and all the variables that have the string "Ambient" or "Name" in their names. Suppose that your data frame is called mydata, and you wish to create a reduced csv file called "myda

Re: [R] distance between consecutive points

2011-02-15 Thread Peter Alspach
Tena koe D'Arcy You might find dist() more suited to your needs. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Darcy Webber > Sent: Wednesday, 16 February 2011 1:10 p.m. > To: r-help@r-project.org >

[R] summary for factors is not very informative

2011-02-15 Thread Sam Steingold
summary() for a factor prints: ColName SNDK : 72 VXX : 36 MWW : 30 ACI : 28 FRO : 28 (Other):1801 it would have been much more useful if it additionally printed frequency stats as if by summary(aggregate(frame$ColName,by=list(frame$ColName),FUN=length)$x) -- Sam St

Re: [R] help with aggregate()

2011-02-15 Thread Phil Spector
Sam - Since the error message said the argument wasn't numeric or logical, that would be the source of your problem. What is the result of class(all$Value) If it's 'character' or 'factor', that would explain the problem. Provide more details for a (most likely) easy solution.

[R] string parsing

2011-02-15 Thread Sam Steingold
I am trying to get stock metadata from Yahoo finance (or maybe there is a better source?) here is what I did so far: yahoo.url <- "http://finance.yahoo.com/d/quotes.csv?f=j1jka2&s=";; stocks <- c("IBM","NOIZ","MSFT","LNN","C","BODY","F"); # just some samples socket <- url(paste(yahoo.url,sep="",pa

Re: [R] help with aggregate()

2011-02-15 Thread Sam Steingold
> * Jan van der Laan [2011-02-15 10:09:44 +0100]: > > The fact that your column names from your aggregate result contain > multiple numbers, suggests that something has gone wrong with reading > your data in from file. Have you had a look at your data.frame 'all'? yes, the data is loaded correctl

Re: [R] help with aggregate()

2011-02-15 Thread Sam Steingold
> * Sam Steingold [2011-02-14 18:42:40 -0500]: > > byFOO$Mean <- aggregate(all$Value, by = list(all$FOO), FUN = mean)$x; this fails with There were 50 or more warnings (use warnings() to see the first 50) > warnings() Warning messages: 1: In mean.default(X[[1L]], ...) : argument is not numeric

[R] R package error

2011-02-15 Thread ycherkas
Hi, I have a package I was previously able to compile and use for R 2.6. In the newer versions of R it did not work, so I am making it from scratch using Rtools and new R version. However, I keep getting error after Rcmd build –binary mypack Here is the complete log: * checking for file ‘mypack/

[R] getBM in biomaRt

2011-02-15 Thread Du, Ruofei
I'm using 'getBM' function in Bioconductor package 'biomaRt' to retrieve gene ids based on known chromosome locations. The question is getBM just only return one gene id once a time, even a query is mapped to multiple genes. What's the criteria for picking that special one? [[alter

[R] distance between consecutive points

2011-02-15 Thread Darcy Webber
Dear R users, I have two coloumns of data, say x and y, referring to a list of points in 2D space. I am trying to develop a code that will give me the distances (using Pythagoras) between consecutive points (xi,yi) and (xi+1,yi+1). So far I have come up with the following: for (i in 1:length(x))

[R] Cannot allocate memory block

2011-02-15 Thread poisontonic
Hi, I'm using the latest version of 64-bit R for Windows: R x64 2.12.1 I'm using it because I currently need to do hierarchical clustering on a very large object (too big for MATLAB, which I normally use). When I try to cluster my distance matrix d (obtained using dist on my design matrix): hc <-

[R] selecting columns

2011-02-15 Thread Clayton Dorrity
I need help. I have very big .csv files with many unnecessary columns. From the original .csv files I would like to create a new .csv file with just the columns I need. For example: The original column heading are: Date, Time, Location, Sensor Name, Sensor Serial, Ambient Temp, IR Temp, Sensor

[R] Delta method using numerical derivatives

2011-02-15 Thread Mark Clements
Dear all, Is there a fairly general R implementation of the delta method that uses numerical derivatives? I realise that the delta method has been implemented using symbolic derivatives (e.g. alr3::delta.method, emdbook::deltamethod, msm::deltamethod and survey:::nlcon), however possibly non-lin

[R] spatstat ppm models with covariates

2011-02-15 Thread Chi Michael
Hello R users, I am fitting spatial point process models in spatstat using ppm and my models actually contain spatial covariates. The results of the models are returned with some levels of the covariates absent. eg when I fit a model with "aspect" using: ppm(points, ~aspect, covariates=list(

Re: [R] strptime format = "%H:%M:%OS6"

2011-02-15 Thread David Winsemius
Oh. So the %OS only works with format.POSIXct(), format.POXIXlt(), and strftime(), but NOT strptime()? > x <- "09:31:29.18761" > > y <- strptime(x, format = "%H:%M:%OS"); > y [1] "2011-02-15 09:31:29" > format(y, format = "%H:%M:%OS3") [1] "09:31:29.188" > strftime(y, format = "%H:%M:%OS3") [1]

Re: [R] Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX

2011-02-15 Thread Duncan Murdoch
On 15/02/2011 4:55 PM, Julia Jacobson wrote: Hello R users, Using R, Sweave and the cmsyase.afm font it is possible to write LaTeX documents including R figures with text in the Computer Modern Fonts: This is very unlikely to have anything to do with Sweave, it's a graphics system problem. Y

Re: [R] strptime format = "%H:%M:%OS6"

2011-02-15 Thread jim holtman
According to the documentation, '%OS6' is only for output, not for conversion on input. Specific to R is %OSn, which for output gives the seconds to 0 <= n <= 6 decimal places (and if %OS is not followed by a digit, it uses the setting of getOption("digits.secs"), or if that is unset, n = 3). Furt

Re: [R] Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX

2011-02-15 Thread Erik Iverson
Julia, While not a direct answer to your question, you may find the pgfSweave driver/package to be interesting. http://cran.r-project.org/web/packages/pgfSweave/ Among other things, it uses the tikzDevice package for figures, which will cause the labels and text to use the same font as in your

[R] Sweave doesn't hand on width of special characters of Computer Modern fonts to LaTeX

2011-02-15 Thread Julia Jacobson
Hello R users, Using R, Sweave and the cmsyase.afm font it is possible to write LaTeX documents including R figures with text in the Computer Modern Fonts: \documentclass{article} \usepackage{Sweave} \begin{document} <>= CM <- Type1Font("CM", c(file.path("C:/texlive/2009/texmf-dist/font

Re: [R] Cairo device won't output the PNG

2011-02-15 Thread Prof Brian Ripley
Packages like Cairo have very little to do with R and everything to do with the external software (here cairographics), and so do work quite differently on Ubuntu and Windows (and with lots of font problems on Windows). But this example works for me in that exact setup. On Tue, 15 Feb 2011, B

[R] Relationships between png resolution, axis.text$cex trellis setting, and paddings

2011-02-15 Thread Sébastien Bihorel
Dear R-users, I was wondering if somebody could shed some light on the relationships existing between the resolution of a png device, the axis.text$cex trellis setting, and the paddings of the actual graph. In the following code, I create a custom trellis theme that set (among other thing) axis.te

Re: [R] Cairo device won't output the PNG

2011-02-15 Thread Ben Bolker
Ash Pol live.com> writes: > > > Hi All, > I have been experiencing a strange issue ever since I upgraded my R and the packages. I cannot plot anything > to the CairoPNG device.For an example: Cairo(600, 600, file="plot.png", type="png", bg="white") plot(1:10) dev.off() will create an empty pl

Re: [R] Write File to Shared Drive

2011-02-15 Thread Henrik Bengtsson
FYI, you can use the following to troubleshoot what is going on: library("R.utils"); filename <- "MyFile.csv"; path <- ... # The directory where to store pathname <- Arguments$getWritablePathname(filename, path=path); or if you already have the full pathname: pathname <- Arguments$getWritablePa

Re: [R] all.equal: subscript out of bounds

2011-02-15 Thread Dimitri Liakhovitski
Sema, oni mogut ne otvetit' - narod 4asto pro eto sprashivaet. Oni inogda otve4ayut, inogda net. Tam kakie-to mudrenie ob'yasneniya. On Tue, Feb 15, 2011 at 11:40 AM, Sam Steingold wrote: > When I do >> all(all$X.Time == all$Y.Time); > [1] TRUE > as expected, but >> all.equal(all$X.Time,all$Y.Tim

Re: [R] Is there a way to force counters to be treated as "unsigned?"

2011-02-15 Thread Petr Savicky
On Mon, Feb 14, 2011 at 02:45:49PM -0800, David Wolfskill wrote: > I am acquiring some sampled data that is time-stamped (with a > POSIXct). Some of the data is in the form of "counters" -- that > is, what is interesting isn't value of a given counter at a given > time, but the change in the count

Re: [R] Testing for empty result of which

2011-02-15 Thread Richard M. Heiberger
I would use match() ?match Rich On Tue, Feb 15, 2011 at 2:11 PM, Francois Rousseu < francoisrous...@hotmail.com> wrote: > > Hello R users > > When using the function which to get matches, I usually do > > w<-which(x==y) > length(w)==0 > > to determine if there are matches or not. Is there a bas

Re: [R] Matrix of Matrices?

2011-02-15 Thread Petr Savicky
On Tue, Feb 15, 2011 at 09:40:54AM -0800, Alaios wrote: > Thank you very much for your help again. > One more question is that after I have that list of matrices what is the > easiest way to find the minimun and maximum values of ALL the matrices in > that list? Try the following. # get a li

Re: [R] Write File to Shared Drive

2011-02-15 Thread Peter Langfelder
On Tue, Feb 15, 2011 at 11:56 AM, Kevin Wright wrote: > The original poster did not say what operating system was being used.  From > my own experience on Windows, I always used "/" for reading from the local > hard drive, but when I started working with Windows network shares/folders, > I had to

Re: [R] Write File to Shared Drive

2011-02-15 Thread Kevin Wright
The original poster did not say what operating system was being used. From my own experience on Windows, I always used "/" for reading from the local hard drive, but when I started working with Windows network shares/folders, I had to switch back to "\\" due to an unknown "feature" (bug?). Kevin

Re: [R] Write File to Shared Drive

2011-02-15 Thread Peter Langfelder
On Tue, 15 Feb 2011, Stuart Jaffe wrote: > Hi, >   I'm trying to write a file to a shared drive on a network. I use the > "write.csv" function with the correct path but R doesn't recognize the > directory. Is there something different I have to do since it's a shared > drive? > Thanks. Check that

Re: [R] Write File to Shared Drive

2011-02-15 Thread Phil Spector
Stuart - In situations like this, I always recommend using file.choose, so that you can navigate to the appropriate location. For example, write.csv(mydata,file=file.choose()) will open a file browser so you can make sure the data will get written to exactly where you want it. You can also

Re: [R] Testing for empty result of which

2011-02-15 Thread Phil Spector
Francois - I think you're looking for the any function: x = c(1,2,3) y = c(4,5,6) any(x==y) [1] FALSE any(which(x==y)) [1] FALSE x = c(1,2,3) y = c(4,2,5) any(x==y) [1] TRUE any(which(x==y)) [1] TRUE - Phil Spector

Re: [R] Transforming relational data

2011-02-15 Thread Matthew Dowle
Hello. One (of many) solution might be: require(data.table) DT = data.table(read.table(textConnection("A B C 1 1 a 1999 2 1 b 1999 3 1 c 1999 4 1 d 1999 5 2 c 2001 6 2 d 2001"),head=TRUE,stringsAsFactors=FALSE)) firststep = DT[,cbind(expand.grid(B,B),v=1/length(B)),by=C][Var1!=

[R] Testing for empty result of which

2011-02-15 Thread Francois Rousseu
Hello R users When using the function which to get matches, I usually do w<-which(x==y) length(w)==0 to determine if there are matches or not. Is there a base function that can do the thing more directly by returning a logical value if the result of which is empty or not? Thanks Franco

Re: [R] strptime format = "%H:%M:%OS6"

2011-02-15 Thread David Winsemius
On Feb 15, 2011, at 11:39 AM, Sam Steingold wrote: I read a dataset with times in them, e.g., "09:31:29.18761". I then parse them: all$X.Time <- strptime(all$X.Time, format = "%H:%M:%OS6"); and get a vector of NAs (how do I check that except for a visual inspection?) then I do options("dig

Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Hadley Wickham
> You can probably do this by constructing a call to the `names<-` replacement > function, but it's really bad style.  Don't write R code that has external > side effects if you can avoid it.  In this case, you'll almost certainly get > more maintainable code by writing your function to return a co

Re: [R] txtProgressBar examples?

2011-02-15 Thread Greg Snow
When using the windows gui I prefer the winProgressBar to the txtProgressBar. It works basically the same, but does not put any characters into the terminal. (there is also tkProgressBar that works on all platforms, but requires the tcltk package). -- Gregory (Greg) L. Snow Ph.D. Statistical

[R] RPostgreSQL [Expired connection at startup]

2011-02-15 Thread Stephen Sefick
I have set up a postgresql database that I connect to each R startup in my .Rprofile file. ##relevant lines from .Rprofile library(RPostgreSQL) m <- PostgreSQL() con <- dbConnect(m, user="xxx", password="yyy", dbname="zzz") ##

Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Duncan Murdoch
On 15/02/2011 11:43 AM, John Edwards wrote: I get the following error when I try to modify the names of the object returned by get(). Does anybody know how to do so? (I could use as.vector() to remove the names, but I'm interested in how to modify the object returned by get().) You can probably

Re: [R] [[]] confusion

2011-02-15 Thread Duncan Murdoch
On 15/02/2011 11:40 AM, Sam Steingold wrote: what does the output for [[]] mean here: > all$X.Time[5] [1] "2011-02-15 09:32:26.37222" > all$X.Time[[5]] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 You didn't tell us what X.Time was, but it looks like a POSIXlt object, which is stored inte

Re: [R] Count factor if

2011-02-15 Thread David Winsemius
On Feb 15, 2011, at 12:18 PM, mathijsdevaan wrote: Thanks for your quick response. The solution that you propose comes close to what I want, however by using 'FUN = order', the new variable is based on its order rather than y< focal y. In the case of two similar rows (Xrow1=Xrow2 and Yrow

[R] all.equal: subscript out of bounds

2011-02-15 Thread Sam Steingold
When I do > all(all$X.Time == all$Y.Time); [1] TRUE as expected, but > all.equal(all$X.Time,all$Y.Time); Error in target[[i]] : subscript out of bounds why? thanks! -- Sam Steingold (http://sds.podval.org/) on CentOS release 5.3 (Final) http://mideasttruth.com http://honestreporting.com http://d

Re: [R] regex

2011-02-15 Thread zem
10x Henrique! it works great bur i need tha same with gsub, i want to replace the matched string... :/ another idea? -- View this message in context: http://r.789695.n4.nabble.com/regex-tp3306635p3307114.html Sent from the R help mailing list archive at Nabble.com. __

[R] strptime format = "%H:%M:%OS6"

2011-02-15 Thread Sam Steingold
I read a dataset with times in them, e.g., "09:31:29.18761". I then parse them: > all$X.Time <- strptime(all$X.Time, format = "%H:%M:%OS6"); and get a vector of NAs (how do I check that except for a visual inspection?) then I do > options("digits.secs"=6); > all$X.Time <- strptime(all$X.Time, forma

[R] Write File to Shared Drive

2011-02-15 Thread Stuart Jaffe
Hi, I'm trying to write a file to a shared drive on a network. I use the "write.csv" function with the correct path but R doesn't recognize the directory. Is there something different I have to do since it's a shared drive? Thanks. [[alternative HTML version deleted]]

[R] [[]] confusion

2011-02-15 Thread Sam Steingold
what does the output for [[]] mean here: > all$X.Time[5] [1] "2011-02-15 09:32:26.37222" > all$X.Time[[5]] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > all$X.Time[1] [1] "2011-02-15 09:31:29.18761" > all$X.Time[[1]] [1] 29.18761 34.30949 36.38144 12.28500 26.37222 47.00837 40.20271 32.83765 [

Re: [R] Count factor if

2011-02-15 Thread mathijsdevaan
Thanks for your quick response. The solution that you propose comes close to what I want, however by using 'FUN = order', the new variable is based on its order rather than y< focal y. In the case of two similar rows (Xrow1=Xrow2 and Yrow1=Yrow2), the value of Zrow1 < Zrow2. Any solutions? Thanks!

Re: [R] expected behavior when parsing lines with special characters

2011-02-15 Thread David Wolfskill
On Tue, Feb 15, 2011 at 12:21:18PM -0500, Robert M. Flight wrote: > Say I have a tab-delimited table I want to read into R. What should I > expect to happen if some of the entries contain the character " ' "? I > thought it would read the file fine, but that is not what happens. > Instead, all the

Re: [R] expected behavior when parsing lines with special characters

2011-02-15 Thread Peter Ehlers
On 2011-02-15 09:25, Peter Langfelder wrote: On Tue, Feb 15, 2011 at 9:21 AM, Robert M. Flight wrote: Say I have a tab-delimited table I want to read into R. What should I expect to happen if some of the entries contain the character " ' "? I thought it would read the file fine, but that is not

Re: [R] A Math question

2011-02-15 Thread JLucke
Kjetil et al, Unlike finite sums, infinite sums are not commutative. To have commutativity, one must have absolute summability, that is, the sum of the absolute values of the terms must be finite. If one has absolute summability, the infinite sum exists and is unique. This sum is not absolutel

Re: [R] R, Ubuntu, package installation with non-zero exit status

2011-02-15 Thread Stephen Sefick
Just tried this on ubuntu 10.04 (latest update) with R 2.12.1 NC repository worked like a charm. Try updating your R version? I didn't see a R-version depends on the vegetarian CRAN site, but that would be the first thing that I would do. On Mon, 2011-02-14 at 14:06 -0800, B77S wrote: > All: >

Re: [R] expected behavior when parsing lines with special characters

2011-02-15 Thread Peter Langfelder
On Tue, Feb 15, 2011 at 9:21 AM, Robert M. Flight wrote: > Say I have a tab-delimited table I want to read into R. What should I > expect to happen if some of the entries contain the character " ' "? I > thought it would read the file fine, but that is not what happens. > Instead, all the values i

Re: [R] expected behavior when parsing lines with special characters

2011-02-15 Thread jim holtman
Check out the arguments for read.table especially 'quote' you probably want quote='' to suppress the special meaning of quote. You might also need comment.char in the future. On Tue, Feb 15, 2011 at 12:21 PM, Robert M. Flight wrote: > Say I have a tab-delimited table I want to read into R. What

Re: [R] Defining functions inside loops

2011-02-15 Thread Eduardo de Oliveira Horta
Yes, that was it. Thanks a lot. Best regards, Eduardo On Tue, Feb 15, 2011 at 2:34 PM, jim holtman wrote: > The try this: > >> s <- c( 0.2, 0.45, 0.38, 0.9) >> f  <- lapply(1:10, function(i) > +     local({ > +             local_s <- s[i] > +             function(x)x^2+local_s > +           }))

[R] expected behavior when parsing lines with special characters

2011-02-15 Thread Robert M. Flight
Say I have a tab-delimited table I want to read into R. What should I expect to happen if some of the entries contain the character " ' "? I thought it would read the file fine, but that is not what happens. Instead, all the values in between two " ' "s get read into one field, and things are just

Re: [R] Error when modifying names of the object returned by get()

2011-02-15 Thread Ista Zahn
Hi John, Probably there is a more elegent solution, but I usually do something like tmp <- get("x") names(tmp) <- letters[1:10] assign("x", tmp) rm("tmp") HTH, Ista On Tue, Feb 15, 2011 at 11:43 AM, John Edwards wrote: > I get the following error when I try to modify the names of the object > r

Re: [R] Variable length datafile import problem

2011-02-15 Thread John Kane
Your example does not seem to accurately mirror your data since there are no variable column counts. If the data is not confidential, it might be a good idea to load a sample of it somewhere were list readers can get it and examine the actual file layout. [url=http://www.mediafire.com/][b]Medi

Re: [R] Variable length datafile import problem

2011-02-15 Thread jim holtman
Also look at the "flush" and "fill" arguments on read.table to see if that helps. On Tue, Feb 15, 2011 at 9:12 AM, Ingo Reinhold wrote: > Dear all, > > I am stuck the reading of a file which has 100s of rows and variable column > counts. > > The tab-limited data file looks something like: > > So

Re: [R] A Math question

2011-02-15 Thread peter dalgaard
On Feb 15, 2011, at 15:17 , David Winsemius wrote: > > On Feb 14, 2011, at 7:33 PM, Kjetil Halvorsen wrote: > >> or even better: >> >> http://mathoverflow.net/ > > I beg to differ. That is designated in its FAQ as expecting "research level > questions", while the forum I offered is labeled a

Re: [R] Variable length datafile import problem

2011-02-15 Thread Dimitri Liakhovitski
Can you try to change the extention of your file (make it a .txt or open it in Excel and save it as a .csv file) - and then read it in? Dimitri On Tue, Feb 15, 2011 at 9:12 AM, Ingo Reinhold wrote: > Dear all, > > I am stuck the reading of a file which has 100s of rows and variable column > coun

Re: [R] Count factor if

2011-02-15 Thread Henrique Dallazuanna
Try this: cbind(X, z = ave(X$y, X$x, FUN = order) - 1) On Tue, Feb 15, 2011 at 12:33 PM, mathijsdevaan wrote: > > Hi, > > I have a data frame containing two columns: > > x<-as.factor(c('a','a','a','a','a','b','b','b','c','d','d','d')) > y<-c(1,3,6,8,12,3,4,7,5,6,7,10) > X<-data.frame(x,y) > X >

[R] Error when modifying names of the object returned by get()

2011-02-15 Thread John Edwards
I get the following error when I try to modify the names of the object returned by get(). Does anybody know how to do so? (I could use as.vector() to remove the names, but I'm interested in how to modify the object returned by get().) $ cat main_get_name_assign.R x=1:10 names(x)=letters[1:10] nam

Re: [R] Defining functions inside loops

2011-02-15 Thread jim holtman
The try this: > s <- c( 0.2, 0.45, 0.38, 0.9) > f <- lapply(1:10, function(i) + local({ + local_s <- s[i] + function(x)x^2+local_s + })) > rm(s) > f[[2]](4) [1] 16.45 > On Tue, Feb 15, 2011 at 10:53 AM, Eduardo de Oliveira Horta wrote: > Thanks... but I g

Re: [R] regex

2011-02-15 Thread Henrique Dallazuanna
Try this: x <- c("AGDHA!jdbsah/dsgadg#dasdwq*dsad", "", "") grep("<.*>", x, invert = TRUE) On Tue, Feb 15, 2011 at 12:34 PM, zem wrote: > > OK I have strings like these: > > AGDHA!jdbsah/dsgadg#dasdwq*dsad > > and > > > > etc. > > the first one must be mathced and these in the <> not > -- > V

[R] Cairo device won't output the PNG

2011-02-15 Thread Ash Pol
Hi All, I have been experiencing a strange issue ever since I upgraded my R and the packages. I cannot plot anything to the CairoPNG device.For an example:> Cairo(600, 600, file="plot.png", type="png", bg="white")> plot(1:10)> dev.off()will create an empty plot.png file. I am running R 2.12.1 (

[R] Estimation of an GARCH model with conditional skewness and kurtosis

2011-02-15 Thread Johannes Lips
Hello, I'm quite new to R but tried to learn as much as possible in the last few months. My problem is that I would like to estimate the model of Leon et al. (2005). I have shortly summarised the most important equations in the following pdf file: http://hannes.fedorapeople.org/leon2005.pdf

[R] Count factor if

2011-02-15 Thread mathijsdevaan
Hi, I have a data frame containing two columns: x<-as.factor(c('a','a','a','a','a','b','b','b','c','d','d','d')) y<-c(1,3,6,8,12,3,4,7,5,6,7,10) X<-data.frame(x,y) X x y 1 a 1 2 a 3 3 a 6 4 a 8 5 a 12 6 b 3 7 b 4 8 b 7 9 c 5 10 d 6 11 d 7 12 d 10 I would like to add

Re: [R] regex

2011-02-15 Thread zem
OK I have strings like these: AGDHA!jdbsah/dsgadg#dasdwq*dsad and etc. the first one must be mathced and these in the <> not -- View this message in context: http://r.789695.n4.nabble.com/regex-tp3306635p3306858.html Sent from the R help mailing list archive at Nabble.com. __

[R] [slightly OT] predict.randomForest and type=”prob”

2011-02-15 Thread Clément Calenge
Dear all , I would like to use the function randomForest to predict the probability of relocation failure of a GPS collar as a function of several environmental variables x (both factor and numeric: slope, vegetation, etc.) on a given area. The response variable y is thus success (0)/failure(1

[R] Variable length datafile import problem

2011-02-15 Thread Ingo Reinhold
Dear all, I am stuck the reading of a file which has 100s of rows and variable column counts. The tab-limited data file looks something like: Some_Text 131231534-1191010178 Some_Taxt 131331434-2191010178 Some_Tsxt 132441334

[R] Use of panel.segments

2011-02-15 Thread Lancaster, Vicki
First I have read all the previous post on error bars & segments as well as the Lattice book by Sarkar. I am using xyplot, there are 2 panels, each panel displays the measurements from 5 matrices over time. The matrices are identified by different colors. My error bars show up in the 1st

Re: [R] Defining functions inside loops

2011-02-15 Thread Dr. Matthias Kohl
Dear Eduardo, try: f <- function(x){} s <- 0.2 body(f) <- substitute({x^2 + s}, list(s = s)) Best, Matthias On 15.02.2011 16:53, Eduardo de Oliveira Horta wrote: Thanks... but I guess I didn't make myself clear. What I was trying to do was precisely to "store" inside the function the number as

Re: [R] Defining functions inside loops

2011-02-15 Thread Eduardo de Oliveira Horta
Thanks... but I guess I didn't make myself clear. What I was trying to do was precisely to "store" inside the function the number associated to s[i] rather than the call to s[i], such that I wouldn't need to keep that object in subsequent function calls. In other words, I wanted to use lapply to g

Re: [R] ternary contour plot

2011-02-15 Thread Walmes Marques Zeviani
Colin, If your propose is to create a ternary plot with points and vectors, I think easier do this with graphics based plots instead of trellis based plots. Although, with little work you can do with trellis too. I gave you a reproducible code to put an arrow in a ternary plot. I use the funct

[R] Help with poLCA

2011-02-15 Thread David Joubert
Hello- I would appreciate help with some of the features of the poLCA package. I am validating a mental health screening instrument used in prison settings. The instrument includes 30 items in 5 categories of psychiatric symptoms. My plan is to conduct separate latent class analyses (using gend

Re: [R] Passing Arguments in a function

2011-02-15 Thread Ista Zahn
Hi Michael, On Tue, Feb 15, 2011 at 7:15 AM, Michael Pearmain wrote: > Hi All, > > I'm having some trouble assigning arguments inside a function to > produce a plot from a model > > Can anyone help me? Below I've outlined the situation and examples of > failing and working code. > > Regards > > M

[R] [slightly OT] predict.randomForest and type=”prob”

2011-02-15 Thread Clément Calenge
Dear all , I would like to use the function randomForest to predict the probability of relocation failure of a GPS collar as a function of several environmental variables x (both factor and numeric: slope, vegetation, etc.) on a given area. The response variable y is thus success (0)/failure(1

[R] Weighted least squares with constraints

2011-02-15 Thread GRANT Lewis
Hi I am attempting to convert my simple weighted regressions (produced using the weights argument in lm) to a constrained regression where the coefficients sum to 1. I understand that I can do this using solve.qp and I have spent time reading the archives to understand how this is done, but I

[R] Interpretation of p-values, coxph

2011-02-15 Thread Viki S
Hi guys, I have been testing the hypothesis for difference of survival between four different classes. The p-values provided in coxph output are confusing for me to interpret. Here is the output : sur<-coxph(Surv(SURVIV, status == 1)~factor(A)+cluster(rownames(d)), data = d, model=TRUE) Call:

Re: [R] How to compute "yaxp" and "usr" without plotting ?

2011-02-15 Thread Yves REECHT
Thank you very much Greg, This was helpful. With yaxs="r" I can easily obtain the Y-axis labels with : rg <- range(y) + 0.04 * diff(range(y)) * c(-1, 1) pt <- pretty(y) axTicks(side=2, usr=c(0, 1, rg), axp=c(min(pt), max(pt[pt <= max(rg)

Re: [R] Is there a way to force counters to be treated as "unsigned?"

2011-02-15 Thread jim holtman
This is handled simply with an AND operator. You use a mask the size of the counter: > require(bitops) > 3 - 14 [1] -11 > bitAnd(3 - 14, 0xF) [1] 5 > > On Mon, Feb 14, 2011 at 5:45 PM, David Wolfskill wrote: > I am acquiring some sampled data that is time-stamped (with a > POSIXct).  Some of t

Re: [R] txtProgressBar examples?

2011-02-15 Thread Viechtbauer Wolfgang (STAT)
Dear Mario, See: http://www.mail-archive.com/r-help@r-project.org/msg117622.html This seems to be fixed in version 2.12.1 (at least, I do not get this problem anymore). Best, Wolfgang From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On

Re: [R] Error en lm.fit NA/NaN/Inf en llamada a una función externa

2011-02-15 Thread Uwe Ligges
On 14.02.2011 16:35, agent dunham wrote: Hello, I am new with R, and I'm trying to fit a linear model, I did the following and obtein this result, can anybody help? Thanks, logdftodos7925vi<- log(dftodos7925vi) logALTURA7925<- log(dftodos7925$ALTURA7917) logtodos7925.lm<- lm (logALTURA792

Re: [R] Defining functions inside loops

2011-02-15 Thread jim holtman
You can also create a local copy of 's' in the function: > s <- c( 0.2, 0.45, 0.38, 0.9) > f <- lapply(1:10, function(i) + local({ force(i) + local_s <- s + function(x)x^2+local_s[i] + })) > rm(s) > f[[2]](4) [1] 16.45 > On Tue, Feb 15, 2011 at 12:50 AM, Ed

  1   2   >