[R] Fractional component of a number

2011-08-28 Thread edward . m
Dear all, I am happy to accept that is.integer(1) [1] FALSE But I'm having difficulty with this one: as.integer((2.53-2)*100) [1] 52 especially since: as.integer((1.53-1)*100) [1] 53 Although I know that this is a precision issue since x - (2.53-2)*100 x-53 [1] -2.131628e-14 And I can

Re: [R] Ordered probit model -marginal effects and relative importance of each predictor-

2011-08-28 Thread Mark Difford
On Aug 27, 2011 franco salerno wrote: ...problem with ordered probit model -polr function (library MASS). a) how to calculate marginal effects b) how to calculate the relative importance of each independent variables Hi Franco, Have a look at John Fox's effects package (for a), and the

Re: [R] Fractional component of a number

2011-08-28 Thread Ted Harding
On 28-Aug-11 03:59:51, edwar...@psu.ac.th wrote: Dear all, I am happy to accept that is.integer(1) [1] FALSE But I'm having difficulty with this one: as.integer((2.53-2)*100) [1] 52 especially since: as.integer((1.53-1)*100) [1] 53 Although I know that this is a precision

[R] how to get url content with ? (question mark) inside

2011-08-28 Thread Philipp Chapkovski
There is an url http://www.ozon.ru/context/detail/id/5254326/?type=6#buyalso; If I try to get the data there (by readLines or whatever), R downloads actually the content of this url http://www.ozon.ru/context/detail/id/5254326; that is till the question mark. What should I do to avoid the

[R] How to add a legend to a goodness-of-fit plot (vcd:goodfit)?

2011-08-28 Thread David Breimann
Hello, Sample code: library(vcd) dummy - rnbinom(200, size=1.5, prob=0.8) gf - goodfit(dummy, type=nbinomial, method=MinChisq) plot(gf) I would like to: 1. add a lgened stating the bars show the actual counts and the red dots - the fit. 2. show the goodness-of-fit values calculated somewhere on

Re: [R] Fractional component of a number

2011-08-28 Thread Jim Holtman
FAQ 7.31 Sent from my iPad On Aug 27, 2011, at 23:59, edwar...@psu.ac.th wrote: Dear all, I am happy to accept that is.integer(1) [1] FALSE But I'm having difficulty with this one: as.integer((2.53-2)*100) [1] 52 especially since: as.integer((1.53-1)*100) [1] 53 Although

[R] Text mining analysis methods

2011-08-28 Thread mpavlic
Hi all, i am trying to do some text mining in R. So far I managed to do some text mining like TermDocumentMatrices and word count and similiar things. What I would like to do is this : I have a soil descriptions from borehole logs that corresponds to soil classes. The problem is that some of

Re: [R] Degrees of freedom in the Ljung-Box test

2011-08-28 Thread Marcin Plociennik
I think now everything should be fine and the problem should disappear. And now about my problem. 'x' is not a set of residuals from an ARMA fit. I just have 982 weekly quotations of a given stock index and I want to run a Ljung-Box test on these data to test for autocorrelation. So 'x' would be

Re: [R] How to add a legend to a goodness-of-fit plot (vcd:goodfit)?

2011-08-28 Thread Ben Bolker
David Breimann david.breimann at gmail.com writes: Hello, Sample code: library(vcd) dummy - rnbinom(200, size=1.5, prob=0.8) gf - goodfit(dummy, type=nbinomial, method=MinChisq) plot(gf) I would like to: 1. add a lgened stating the bars show the actual counts and the red dots -

Re: [R] Asking Favor For Remove element with Particular Value In Vector

2011-08-28 Thread eyildiz
You can use 'which' and negative subscripts to remove elements from a vector. y-x[-(which(x==0|x==255))] chuan_zl wrote: Dear All. I am Chuan. I am beginner for R.I facing some problem in remove element from vector.I have a vector with size 238 element as follow(a part) [1] 0 18

[R] Help with levelplot color assignment in lattice

2011-08-28 Thread sguyader
Dear R users, I'm currently trying to make level plots of a longitudinal study of the spatio-temporal spread of a plant disease in a field, but the results of the color key assignment isn't what I expect. Here's more info. I recorded the level of a disease on an ordinal scale from 0 (no disease)

[R] read.table: deciding automatically between two colClasses values

2011-08-28 Thread Oliver Kullmann
Hello, I have a function for reading a data-frame from a file, which contains E = read.table(file = filename, header = T, colClasses = c(rep(integer,6),numeric,integer,rep(numeric,8)), ...) Now a small variation arose, where colClasses =

Re: [R] read.table: deciding automatically between two colClasses values

