Re: [R] foreign package read.spss() and NA levels

2021-06-08 Thread Allen, Justin
ut the problem was in the dataset as I said. Many Thanks, Justin Justin Allen Housing Consultant, BRE<https://bregroup.com/> T: 07807122647 From: Uwe Ligges Sent: 04 June 2021 10:57 To: Allen, Justin ; R-help@r-project.org Cc: Whiteley, Jonathon ; Foster, H

[R] foreign package read.spss() and NA levels

2021-05-27 Thread Allen, Justin
months ago. None of the arguments in read.spss() seem to also stop this behaviour. I am currently on the most recent version of both R and the package, as of 27/05/21, and am using RStudio Version 1.4.1106. Any thoughts? Many Thanks, Justin Allen p.s. your continued maintenance and additions to

[R] Opportunities for Developing R Packages (Research-Based, Open-Source)

2019-04-22 Thread Justin Thong
earch internship in experimental design, linear algebra and data compression, particle filters and bayes analyses). I do not expect to be paid and am willing to commit to a project. Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +4479386744

[R] igraph problem

2017-09-19 Thread Justin Thong
tex names) or some index of each individual branch in tree. Does anyone have any ideas on how to do this? Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419 <07938%20674419>(UK) or +60125056192 <+60%201

[R] rmutil parameters for Pareto distribution