2011-08-28 Thread Joshua Wiley
Hi Oliver, Look at ?readLines I imagine something like: tmp - readLines(filename, n = 1L) (do stuff with the first line to decide) IntN - 6 (or 4) NumN - 8 (or whatever) E - read.table(file = filename, header = TRUE, colClasses = c(rep(integer, IntN), numeric, integer, rep(numeric, NumN)),

Re: [R] Asking Favor For Remove element with Particular Value In Vector

2011-08-28 Thread jim holtman
Be careful about negating the 'which' in case there are no matches: x - 1:10 x[-which(x == 11)] integer(0) Notice it deletes the whole vector. Safer to use logical vectors: x[!(x==3 | x == 7)] [1] 1 2 4 5 6 8 9 10 x[!(x == 11)] # notice this works [1] 1 2 3 4 5 6 7 8 9

Re: [R] Rcmdr help

2011-08-28 Thread Uwe Ligges
On 26.08.2011 23:41, Andrés Aragón wrote: Hi, please help me, I want to have a functional Rcmdr but after install as indicated in: http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html obtain the following: Loading Tcl/Tk interface ... done Loading required package: car Loading

Re: [R] Change color in forest.rma (metafor)

2011-08-28 Thread Uwe Ligges
On 26.08.2011 15:50, Paola Tellaroli wrote: I lied, that was not my last question: how can I add two arrows at the bottom with the words in favor of A / B? This is not specified in the pdf and with text I have the impression that I can't add text below the x-axis. You can, see ?par and its

Re: [R] integration

2011-08-28 Thread Uwe Ligges
On 26.08.2011 20:27, . wrote: Hi Ravi, are you saying to apply the idea of a trapezoidal method again, because I was expecting the integrate() already do it for me. Is not the case? I am also dealing with troubles related to integrate. Just to say, I tried to figure out the problem in

Re: [R] Optim function with multivariate inputs

2011-08-28 Thread Uwe Ligges
On 25.08.2011 19:02, Noah Silverman wrote: Hi, I have function that I want to optimize. Am playing with the optim() function in R Two issues: 1) I can't seem to get it to work with a function that takes multiple inputs. Dummy Example: myFunc- function(A,B,D,D){ A really dummy

Re: [R] Error: package 'lsei' is not installed for 'arch=i386'

2011-08-28 Thread Uwe Ligges
On 27.08.2011 15:51, MK wrote: Hi guys, I am having problem loading a package that I have installed. I have searched some old thread but they were no help in terms of solving the problem. I uninstalled every possible component of R and installed R 2.13 May we assume R-2.13.1 is meant here?

Re: [R] read.table: deciding automatically between two colClasses values

2011-08-28 Thread Oliver Kullmann
Hi Josh, thanks, that worked! For the record, here is a function to determine the number of strings, space-separated, in the first line of a file: # Removes leading and trailing whitespaces from string x: trim = function(x) gsub(^\\s+|\\s+$, , x) # The number of strings in the first line in the

[R] -log10 of 0

2011-08-28 Thread Ram H. Sharma
Dear R users: Sorry for this simple question: I am writing a function where I would need to pickup p values and make -log10 of it. The p values are from an anova output and sometime it can yield me 0. -log10 (0) [1] Inf I can not replace Inf with 0, which not case here. This is restricting

Re: [R] Time Series data with data every half hour

2011-08-28 Thread Uwe Ligges
On 26.08.2011 17:43, Simmons, Ryan wrote: I am working with data from the USGS with data every 30 minutes from 4/27/2011 to 8/25/2011. I am having trouble with setting the frequency. My R script is below: shavers=read.csv(shavers.csv) names(shavers) [1] agency_cdsite_no

Re: [R] Mixture of Regressions

2011-08-28 Thread Christian Hennig
I think that it should be possible to do this with the flexmix package. Christian On Fri, 26 Aug 2011, Andra Isan wrote: Dear All, I have two hidden classes for my data set that I would like to learn them based on the Mixture of Binomial regression model. I was wondering if there is any

Re: [R] -log10 of 0

2011-08-28 Thread David Winsemius
On Aug 28, 2011, at 11:37 AM, Ram H. Sharma wrote: Dear R users: Sorry for this simple question: I am writing a function where I would need to pickup p values and make -log10 of it. The p values are from an anova output and sometime it can yield me 0. -log10 (0) [1] Inf I can not replace

Re: [R] -log10 of 0

2011-08-28 Thread Ted Harding
On 28-Aug-11 15:37:06, Ram H. Sharma wrote: Dear R users: Sorry for this simple question: I am writing a function where I would need to pickup p values and make -log10 of it. The p values are from an anova output and sometime it can yield me 0. -log10 (0) [1] Inf I can not

[R] How do I get a weighted frequency table?

2011-08-28 Thread Luca Meyer
Hello, I have to run a set of crosstabulations to which I need to apply some weights. I am currently doing an unweighted version of such crosstabs using table(x,y). I am used with SPSS to create a weighting variable and to use WEIGHT BY VAR before running the CTABLES, is there a similar

Re: [R] How do I get a weighted frequency table?

2011-08-28 Thread Leandro Marino
*Luca, * you may use survey package. You have to declare the design with design function and than you can you svytotal, svyby, svymean functions to do your tabulations. Regards, Leandro Atenciosamente, Leandro Marino http://www.leandromarino.com.br (Fotógrafo)

[R] comparing two unequal matrices without for loop?

2011-08-28 Thread Paul Hammer
Dear folks, I would like to compare two unequal matrices. At the moment I realize this with two for loop and an if function but that's definitely too slow :(... Here is my code: for (i in 1:length(all_expressed_genes[,1])) { for (j in 1:length(kegg_gene_pVal[,1])) { if

Re: [R] Trying to extract probabilities in CARET (caret) package with a glmStepAIC model

2011-08-28 Thread Max Kuhn
Can you provide a reproducible example and the results of sessionInfo()? What are the levels of your classes? On Sat, Aug 27, 2011 at 10:43 PM, Jon Toledo tintin...@hotmail.com wrote: Dear developers, I have jutst started working with caret and all the nice features it offers. But I just

Re: [R] -log10 of 0

2011-08-28 Thread Ram H. Sharma
Thank you Ted and David for prompt reply. I can accept Inf but can not use for plotting, which I intend to do. May be I can add 1/(10^308), so that if something comes to 0 will be in -log10 scale be 308. Ram H On Sun, Aug 28, 2011 at 12:12 PM, Ted Harding ted.hard...@wlandres.netwrote: On

Re: [R] How download Yahoo Quote?

2011-08-28 Thread Yumin
Hi Michael: I have simplified the code only to download the sp500 index. How to correct this simple codes. -- View this message in context: http://r.789695.n4.nabble.com/How-download-Yahoo-Quote-tp3769563p3774672.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] -log10 of 0

2011-08-28 Thread peter dalgaard
On Aug 28, 2011, at 18:12 , (Ted Harding) wrote: -log10(1/(10^307)) # [1] 307 -log10(1/(10^308)) # [1] 308 -log10(1/(10^309)) # [1] Inf Note that the above forces R to compute the number before applying log10() to it. You can get a bit further with: -log10(1e-322) # [1]

Re: [R] How download Yahoo Quote?

2011-08-28 Thread R. Michael Weylandt
I have simplified the code only to download the sp500 index. Perhaps you have, but you haven't provided any of that simplified code so I'm a little skeptical. I do have to say though, if you've managed to do it more efficiently than the 12 characters in getSymbols() you are a far better coder

Re: [R] comparing two unequal matrices without for loop?

2011-08-28 Thread David Winsemius
On Aug 28, 2011, at 1:20 PM, Paul Hammer wrote: Dear folks, I would like to compare two unequal matrices. Unequal is hardly an adequate data description. At the moment I realize this with two for loop and an if function but that's definitely too slow :(... Here is my code: for (i in

Re: [R] comparing two unequal matrices without for loop?