2017-08-24 Thread Justin Thong
wikipedia link? Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or +60125056192(Malaysia)* [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To

[R] Kernel Density Estimation: Generate a sample from Epanechnikov Kernel

2017-03-21 Thread Justin Thong
I am however interested in generating a kernel density estimate with an Epanechnikov kernel fit<-density(data,kernel = "epanechnikov") #is there a quick way to compute the samples and INCORPORATING THE BANDWIDTH of the #kernel density estimate Yours sincerely, Justin *I check my ema

[R] Hmisc::latex and the use of \phantom

2016-10-29 Thread Justin Bem
Dear all, Is it possible to avoid the use of \phantom with latex function ? when I run latex(latex=FALSE,…) I get an error message. When I use Format(big.mark= ‘’ ‘’) the result appear correct in R console but not in Latex code. Is it a way to combine numprint with latex ? col.just= ‘n{#}{

Re: [R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Justin Peter
would extend to using my mask function. Anyway, thanks again for both of your help. Cheers, Justin -- Justin Peter Research Fellow International Centre for Applied Climate Sciences, University of Southern Queensland West St, Toowoomba, QLD, 4350 Australia Email: justin.pe...@usq.

[R] Using apply on a three dimensional matrix and passing multiple arguments to user defined function

2016-09-07 Thread Justin Peter
ssing? Thanks in advance for you help. Kind regards, Justin -- Justin Peter Research Fellow International Centre for Applied Climate Sciences, University of Southern Queensland West St, Toowoomba, QLD, 4350 Australia Email: justin.pe...@usq.edu.au<mailto:justin.pe...@usq.edu.au> Ph: +61

Re: [R] Estimated Effects Not Balanced

2016-08-23 Thread Justin Thong
data.frame(A=factor(c(1,1,1,1,1,1,2,2,2,2,2,2)), > > + B=factor(c(1,1,2,2,3,3,1,1,2,2,3,3)), > > + y=rnorm(12)) > >> mod <- aov(y ~ A+B, data=tmp) > >> summary(mod) > > Df Sum Sq Mean Sq F value Pr(>F) > > A1 1.553 1.553 1.

[R] Estimated Effects Not Balanced

2016-08-22 Thread Justin Thong
= y ~ A + B)* *Terms:* *A B Residuals* *Sum of Squares 0.872572 0.025604 16.805706* *Deg. of Freedom 1 210* *Residual standard error: 1.296368* *Estimated effects may be unbalanced* -- Yours sincerely, Justin *I check my email at 9AM and 4PM eve

[R] Intercept in Model Matrix (Parameters not what I expected)

2016-08-21 Thread Justin Thong
6 1 1 0 0 0 1 0 0 7 1 1 0 0 0 0 0 1 8 1 1 0 0 0 0 0 1 -- Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(

[R] RJDBC - Java connection to Oracle database crashing on execution

2016-08-19 Thread Justin Holder
Hi, I have a script that starts with some code to open a connection to an Oracle database, however the code is crashing R/RStudio as soon as it runs. The code does run successfully on another machine. The script opens by loading the required RJDBC package: library("RJDBC", lib.loc="C:/Program

[R] What is "args" in this function?

2016-08-02 Thread Justin Thong
[(5,6)] etc Is this correct? I am sorry if I am asking too many questions on C. Please advise if I am posting inappropriately. -- Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or +601

[R] Ways to understand C code (like debug function)

2016-08-01 Thread Justin Thong
erstand the commands in C that anyone knows about.* -- Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or +60125056192(Malaysia)* [[alternative HTML version deleted]] __

Re: [R] Reference for aov()

2016-07-27 Thread Justin Thong
o > error strata becomes nonsensical otherwise. If you do have a balanced > design, the error strata reduce to simple combinations of means and > observation, so the aov() algorithm is quite inefficient, but to my > knowledge nobody has bothered to try and do better. > > -pd > > &

[R] Linear Dependance of Model Matrix and How Fitted/ Sums of Squares Follow

2016-07-26 Thread Justin Thong
test3)* Df Sum Sq Mean Sq F value Pr(>F) F1 0.0479 0.0479 0.059 0.830 G2 0.9762 0.4881 0.604 0.624 Residuals 2 1.6175 0.8087 -- Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me

[R] Soft Question: Where to find this reference.

2016-07-25 Thread Justin Thong
erely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or +60125056192(Malaysia)* [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] Missing rows anova

2016-07-20 Thread Justin Thong
. Does this makes sense? On 19 July 2016 at 16:19, Michael Dewey wrote: > Presumably it disappears because there is a unique value of ID for eac > combination of S*x1 so they are indistinguishable. > > > On 19/07/2016 12:53, Justin Thong wrote: > >> Why does the S:

[R] Missing rows anova

2016-07-19 Thread Justin Thong
0 DEF 162 3 0 DEF 163 3 0 DEF 164 3 0 DEF -- Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or +60125056192(Malaysia)* [[alternative HTML version dele

[R] Reference for aov()

2016-07-13 Thread Justin Thong
finding out about how R computes ~x1:x2:x3 or how R computes ~A:x1 emphasizing sequential nature of the way it computes, and models even more complicated than this. Yours sincerely, Justin *I check my email at 9AM and 4PM everyday* *If you have an EMERGENCY, contact me at +447938674419(UK) or

[R] General copula model with heterogeneous marginals

2015-11-30 Thread Justin Balthrop
I am looking to model the sum of a number of random variables with arbitrary gamma distributions and an empirical dependence structure that I obtain from data. Basically I observe all of the individual pieces but I want to model their sum, as opposed to many copula questions which observ

[R] Limiting state probability for Markov chain

2015-04-28 Thread Justin USHIZE RUTIKANGA
(b %*% x == b) { : the condition has length > 1 and only the first element will be used your help will be appreciate Best Regard Ushize Rutikanga Justin Student at African Institute for Mathematical Sciences (AIMS) South Africa E-mail:justinush...@aims.ac.za Tel:+27717029144

[R] Awaiting feedback/moderation (Re: Non-convergence in boot.stepAIC function with a logit model)

2014-05-26 Thread Justin Michell
Hi I posted a question to this list, and received an email indicating that it is awaiting moderation. However I have not received any feedback yet. If the question is not appropriate, I’d like to know where or how I should post differently, if possible. Thanks and Regards Justin Michell

[R] Non-convergence in boot.stepAIC function with a logit model

2014-05-22 Thread Justin Michell
(Pos/Examind ~ bio13 + bio15 + bio2 + bio3 + DstTClW + bio4 + NDVI + bio5 + bio9 + bio10 + bio14, weights = Examind, data = spatialVars, family="binomial") bootGLM.5 <- boot.stepAIC(fit.5, spatialVars, direction = "forward", alpha = 0.05, B = 1000) Thanks very much

Re: [R] Maintaining data order in factanal with missing data

2013-07-26 Thread Justin Delahunty
se is available ($dmid) which I had thought to use when merging the new variables, however I don't know how to implement this. Thanks for your help, Justin -Original Message- From: PIKAL Petr [mailto:petr.pi...@precheza.cz] Sent: Friday, 26 July 2013 10:59 PM To: Justin Delahunty;

Re: [R] Maintaining data order in factanal with missing data

2013-07-26 Thread Justin Delahunty
subset the overall data set into the three waves, then conduct the factor analysis on each (1 factor CFA); it's just in a function to ease re-typing in a new workspace. Thanks, Justin -Original Message- From: PIKAL Petr [mailto:petr.pi...@precheza.cz] Sent: Friday, 26 July 2013 7:35

[R] R CMD check package "mypkg-Ex.R" failed

2013-05-31 Thread Justin
imple examples of the most important functions ~~ Error: unexpected symbol in "~~ simple examples" Execution halted My question: How to correct the above error? Thanks, Justin [[alternative HTML version deleted]] __ R-help@r-project.o

[R] Getting a vector result from a computed index

2013-03-22 Thread Justin Long
Greetings, I confess to being new to R, which I am exploring for some simulation modeling purposes. I am a long time programmer in PHP. I am having some trouble getting over the "steep learning curve" with some very basic things which are probably just little "a-ha" things in R. I have hunted and

[R] two phases sampling

2013-01-10 Thread justin bem
or is y=y1+y2. So the variance of y is v(y)=v(y1)+v(y2)+cov(y1,y2). Sampling theory indicate how to compute v(y1) and v(y2) but how can I compute cov(y1,y2) ? Can the survey package help me for that ?   Justin BEM BP 1917 Yaoundé Tél (237) 76043774 [[alternative HTML version de

Re: [R] How do anova() and Anova(type="III") handle incomplete designs?

2012-06-18 Thread Justin Montemarano
ikely comparable, considering your response. I am still confused about interpretation of interactions within an anova() with an incomplete design, as mine is. Is the interaction term still informative? - Justin Montemarano Graduate Student Kent State University - Biological Sciences

[R] How do anova() and Anova(type="III") handle incomplete designs?

2012-06-15 Thread Justin Montemarano
f.species 2.783 2 2.0738 0.12877 day:cond.time0.805 1 1.1994 0.27493 leaf.species:cond.time 0.568 1 0.8462 0.35888 day:leaf.species:cond.time 1.915 1 2.8539 0.09293 Residuals 118.091 176 >

[R] Violation of sample independence in Pearson's product-moment correlation

2012-06-01 Thread Justin Montemarano
e for Pearson's test, and I should have had only 7 points, which would reflect the means of my two variables for each individual animal across 10 days. Is this appropriate or is there a means of accounting for repeated sampling with a correlation test? - Justin Montemarano Graduate Student

[R] [R-pkgs] ANN: bigml package for R bigml_0.1.tar.gz

2012-05-09 Thread Justin Donaldson
he bigml package enables the > R community to easily take advantage of our highly scalable cloud based > machine learning infrastructure, while using familiar R data structures and > workflows. Apologies for sending this e-mail a bit late. Best, -Justin -- blog: http://www.scwn.net aim

[R] Deleting observations from baseline that don't appear in follow up

2012-04-27 Thread justin jarvis
an equal number of rows once again. Obviously baseline<-baseline[-2,] won't cut it here, since in my data set I have thousands of people. Thanks in advance Justin [[alternative HTML version deleted]] __ R-help@r-project.org mailing li

Re: [R] system command to a specific shell (bash)

2012-04-16 Thread Justin Haynes
d: OO#.. Playing > Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity

[R] system command to a specific shell (bash)

2012-04-16 Thread Justin Haynes
sn't a recognized command in the sh shell... Any help is appreciated, Justin > sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF

Re: [R] A little exercise in R!

2012-04-13 Thread Justin Haynes
Since I thought this was a cool question, I posted it to StackOverflow. Vincent Zookynd's answer is amazing and really exercises the power of R. http://stackoverflow.com/questions/10150161/ordering-117-by-perfect-square-pairs/10150797#10150797 On Fri, Apr 13, 2012 at 10:06 PM, Bert Gunter wr

Re: [R] A little exercise in R!

2012-04-13 Thread Justin Haynes
I thought this was kinda cool! Here's my solution, its not robust or probably efficient I'd to hear improvements or other solutions! Justin sq.test <- function(a, b) { ## test for number pairs that sum to squares. sqrt(sum(a, b)) == floor(sqrt(sum(a, b))) } ok.pairs

Re: [R] Remove carriage return in writing tab-delimited file.

2012-04-04 Thread Justin Haynes
take a look at ?paste paste(yourmatrix, sep='\t', collapse='') On Wed, Apr 4, 2012 at 2:58 PM, kickout wrote: > Having problems with the write.table function. I can write a tab delimited > file just fine, but for each line in my matrix its inputs a carriage return > when i dont want it to. > > F

Re: [R] sampling rows from a list

2012-04-02 Thread Justin Haynes
ast step, so if i missed i apologize... Hope that helps, Justin On Mon, Apr 2, 2012 at 11:24 AM, Bcampbell99 wrote: > Hi: > > I'm sure this seems like a rudimentary question, but I am not well versed > with R syntax for lists.  I have a ragged array from which I've removed &g

Re: [R] list assignment syntax?

2012-03-30 Thread Justin Haynes
You can also take a look at http://stackoverflow.com/questions/7519790/assign-multiple-new-variables-in-a-single-line-in-r which has some additional solutions. On Fri, Mar 30, 2012 at 4:49 PM, Peter Ehlers wrote: > On 2012-03-30 15:40, ivo welch wrote: >> >> Dear R wizards:  is there a clean

Re: [R] how to match exact phrase using gsub (or similar function)

2012-03-28 Thread Justin Haynes
> > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of Justin Haynes >> Sent: Wednesday, March 28, 2012 1:24 PM >> To: Markus Weisner >> Cc: r-help@r-project.org >> Subject:

Re: [R] how to match exact phrase using gsub (or similar function)

2012-03-28 Thread Justin Haynes
In most regexs the carrot( ^ ) signifies the start of a line and the dollar sign ( $ ) signifies the end. gsub('^S S', 'S', a) gsub('^S S', 'S', '3421 BIGS St') you can use logical or inside your pattern too: gsub('^S S|S S$| S S ', 'S', a) the " S S " condition is difficult. gsub('^S S|S S$|

Re: [R] Why does this work? plyr within-subset normalization

2012-03-28 Thread Justin Haynes
To those without access to nabble, the code in reference is: relative <- ddply(ranktable, .(Timestamp), function(x) data.frame(relative = x[,5]/max(x[,5]))) I may be misunderstanding your question, but: ddply splits your data.frame, ranktable, by the column Timestamp into many smaller data.fram

Re: [R] scanning data into r

2012-03-28 Thread Justin Haynes
What have you tried? What type of file are you trying to import from? What do you want your data to look like in R? take a look at ?read.table and ?readLines On Wed, Mar 28, 2012 at 11:23 AM, joel.green wrote: > Hey > > I am having trouble importing data into R, my data field looks like this

Re: [R] Convert day of year back into a date format.

2012-03-27 Thread Justin Haynes
There may very well be a better solution, but this works. format(strptime(dayofyear, format="%j"), format="%m-%d") On Tue, Mar 27, 2012 at 11:12 AM, Sam Albers wrote: > Hello, > > I am having trouble figuring out how to convert a Day of Year integer > back into a Date format. For example I have

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
reproducible code request prompted me to discover my error; thanks all. - Justin Montemarano Graduate Student Kent State University - Biological Sciences http://www.montegraphia.com On Wed, Mar 21, 2012 at 12:42 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > You'l

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
, panel.grid.minor = theme_blank()) Is there anything odd about it that might be producing the odd ordering problem? FYI, avoiding subsetting ag.tab doesn't do the trick. - Justin Montemarano Graduate Student Kent State University - Biological Sciences http://www.montegraphia.com On Wed, Mar 21,

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
27;m sorry if I wasn't clear and/or I've missed your message. - Justin Montemarano Graduate Student Kent State University - Biological Sciences http://www.montegraphia.com [[alternative HTML version deleted]] __ R-help@r-project.or

Re: [R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
Actually I've try that too, Sarah The test is to run order(levels(total.density)), which I need to be 1 2 3, not 2 3 1, and your solution still gives me 2 3 1. I also don't know how to reply to this thread with the previous message below... - Justin Montemarano Graduate Student

[R] Unable to specify order of a factor

2012-03-21 Thread Justin Montemarano
32,32,32,32,32,32,32,32,32,32,32,32) I'm running R 2.14.2 with all packages up-to-date as of 21.3.2012. Any help would be greatly appreciated. - Justin Montemarano Graduate Student Kent State University - Biological Sciences http://www.montegraphia.com [[alternative HTML version dele

Re: [R] GPS handling libraries or (String manipulation)

2012-03-07 Thread Justin Haynes
Wow... that is WAY better! Thanks Gabor! On Wed, Mar 7, 2012 at 8:51 AM, Gabor Grothendieck wrote: > On Wed, Mar 7, 2012 at 11:28 AM, Alaios wrote: >> Dear all, >> I would like to ask you if R has a library that can work with different GPS >> formats >> >> For example >> I have a string of thi

Re: [R] GPS handling libraries or (String manipulation)

2012-03-07 Thread Justin Haynes
Take a look at: http://cran.r-project.org/web/views/Spatial.html But I've always just parsed the string... This is from the last time I did this, its not quite the same but you can see the similarities. ## if data is presented as 43°02'46.60059" N need to split on the ° symbol, ' and ". to.deci

Re: [R] logical to vector?

2012-03-07 Thread Justin Haynes
?as.numeric > as.numeric(c(TRUE, FALSE)) [1] 1 0 On Wed, Mar 7, 2012 at 8:02 AM, Ed Siefker wrote: > I am trying to use the coXpress function from > the coXpress package.  This function requires > numerical vectors indicating which columns > are in which group. > > The problem is, I can only fi

Re: [R] Remove a word from a character vector value XXXX

2012-03-07 Thread Justin Haynes
e trick. hope that helps, Justin On Wed, Mar 7, 2012 at 8:03 AM, Dan Abner wrote: > Hi everyone, > > What is the easiest way to remove the word Average and strip leading > and trailing blanks from the character vector (d5.Region) below? > > .nrow.d5.           d5.Regi

Re: [R] regular expression

2012-02-29 Thread Justin Haynes
; " STATUS(0=alive, 1=dead): 1" > lapply(strsplit(x,';'),'[',2) [[1]] [1] " Surv(months): 21" But i would follow David's second suggestion and just read them in with sep=';' instead. Justin On Wed, Feb 29, 2012 at 11:24 AM, F

Re: [R] Problem building up ggplot graph in a loop.

2012-02-16 Thread Justin Haynes
ue, colour=variable)) + geom_line() + ylab('Total Chargeoffs') this is untested since there is no sample data! Justin On Thu, Feb 16, 2012 at 2:50 PM, Keith Weintraub wrote: > Folks, > I want to automate some graphing using ggplot. > > Here is my code > graph

Re: [R] Change dataframe-structure

2012-02-13 Thread Justin Haynes
There is probably a more ellegant way, but: > df <- data.frame(p1=c(1,2,1),p2=c(3,3,2),p3=c(2,1,3),p4=c(5,6,4),p5=c(4,4,6),p6=c(6,5,5)) > as.data.frame(t(apply(df,1,function(x) names(x)[match(1:6,x)]))) V1 V2 V3 V4 V5 V6 1 p1 p3 p2 p5 p4 p6 2 p3 p1 p2 p5 p6 p4 3 p1 p2 p3 p4 p6 p5 > On Mon, Feb

Re: [R] debug in a loop

2012-02-10 Thread Justin Haynes
You can add if(is.na(tab[i])) browser() or if(is.na(tab[i])) break see inline On Fri, Feb 10, 2012 at 7:22 AM, ikuzar wrote: > Hi, > > I'd like to debug in a loop (using debug() and browser() etc but not > print() > ). I'am looking for the first occurence of NA. > For instance: > > tab = c(1

[R] Force printing of excluded axis annotations

2012-02-08 Thread Justin Fincher
Howdy, This should be simple, but I am finding that I can't find a simple solution. I have a plot to which I am manually adding the annotations to the y-axis with this command: axis(2, c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),labels=c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),cex.axis=8) The issue is that, apparen

Re: [R] Memory allocation problem (again!)

2012-02-08 Thread Justin Haynes
32 bit windows has a memory limit of 2GB. Upgrading to a computer thats less than 10 years old is the best path. But short of that, if you're just generating random data, why not do it in two or more pieces and combine them later? mat.1 <- matrix(rnorm(5*2000),nrow=5) mat.2 <- matrix(rno

Re: [R] Help need

2012-02-07 Thread Justin Haynes
Instead of a for loop, why not use the vectorization inherent in R? sigmasqaured <- 1 i <- complex(real = 0, imaginary =1) f <- seq(0,0.5,0.1) spectrum <- (sigmasqaured)/(abs(1-2.7607*exp(2*pi*i*f)+3.8106*exp(4*pi*i*f)-2.6535*exp(6*pi*i*f)+0.9258*exp(8*pi*i*f))^2) > spectrum [1] 9.632720e+00 1.4

Re: [R] I bet apply has a solution

2012-02-06 Thread Justin Haynes
How bout: apply(Data..,1, function(vec) !all(vec==vec[1])) [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE On Mon, Feb 6, 2012 at 10:34 AM, LCOG1 wrote: > Hi all > For the data below, I would like to return a logical value indicating > differences in the data. > > #Create da

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

2012-02-02 Thread justin jarvis
log(0) which is an error. Thus, I need to stay in the log scale, since, for z less than 10 sd below the mean, log(pnorm(z)) is an error, and pnorm(z,log.p=TRUE) is stable even though theoretically they are equivalent. Thanks for your time Justin [[alternative HTML

[R] Summary.formula question

2012-02-02 Thread justin bem
sible to add a marginal column ?  Sincerly   Justin BEM BP 1917 Yaoundé Tél (237) 76043774 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gu

Re: [R] drop columns whose rows are all 0

2012-01-24 Thread Justin Haynes
> dataset<-data.frame(a=1:10,b=c(0,0,0,1,0,0,0,0,1,0),c=rep(0,10)) > apply(dataset,2,function(x) all(x==0)) a b c FALSE FALSE TRUE > dataset[,!apply(dataset,2,function(x) all(x==0))] a b 1 1 0 2 2 0 3 3 0 4 4 1 5 5 0 6 6 0 7 7 0 8 8 0 9 9 1 10 10 0 On Tue, Ja

Re: [R] Select elements from text

2012-01-24 Thread Justin Haynes
) > grepl('\\[[9-z]+\\]',x) [1] FALSE TRUE FALSE FALSE FALSE TRUE > x[grepl('\\[[9-z]+\\]',x)] [1] "[bracket]" "[bar]" You might need a more complex reg-ex to catch them all incase of ([citation]) instances for example. Justin On Tue, Jan 24, 2012 at 6:52

Re: [R] How can I access information stored after I run a command in R?

2012-01-23 Thread Justin Haynes
?str tells you about the object. str(MAX3(a,'asy',1)) from that you can see the names of the various parts including p.value. foo <- MAX3(a,'asy',1)$p.value On Mon, Jan 23, 2012 at 9:32 AM, Tiago V. Pereira wrote: > Dear all, > > Supposed I run the following command: > >

Re: [R] Stacked barchart in ggplot (or other library)

2012-01-20 Thread Justin Haynes
to use ggplot: dat<-data.frame(num=1:3,usage=c(4,2,5),cap=c(10,20,10),diff=c(6,18,5)) dat.melt<-melt(dat,id.var=c('num','cap')) ggplot(dat.melt)+geom_bar(aes(x=num,y=value,fill=variable),stat='identity') On Fri, Jan 20, 2012 at 12:30 PM, Jean V Adams wrote: > Bart6114 wrote on 01/20/2012 08:

Re: [R] colored outliers

2012-01-20 Thread Justin Haynes
sorry for the confusion. however, in the future please provide a reproducible data set along with your question so we can more easily help. Justin On Fri, Jan 20, 2012 at 5:49 AM, Geophagus wrote: > Dear Petr and Justin, > my problem ist, that I only want to have the 4 highest values

Re: [R] Establishing groups using something other than ifelse()

2012-01-19 Thread Justin Haynes
how bout levels(df$z)[grep('A',levels(df$z))] <- 'A' levels(df$z)[grep('B',levels(df$z))] <- 'B' levels(df$z)[grep('C',levels(df$z))] <- 'C' does that do what you're wanting? On Thu, Jan 19, 2012 at 3:05 PM, Sam Albers wrote: > Hello all, > > This is one of those "Is there a better way to do t

[R] png output on a server?

2012-01-18 Thread Justin Haynes
experience with CairoPNG and making it look like the base png function, id love to hear what you've learned! Thanks, Justin > capabilities() jpeg png tifftcltk X11 aqua http/ftp sockets libxml fifo clediticonv NLS profmem FALSEFALSE

Re: [R] Add color to Boxplot by value

2012-01-12 Thread Justin Haynes
how bout: dat<-data.frame(val=rnorm(100,12,10),x=letters[1:4]) col.val<-ddply(dat,.(x),summarise,mean(val)) col.val$breaks<-cut(col.val$..1,c(0,9,15,Inf)) dat.merge<-merge(dat,col.val) ggplot(dat.merge,aes(x=x,y=val,colour=breaks))+geom_boxplot()+scale_color_manual(values=c('green','yellow','red')

Re: [R] relative frequency plot using ggplot or other function

2012-01-12 Thread Justin Haynes
disregard the legends of the > following fig. > > > http://had.co.nz/ggplot2/graphics/55078149a733dd1a0b42a57faf847036.png > > http://had.co.nz/ggplot2/graphics/90983232ced45a93d9fbbe40afffd69a.png > > Thanks > > On Thu, Jan 12, 2012 at 12:13 PM, Justin Haynes wrote:

Re: [R] relative frequency plot using ggplot or other function

2012-01-12 Thread Justin Haynes
On Thu 12 Jan 2012 09:02:27 AM PST, Mary Kindall wrote: Hi I have a data frame in the following form. There are two groups and for each 'width' relative frequency for group1 and group2 is given. How to plot this in R using ggplot or other package. Width relativeFrequency1 relativeFreq

Re: [R] Points inside a polygon

2012-01-12 Thread Justin Haynes
ks! -- H Check out the splancs package. particularly the inout function. Justin __ 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

Re: [R] colored outliers

2012-01-10 Thread Justin Haynes
woops! see inline. Hope that helps, and enjoy R. Justin On Tue, Jan 10, 2012 at 8:40 AM, Geophagus wrote: > Hi Justin, > thanks a lot for your quick answer. > If I use your code, all points become red. > How do you include the sorted and separated four values into the "p

Re: [R] colored outliers

2012-01-10 Thread Justin Haynes
=TOC_NI,col='red',pch=1,size=3) Justin On Tue, Jan 10, 2012 at 7:11 AM, Geophagus wrote: > Hi @ all, > I have question how to mark significant outliers in R. > This is my very simple script to plot a regression: > > TOC_NI<-read.csv2("C:/Users/XYZ/De

Re: [R] ggplot2 - tricky problem

2012-01-05 Thread Justin Haynes
If instead you want to plot something like: ggplot(dat,aes(x=likeability,y=uniqueness,colour=city))+geom_point()+geom_smooth(aes(group=city),method='lm') You could draw fit lines that make a bit more sense. Forgive me if I'm over simplifying your problem! Justin On Thu, Jan 5,

Re: [R] match matrices of different lengths

2012-01-05 Thread Justin Haynes
rtant. hope that helps, Justin On Thu, Jan 5, 2012 at 5:51 AM, Thijs vanden Bergh < bergh.thijsvan...@gmail.com> wrote: > was trying to match different matrices of different lengths with in > the first collumn date and time info (yearmonthdayhourminute). the > routine needs to re

Re: [R] a quick question about "rbinom"

2012-01-04 Thread Justin Haynes
homework or not, ?rbinom should be plenty. On Wed, Jan 4, 2012 at 1:38 PM, lynn.tsai wrote: > Hello, I have the following code using rbinom, but I don't understand what > *"+1"* means in the code. Could someone help? Thanks so much, > > > X1<-c("A","B")[rbinom(n,1,0.6)+1] > > X2<-c("C","D")

Re: [R] Combining characters

2012-01-04 Thread Justin Haynes
apply(expand.grid(x, y, z, stringsAsFactors=F), 1, paste, collapse=' ') On Wed, Jan 4, 2012 at 8:32 AM, jeremy wrote: > Hi all, > > I'm trying to combine exhaustively several character arrays in R like: > x=c("one","two","three") > y=c("yellow","blue","green") > z=c("apple","cheese") > > in or

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-04 Thread Justin Haynes
do s[1] and s[-1] do what you're looking for? those are just to display... if you want to change s, you need to reassign it or fiddle with namespacing. however, I'd say it is better to write R code as though data structures are immutable until you explicitly re-assign them rather than trying to de

Re: [R] Applyiing mode() or class() to each column of a data.frame XXXX

2011-12-30 Thread Justin Haynes
there is also colwise in the plyr package. > library(plyr) > colwise(class)(data6) v13 v14 v15 f4 v16 1 integer numeric character factor logical Justin On Thu, Dec 29, 2011 at 4:47 PM, Jean V Adams wrote: > Dan Abner wrote on 12/29/2011 06:13:11 PM: > >

Re: [R] Help with code

2011-12-20 Thread Justin Haynes
u need to enumerate the set > of good strings. That is tedium, not danger. > > If t1d_ptype might take any value, then make it a character vector. > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > -Original Message- > > From: r-

Re: [R] Help with code

2011-12-20 Thread Justin Haynes
and one final note, you should avoid naming things with pre-existing R functions (e.g. data). Justin On Tue, Dec 20, 2011 at 11:14 AM, 1Rnwb wrote: > hello gurus, > > i have a data frame like this > HTN HTN_FDR Dyslipidemia CAD t1d_ptype[1:25] > 1Y

Re: [R] how to manually enter an double quote as data feed?

2011-12-13 Thread Justin Haynes
correctly as well as save correctly. If that doesn't answer your question, some more back story on what you're trying to do would help. Justin On Tue, Dec 13, 2011 at 2:03 PM, bonnieyuan wrote: > I'm doing a text mining project where I have to manually enter a double &

Re: [R] using sample

2011-12-07 Thread Justin Haynes
more info about your data (see ?str and ?dput) or if you can generate made up data that replicates your problem that works too. Justin On Wed, Dec 7, 2011 at 9:16 AM, bevare wrote: > Hi, > > Can anyone help sort out the problem with the following script - I am a R > newbie and I am s

Re: [R] adding hyperlinked text to pdf plot

2011-12-05 Thread Justin Fincher
mething other than the URL"? > > I feel the tikzDevice package should be an option for the task. > > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA &

[R] adding hyperlinked text to pdf plot

2011-12-05 Thread Justin Fincher
Howdy, I have read that if you put a URL in the text of a plot being saved into pdf, the result is a functional hyperlink. I am interested in having text in a plot that is linked to a URL, but I would like the text to be something other than the URL. Is this possible? Thank you. - Fincher

Re: [R] aggregate syntax for grouped column means

2011-11-29 Thread Justin Haynes
able and plyr perform the na.rm on each column. Justin On Tue, Nov 29, 2011 at 12:21 PM, Juliet Hannah wrote: > I am calculating the mean of each column grouped by the variable 'id'. > I do this using aggregate, data.table, and plyr. My aggregate results > do not match the othe

Re: [R] hour in x-axis

2011-11-29 Thread Justin Haynes
s() or +geom_line() if you'd rather. Hope that helps, Justin On Tue, Nov 29, 2011 at 10:07 AM, threshold wrote: > > Dear R useres, got the following problem. Given the AggData (listed below) > I need to plot AggData[,2] vs time (AggData[,1]) for chosen 'rows'. Ive >

Re: [R] tip: large plots

2011-11-18 Thread Justin Haynes
520 43.061 > system.time(print(qplot(x,y,pch=I('.' user system elapsed 32.370 0.204 33.868 On Fri, Nov 18, 2011 at 12:39 PM, Hadley Wickham wrote: > You need: system.time(print(qplot(x,y,pch=I('.')))) > > Hadley > > On Fri, Nov 18, 2011 at 1:

Re: [R] tip: large plots

2011-11-18 Thread Justin Haynes
Very cool. Sadly, as far as I can tell, it doesn't work with ggplot though :( > x<-runif(1e6) > y<-runif(1e6) > system.time(plot(x,y,pch='.')) user system elapsed 0.824 0.012 0.845 > system.time(plot(x,y)) user system elapsed 33.422 0.016 33.545 > system.time(print(qplot(x,y)))

Re: [R] apply on rows and columns?

2011-11-16 Thread Justin Haynes
13 [2,]24 > apply(x,c(1,2),sum) [,1] [,2] [1,]4 12 [2,]8 16 a margin of c(1,2) makes more sense. Hope that clarifies things. Justin On Wed, Nov 16, 2011 at 12:18 PM, Sarah Goslee wrote: > Hi, > > On Wed, Nov 16, 2011 at 3:13 PM,   wrote: >> >&

Re: [R] Extract pattern from string

2011-11-15 Thread Justin Haynes
take a look at the structure of what Sys.time returns. str(Sys.time) and now at ?strptime! > format(Sys.time(),format='%d-%H-%M-%S') [1] "15-09-55-55" > format(Sys.time(),format='%Y') [1] "2011" > format(Sys.time(),format='%m') [1] &

Re: [R] Create design matrix

2011-11-03 Thread Justin Haynes
?expand.grid > expand.grid(c("M","F"),c("Y","O")) Var1 Var2 1M Y 2 FY 3MO 4FO > Justin On Thu, Nov 3, 2011 at 10:56 AM, Bond, Stephen wrote: > Greetings useRs, > > What is the easiest way to create a

[R] mysterious warning message regarding bytecode...

2011-11-02 Thread Justin Haynes
x27;t seem to affect my output as far as I can tell. Thanks! Justin > sessionInfo() R version 2.13.2 (2011-09-30) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_

Re: [R] factor level issue after subsetting

2011-11-01 Thread Justin Haynes
first of all, the subsetting line is overly complicated. dat.sub<-dat[dat$treat!='cont',] will work just fine. R does exactly what you're describing. It knows the levels of the factor. Once you remove 'cont' from the data, that doesn't mean that the level is removed from the factor: > df<-dat

  1   2   3   >