2011-08-28 Thread William Dunlap
Look into merge() or, if you want to work at a lower level, match(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Sunday, August 28, 2011 11:07

Re: [R] Comparing skewness of two distributions

2011-08-28 Thread Timothy Bates
On Fri, Aug 26, 2011 at 10:20 AM, Benjamin Polidore polid...@gmail.com wrote: I have two distributions. Is there a statistical approach to determine if the skew of distribution 1 is similar to the skew of distribution 2? On Aug 26, 2011, at 10:07 PM, Joshua Wiley wrote: par(mfrow = c(2,

[R] cspade error

2011-08-28 Thread J Reps
Hi, I'm using the cspade function from the arulesSequences package on linux and keep getting the error: Error in makebin(data, file) : 'sid' invalid any information on how to solve this would be much appreciated. Thanks. -- View this message in context:

[R] Function won't permanently assign values to a vector

2011-08-28 Thread DimmestLemming
I'm somewhat new to R, but I've had a lot of experience in Java. I'm working on a function that takes data from a data frame, does some math and assigns the values to a vector. Pretty simple. I plan to merge the vector with the data frame when I'm done. The vector is called offense1 (there will

Re: [R] Trying to extract probabilities in CARET (caret) package with a glmStepAIC model

2011-08-28 Thread Jon Toledo
I corrected some of my syntax and changed the the glmStepAIC for glm and ti worked. I tried my command lines with the mdrr dataset (after doing the first cleaning steps as referred in the manual), the only difference is that I only took first two columns because it took too much time with one

Re: [R] Function won't permanently assign values to a vector

2011-08-28 Thread R. Michael Weylandt
Two things: It's just a guess as to what your problem is, but functions in R don't usually act on the object that is passed to them, but rather a copy thereof: if you want to keep the values calculated within the function, that's usually done with an assignment statement combined with the

Re: [R] Function won't permanently assign values to a vector

2011-08-28 Thread Daniel Malter
It will greatly help if you provide a self-contained example, as requested in the posting guide. Most of the times this will in fact lead to you figuring out your problem yourself, but if not it will greatly enhance your chances that we can help you in a meaningful, unambiguous way. Best, Daniel

Re: [R] cspade error

2011-08-28 Thread J Reps
I have a vector with entries like 1,1,2,item1,item2 or 1,2,1,item1 that I save as file_name.txt and then is transformed into a transaction by calling: data_ex - read_baskets(file_name.txt, sep=,, info= c(eventID,sequenceID,SIZE)) as the first first three parts of the entry correspond to the

Re: [R] Error: package 'lsei' is not installed for 'arch=i386'

2011-08-28 Thread Berend Hasselman
Uwe Ligges-3 wrote: On 27.08.2011 15:51, MK wrote: Hi guys, I am having problem loading a package that I have installed. I have searched some old thread but they were no help in terms of solving the problem. I uninstalled every possible component of R and installed R 2.13 May we

[R] converting matrix in array

2011-08-28 Thread marco
Hi everyone, have a small problem trying to converting a dataset in matrix form to an array. Specifically: data include 3D measurement -x,y,z of 59 points in 36 objects. They are stored as a matrix (x) of 2124 rows and 3 columns. What I want to do is to extract each subject's dataset using an

Re: [R] converting matrix in array

2011-08-28 Thread David Winsemius
On Aug 28, 2011, at 5:09 PM, marco wrote: Hi everyone, have a small problem trying to converting a dataset in matrix form to an array. Specifically: data include 3D measurement -x,y,z of 59 points in 36 objects. They are stored as a matrix (x) of 2124 rows and 3 columns. What I want to

Re: [R] converting matrix in array

2011-08-28 Thread William Dunlap
It helps to consider a small self-containd example where the correct answer is obvious. Does the following look like your input and desired output? a - rbind(c(obj1-ptA-x, obj1-ptA-y, obj1-ptA-z), +c(obj1-ptB-x, obj1-ptB-y, obj1-ptB-z), +c(obj2-ptA-x, obj2-ptA-y,

Re: [R] RODBC: sqlUpdate doesn't handle properly POSIXct field?

2011-08-28 Thread WanderingWizard
Thanks a bunch, it was driving me nuts. My experience would seem to confirm yours. Thanks to your post, I fixed a database update that was crashing my R session. I changed the data column that I was posting from a POSIXct to a Date, and now the data goes in. That works fine for me since my

[R] R question: generating data using MASS

2011-08-28 Thread uf_mike
Hi, all! I'm new to R but need to use it to solve a little problem I'm having with a paper I'm writing. The question has a few components and I'd appreciate guidance on any of them. 1. The most essential thing is that I need to generate some multivariate normal data on a restricted integer range

[R] parallel rbind

2011-08-28 Thread Steven Bauer
As I am sitting here waiting for some R scripts to run...I was wondering... is there any way to parallelize rbind in R? I wait for this call to complete frequently as I deal with large amounts of data. do.call(rbind, LIST) __ R-help@r-project.org

Re: [R] parallel rbind

2011-08-28 Thread jim holtman
What exactly do you mean by parallelize? What is wrong with the approach that you are using now? What is a large amount of data? Can you give some specifics on the problem you are trying to solve and why your present approach does not appear to be working? What are your expectations of a

Re: [R] Help with levelplot color assignment in lattice

2011-08-28 Thread Duncan Mackay
Hi If you change the NA to a value either below or above the range of values you can then use it. Below is something that is cobbled together from some code I have. The datacols argument may be necessary if you want to do something fancy like I was doing I used my own colours to see if all

Re: [R] parallel rbind

2011-08-28 Thread William Dunlap
If you know much about what the elements of LIST look like you can speed things up by not making R figure out what you already know. E.g., if you know that LIST consists of p numeric vectors, all of the same length, n, then the following might be faster matrix(unlist(LIST, use.names=FALSE),

Re: [R] parallel rbind

2011-08-28 Thread William Dunlap
Oops, I mixed up rbind and cbind. If LIST consists of n numeric vectors, each of length p, try matrix(unlilst(LIST, use.names=FALSE), nrow=n, byrow=TRUE) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: William Dunlap Sent: Sunday, August 28, 2011