Re: [R] exponential day

2018-08-09 Thread S Ellison
x likelihood, maybe nlme in the nlme package. For other ideas, look up 'non-linear fitting with R' on any search engine, or check the R Task Views S Ellison *** This email and any attachments are confidential. Any use, copyi

Re: [R] ANOVA Permutation Test

2018-09-03 Thread S Ellison
> This package uses a modified version of aov() function, which uses > Permutation Tests > > I obtain different p-values for each run! Could that be because you are defaulting to perm="Prob"? I am not familiar with the package, but the manual is informative. You may have missed something when r

Re: [R] getting 21 very different colours

2018-09-11 Thread S Ellison
You could look at combning a number of palettes from the RColorBrewer package to get the palette length you want. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Federico > Calboli > Sent: 11 September 2018 08:35 &g

Re: [R] How to create gridded data

2018-11-13 Thread S Ellison
You might take a look at the reshape package, which switches from 'long' to 'wide' formats and vice versa in a fairly flexible way. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li > Sent: 13 Novemb

Re: [R] extrat non diagonal

2018-11-14 Thread S Ellison
i) Your code creates w2 but references w1 to create aa. So you needed aa <- matrix(rep(c(0.4, 0.1, 0.2), 3), 3,3) for a working example. ii) This > matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3) removes any value that is present in the diagonal of aa. Look up ?"%in%" to see what that

Re: [R] extrat non diagonal

2018-11-14 Thread S Ellison
> With your code you just remove diagonal elements from your matrix. Worse; it removed _all_ elements from the matrix that match _anything_ in the diagonal! Which, in that example, was everything ... *** This email and any attach

Re: [R] Request for aid in first R script

2018-11-19 Thread S Ellison
Pointers inline below: > > Since I'm a newbie on R, I was wondering if you could help me to achieve a > > small project that I think it's possible with this project (I cant seem to > > find a similar tool) > > > > I have a data file with about 2000 value lines, organized like this: > > > > x;y;z;j

Re: [R] Tinn-R: new web site

2019-01-14 Thread S Ellison
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jose > Claudio Faria > > The Tinn-R project has a new web page: > http://nbcgib.uesc.br/tinnr/en/index.php > Thanks for this - and thanks, also, for maintaining Tinn-R and keeping it available as free software. The effort is muc

Re: [R] NA rows appeared in data.frame

2019-01-14 Thread S Ellison
subset(t1, apply(t1, 1, function(x) !all(is.na(x (or the equivalent '[' usage) and, as an aside, using '==' for floating point numbers is not generally safe; for example > sqrt(2)^2 == 2.0 [1] FALSE See R FAQ 7.31 for details of why '==' is bad for floating poin

Re: [R] Colors on box plots in ggplot

2019-01-18 Thread S Ellison
) which uses default colours. Once you have an aes mapping you can change the scale, so ( p + scale_colour_manual(values = c("red", "blue", "green")) ) gives you the colour ordering you want. ( p + scale_colour_manual(values = c("red", "blue", "gr

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread S Ellison
You can drop the quote marks by calling print() explicitly with quote=FALSE, by using as.data.frame round your cbind, or - perhaps best - by constructing your output matrix as a data frame in the first place. (print.data.frame defaults to quote=FALSE). And if you suppress name checking in a dat

Re: [R] Printing a list of simultaneous equations

2019-01-21 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael > Friendly > Check out the `matlib` package on CRAN and devel on github: Very nice! Thanks for the pointer. Steve E *** This

Re: [R] CRAN Task View: Optimization and Mathematical Programming

2019-02-06 Thread S Ellison
> Limited water resources need to be apportioned among various competing > users > (e.g,, agriculture, fish and wildlife, Tribes, potable human water > supplies). Water management is definitely not my field, but for interest - and maybe to help other folk respond - can I ask what the loss functio

Re: [R] pattern evaluation in electron microscopy images

2019-02-11 Thread S Ellison
Not really my field, but would you not approach this using FFT on selected regions? I think IMageJ has some capability in that area; see example at https://imagej.nih.gov/ij/docs/examples/tem/. Steve Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On

Re: [R] R help

2019-02-15 Thread S Ellison
> I am having an issue with creating a code in which i can hold information such > as the author of a paper, the year of publication, and the title. This doesn't really tell me what the trouble is. But ... > Also would like > to add into this data frame a logical variable which would show some >

Re: [R] Help with gsub function

2019-03-18 Thread S Ellison
> tb2a$TID2 <- gsub(tb2a$TID, pattern="-[0-0]{0,7}", replacement = "") Just to add something on why this didn't work ... It looks like you were trying to match a hyphen followed by a number up to seven digits. by mistake(?) you gave the digit range as [0-0] so it would repmatch a hyphen followe

Re: [R] Fwd: high p values

2019-03-19 Thread S Ellison
How many data points do you have in each group? - How much do the two groups overlap? If the answers are 'not many' or 'lots' (in that order), and especially if both apply, you can't expect a significant test result. S Ellison *

Re: [R] Regex - subsetting parts of a file name.

2014-07-31 Thread S Ellison
> I want to keep only the part inside the two points. After lots of headache > using grep() when trying something like this: > > grep('.(.*?).','df.subject_test.RData',value=T) > > > Does anyone have any suggestion ? gsub("df\\.(.+)\\.RData", "\\1", 'df.subject_test.RData') Steve E ***

Re: [R] regex pattern assistance

2014-08-15 Thread S Ellison
> -Original Message- > > x<-"/mnt/AO/AO Data/S01-012/120824/" > > I would like to extract "S01-012" > gsub("/mnt/AO/AO Data/(.+)/.+", "\\1", x) #does it, as does > gsub("/mnt/AO/AO Data/([\\w-]+)/.+", "\\1", x, perl=TRUE)# \w is perl RE; > the default is POSIX, which would be. >

Re: [R] Help on installing "R" packages in a Citrix

2014-08-22 Thread S Ellison
> We are currently trying to migrate 3 users of "R" to a citrix based > environment, but are coming across major issues trying to install the > packages to the relevant image. Why can't you open a virtualised OS instance, install and start R in the normal way, install the packages normally in R

Re: [R] division of col by the sum of the col

2014-09-23 Thread S Ellison
> If I want to divide the column of a matrix by the sum of the column, should I > loop over the columns or can I use apply family? Looping's unnecessary. See ?scale or ?sweep, with ?colSums for two non-looping answers; apply() also works if you give it a suitable function argument. S **

Re: [R] uninstalled and reinstalled R, now cannot install packages

2014-10-01 Thread S Ellison
Inability to access a repository index is very often an indication of a failed internet connection from R. In Windows that is often a result of incorrect proxy settings or other internet connection settings. The R Windows FAQ, 2.19 ("The Internet download functions fail") may have the answer...

Re: [R] How to check to see if a variable is within a range of another variable

2014-10-02 Thread S Ellison
> > Is there an easy way to check whether a variable is within +/- 10% > > range of another variable in R? You could use 2*abs(A-B)/(A+B) < 0.1 which avoids an apply(). I've assumed you meant different by under 10% of the mean of the two, hence the 2/(A+B); if you meant 10% of something else, s

Re: [R] Inverse Student t-value

2014-10-02 Thread S Ellison
C and R code for pt and qt in R (the cumulative probability distribution and the inverse, quantile, function respectively) is available in the R source code, which you can obtain from CRAN; see http://CRAN.R-project.org/mirrors.html - see the source code link from any of the listed mir

Re: [R] How to check to see if a variable is within a range of another variable

2014-10-02 Thread S Ellison
Keith Jewell said: > ... from reading ?all.equal I would have expected > scale = 1 and the default scale = NULL to give identical results for the > length > one numerics being passed to all.equal. > > Can anyone explain? Inspectng the code in all.equal.numeric, I find xy <- mean((if (cplx)

Re: [R] a REALLY dumb question

2014-10-06 Thread S Ellison
nd then > earima(lh, order = c(1,0,0)) #First example from arima #Returns (or at least displays) ... Welcome to the new Arima! Call: Arima(x = lh, order = c(1, 0, 0)) Coefficients: ar1 intercept 0.5739 2.

Re: [R] a REALLY dumb question

2014-10-06 Thread S Ellison
environment from one object directly to another object. This kind of thing is exactly what makes watching R-help so worthwhile. S Ellison *** This email and any attachments are confidential. Any use...

Re: [R] ggplot - start axis label with superscript

2014-10-14 Thread S Ellison
> I'm stuck trying to begin an axis label in ggplot with a superscript. For a crude work-round, you could try ggplot(mydata) + aes(x = x, y = y) + geom_line() + ylab(expression(paste(' '^{14}, "C&qu

Re: [R] SOLVED: evaluate NA to FALSE instead of NA?

2014-10-14 Thread S Ellison
> Thanks Joshua and Sven - I completely forgot about which() . Also na.omit(p[p<=0.05]) #and p[p<=0.05 & !is.na(p)] S. *** This email and any attachments are confidential. Any use...{{dropped:8}}

Re: [R] how to ajust y-axis values in plot() ?

2014-10-14 Thread S Ellison
>   I want to plot( 11:20 ) in a plot. >  if i just type the code above, the y value  will be from 11 to 20, now i > want the > value from a given range like  0 to 40, how can i do it? See the ylim= argument to plot.default; eg plot(x, y, ylim=c(0,40)) Also look at ?par and note that plot() and

Re: [R] how to judge a virable is a integer?

2014-10-18 Thread S Ellison
> But i use a<-10/b , b is some value ,may be 5, maybe 5.5 If you do floating point arithmetic on integers you'll usually get floating point answers, including the 5.0. See FAQ 7.31 for the usual floating point problem, and ?all.equal for the usual answer to it. You could see if a result is cl

Re: [R] how to judge a virable is a integer?

2014-10-20 Thread S Ellison
all.equal, which is documented on the help page you were referred to. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you hav

Re: [R] how to judge a virable is a integer?

2014-10-20 Thread S Ellison
> 3. all.equal(a, as.integer(a)) Closer, but be aware that all.equal will not always return TRUE or FALSE and - more importantly - as.integer truncates towards zero and does NOT generally round to the nearest integer. a <- 4 - sqrt(2)^2 #Analytically 2 all.equal(a, as.integer(a)) # [1] "Mean re

Re: [R] Split fixed width data in R

2014-10-22 Thread S Ellison
ubstr(x, 9,12), Precipitation=as.numeric(substring(x,13))) } decode.lst(lst1Sub) S Ellison > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Zilefac Elvis > Sent: 22 October 2014 16:38 > To: R. Help >

Re: [R] Split fixed width data in R

2014-10-22 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Clint Bowman > > ?read.fortran Also read.fwf if it's in a file. S *** This email and any attachments are con

Re: [R] assignment 2 part 1,2,3

2014-10-23 Thread S Ellison
title). Don't miss out section 10.7, "Scope"; it's important, but follows 'advanced examples' which are less important for a beginner. After that, Google. And after that, R-help again. S Ellison ***

Re: [R] how to calculate a numeric's digits count?

2014-10-24 Thread S Ellison
acter representation depends only on how much you decide to round when converting to character format. That is essentially arbitrary, so any games you play with conversion to character are just telling you how many digits you decided to round each number to, not how many there were to start with

Re: [R] change default installation of R

2014-10-31 Thread S Ellison
> I want to change R-3.1.1 to the default, so that when I type which R, I get > /usr/local/R-3.1.1 Change your PATH to include the R 3.1.1 directory instead of the version 2 directory? S *** This email and any attachments are

Re: [R] How to update R without losing packages

2014-10-31 Thread S Ellison
> A solution on the link below provides the steps of updating R without losing > packages in Unix. > http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html > > How could I do that on windows 7 platform? See the R Windows FAQ, FAQ 2.8. ***

Re: [R] Output In R

2015-08-20 Thread S Ellison
> I have already tried options(max.print=99) but does not show the desired > result. > As posted above it want to share the outcome with the business owner where > there could be multiple entries. Then just print the multiple entries. See ?duplicated for finding them Otherwise, use things lik

Re: [R] Piecewise regression using segmented package plotted in xyplot

2015-08-28 Thread S Ellison
, 50)) xyplot(y~x|parts, data=dati, panel = function(x, y, ...) { panel.xyplot(x, y, ...) panel.segmented(x, y, ...) } ) S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} _

Re: [R] Piecewise regression using segmented package plotted in xyplot

2015-08-28 Thread S Ellison
panel.xyplot(x, y, ...) panel.segmented(x, y, ...) } ) #And just to see if it works for panel-grouped data: set.seed(1023) dati$parts <- sample(gl(2, 50)) xyplot(y~x|parts, data=dati, panel = function(x, y, ...) { panel.xyplot(x, y, ...) panel.segmented(x, y,

Re: [R] Scope of Axes

2015-10-22 Thread S Ellison
xact command you used above. If you used a different plotting system for the bar plot the alignment would be very hard to guarantee, so stay with base graphics for both. S Ellison *** This email and any attachments are confiden

Re: [R] regex not working for some entries in for loop

2015-10-26 Thread S Ellison
ately clear why you’re looping. grepl returns a vector of logicals; you have a vector of character strings. Consider replacing 'if' constructs with 'ifelse' - albeit a complicated ifelse() - and doing the whole thing without a loop. S Ellison **

Re: [R] How to calculate variance on multiple numbers at once?

2015-11-11 Thread S Ellison
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luigi > Marongiu > if I have a sample set of the following numbers x1=0.09, x2=0.94, x3=0.48, > x4=0.74, x5=0.04 I can calculate the variance easily. Not without concatenating them into a vector, you ca

Re: [R] Calculating distance between words in string

2015-11-11 Thread S Ellison
t from " amet is not the only instance of 'amet', and there is more than one instance of 'instance', 'is', 'of' and 'and'." S Ellison *** This email and any attachments a

Re: [R] Non-linear fit?

2015-11-25 Thread S Ellison
*x) + sin(w*x) to get alpha and beta, and hence a and p. Those values could then be used as starting values for optim or similar. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} _

Re: [R] Extracting part of alpha numeric string

2015-11-30 Thread S Ellison
> Could you please explain about > > sub("^([0-9]*).*$", "\\1", fields) See ?regex and the extensive online literature on regular expressions. S Ellison *** This email and any attachments are confid

Re: [R] PCA plot of variable names only

2015-11-30 Thread S Ellison
If it's not what you meant, you'll need to provide the picture. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you

Re: [R] Graphing a subset of data

2015-12-01 Thread S Ellison
E,...){ x<-subset(x,subset) do.call(type,list(x=x[[var]],...)) } S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-projec

Re: [R] applying wilcox.test to every combination of rows in a matrix (pairwise)

2015-12-09 Thread S Ellison
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of debra ragland > via R-help > some sample data > p<-matrix(c(rep(c(F,T,F),3), rep(c(T,F,T),3), rep(c(T,T,F),3), > rep(c(F,F,T),3))) i) Something wrong with p, here; it's a single column matrix. did you mean p4<-matrix(c(rep(c(F,T

Re: [R] If I have 3 parameters, is optim() doing the same thing as Gibbs sampling?

2015-12-10 Thread S Ellison
se in optim() - is pretty much completely different from MCMC using a Gibbs sampling algorithm S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}}

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-15 Thread S Ellison
Meeting2", "Meeting3", "Meeting4","Meeting5") > > and have gotten a '+' at the end meaning I am missing something. You are missing the closing bracket on the boxplot() command. Just finish with a ')' S Ellison **

Re: [R] Make a box-whiskers plot in R with 5 variables, color coded.

2015-12-15 Thread S Ellison
> It is clear that a ) although is a type of bracket it is called a > parenthesis, just as , > is called a comma, which is a type of punctuation mark. These things are called parentheses because of what they do, not what they are. A parenthesis is any word or phrase inserted as an explanation or

Re: [R] Would you please help me to create a table in R?

2015-12-18 Thread S Ellison
> I want to get the table like "output". Any possibility to get it in R? What do the rows represent in 'output'? Places? Times? Individuals? What do the numbers in the table relate to? Individual bird identifier? Number of birds?

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-15 Thread S Ellison
th names of the right format. I() wrapped round a matrix or data frame does nothing like what is needed if you include it in a data frame construction, so either things have changed since the tutorial was written, or the authors were not handling a matrix or data frame with I(). S Ellison **

Re: [R] Strange behavior with S3 class

2016-01-18 Thread S Ellison
s's names method: names.eem <- function(x, ...){ "AnotherName"} str(test1) # List of 1 # $ AnotherName: chr "justaname" # - attr(*, "class")= chr "eem" So it isn't your '<-', it's because you overrode 'names' S

Re: [R] R-help mailing list activity / R-not-help?

2016-01-26 Thread S Ellison
#x27;meanness', no-one has yet pointed to Trey Causey's analysis of R-help's alleged meanness at http://badhessian.org/2013/04/has-r-help-gotten-meaner-over-time-and-what-does-mancur-olson-have-to-say-about-it/ Up to 2013, it was apparently getting

Re: [R] Sorting a Data Frame

2016-01-26 Thread S Ellison
df[order(df[,"x"]),] or df[order(df$x),] And just to prevent yet more confusion, you might also want to avoid 'df' as a name. 'df' is the function that returns the density of the F distribution ... S Ellison ***

Re: [R] find numbers that fall in a region or the next available.

2016-02-03 Thread S Ellison
f the closest Latitude/Longitude pair to your GPS location? And once you have the distances you could use order() or rank() to pick the top 5 (maybe using head()) or just rank() on the distances. And once you've picked a set you can still additionally check whether a location was within the box. S

[R] Has R-help changed reply-to policy?

2016-02-04 Thread S Ellison
Apologies if I've missed a post, but have the default treatment of posts and reply-to changed on R-Help of late? I ask because as of today, my email client now only lists the OP email when replying to an R-help message, even with a reply-all, so the default reply is not to the list. I also noti

Re: [R] Package for error analysis

2016-02-05 Thread S Ellison
r calculations). I wouldn't exactly call it statistics - it's based on recommendations for measurement science and they assume a pretty simple deterministic model and that has little or nothing to do with model fitting and inference. S Ellison > -Original Message- > From: R

Re: [R] How to extract same columns from identical dataframes in a list?

2016-02-09 Thread S Ellison
Does do.call('cbind', list_of_dataframes) do what you want? S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Wolfgang > Waser > Sent: 09 February 2016 09:03 > To: Dénes Tóth; r-help@r-project.org > Subject:

Re: [R] pearson correlation matrix

2016-02-09 Thread S Ellison
ation matrix, if you want to see how closely individuals are associated, but correlation is a possible step on the way. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the in

Re: [R] Error on Text Mining for WordCloud

2016-02-14 Thread S Ellison
rp1 <- as.character(nwCorp1) ? S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] missing values in csv file

2016-02-17 Thread S Ellison
c(NA, NA, letters[1:5]) ) you can do things like x[is.na(x)] <- "Empty Space" x or x[is.na(x)] <- "" S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] Lexical scoping for step and add1 functions

2016-03-09 Thread S Ellison
27;, paste(names(dfr[1:20]), collapse="+"))) ) test.FN(scope=scope) } test.step(X.des, Y) S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}}

Re: [R] group by rows

2016-03-09 Thread S Ellison
ample, to sort by the first column of a matrix mm: oo <- order(mm[,1]) mm[oo,] order() also takes multiple sort fields so can sort by several columns simultaneously (eg sort by first column and within that by third column etc)

Re: [R] assign a vector to list sequence

2016-03-09 Thread S Ellison
> > What I need is this: > > [[1]] > > [1] 1 2 3 > > [[1]] > > [2] 1 2 3 > > [[1]] > > [2] 1 2 3 Try rep(list(1:3), 3) S Ellison *** This email and any attachmen

Re: [R] please help

2016-03-14 Thread S Ellison
between two and only two groups. Your files seem to have more than two years, which - at least until my telepathic inference improves - seems likely to cause a problem for t.test and var.test. Perhaps you were looking for pairwise.t.test? S Ellison ***

Re: [R] About calculation of the gravity model in R and STATA software

2016-03-19 Thread S Ellison
inomial family is allowing for overdispersion and stata is not. S Ellison *** This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this m

Re: [R] Fit a smooth closed shape through 4 points

2016-03-21 Thread S Ellison
Is there a reason not to use the convex hull for area calculations? Any curve you put through the points would surely be at least as arbitrary as a straight line. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alexander > Shenk

Re: [R] How to make a function aware of its own call arguments

2016-03-24 Thread S Ellison
> Are you aware of any function what would query the original function call > arguments no matter what happens in the function? Use missing() first. If you can't use missing() first, or use it early in a parent function and pass a flag, you could perhaps pass a copy of the parent function call t

Re: [R] Export the result k-means cluster to CSV file

2016-03-24 Thread S Ellison
E, ...) } lapply(names(cl), Write, x=cl, filename="myclust.txt") (Ignore the NULLs returned) Anything more structured than that and you'll have to write a write.kmeans replacement for write that structures the results as you need them later. S Ellison

Re: [R] Export the result k-means cluster to CSV file

2016-03-29 Thread S Ellison
rdinates for each cluster. If you assign that list to an object you can then write a separate function to format and write out the coordinates and use lapply to run that on the list. Or you can include formatted write calls in the by.index function, writing to a file as before.

Re: [R] minimal attributes to get se.fit

2016-04-04 Thread S Ellison
ction from glm comes up, there's a strong likelihood that someone will point out that the covariances are not necessarily sufficient for reliable confidence intervals on prediction (and look! that just happened). You might want to hunt around for more authoritative comment on that if the intervals/st

Re: [R] Problem with <= (less than or equal): not giving the expected result

2016-04-06 Thread S Ellison
> Apparently, abs(1 - 0.95) is not equal to 0.05, which I find however quite > disturbing. It's normal.* See R FAQ 7.31 in the html help system. S Ellison *... and common to all computers that use binary. *** This em

Re: [R] write a function inside the summation in a more condensed form

2016-04-11 Thread S Ellison
> I want to write the inside function (3^(x[i]+x[j])) in a more condensed form > cause this will help me when the multiple summations are more than two indices<-c(i,j) #or whatever you want 3^sum( x[indices] ) S Ellison ***

Re: [R] Recoding lists of categories of a variable

2016-10-10 Thread S Ellison
27;, while also mapping > system missing values to system missing values? You could look at 'recode()' in the car package. There's a fair description of other options at http://www.uni-kiel.de/psychologie/rexrepos/posts/recode.html S Ellison **

Re: [R] Recoding lists of categories of a variable

2016-10-10 Thread S Ellison
> Well, I think that's kind of overkill. Depends whether you want to recode all or some, and how robust you want the answer to be. recode() allows you to recode a few levels of many, without dependence on level ordering; that's kind of neat. tbh, though, I don't use recode() a lot; I generall

Re: [R] multiple uses ifelse function

2016-10-11 Thread S Ellison
testseq<=4,'x',testseq) will return four 'x's and then - because R has to coerce everything to a single type - character representations of numbers 5:20. That will not then respond well to subsequent numeric comparisons ... S Ellison **

Re: [R] Recoding lists of categories of a variable

2016-10-11 Thread S Ellison
> If you are concerned about missing levels -- which I agree is legitimate -- > then > the following simple modification works (for > **factors** of course): > > > d <- factor(letters[1:2],levels= letters[1:3]) d > [1] a b > Levels: a b c > > f <- factor(d,levels = levels(d), labels = LETTERS[3:1

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread S Ellison
ic. But if you must, is there any reason you can't divide the first row by (say) 1000, barplot normally with axes=false, and then put an explicit axis up each side with something like axis(2, at=seq(0,3, 0.5), labels= seq(0,2500,500)) ) #first row axis, left column axis(4) S Ellison

Re: [R] Why do we get “Don't know how to add o to a plot” Error?

2016-10-19 Thread S Ellison
f the answers here, though, I'm sure that would be appreciated. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] nls.lm

2016-10-19 Thread S Ellison
lued solution for all of x, y and z. Are you quite sure that that is what you _meant_? S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-pr

Re: [R] nls.lm

2016-10-20 Thread S Ellison
whether couched in terms of count of residuals - is simply to make sure that you have more independent data than variables when seeking a unique numerical solution by non-linear least squares. If you don't you'll get non

Re: [R] How to put below code in Automator in iOS

2016-10-27 Thread S Ellison
>From 'An introduction to R' in the html help system: "If you just want to run a file foo.R of R commands, the recommended way is to use R CMD BATCH foo.R. " There is also a short section on 'Invoking R under OS X' in the 'Introduction to R'; it may

Re: [R] lsa-cosine subscript out of bounds error

2016-10-28 Thread S Ellison
om the information you have given. But in general, subscript errors in a function are often caused by the user (you) supplying the wrong object type or an object with incorrect dimensions. So you could start by making sure w.mt is what cosine() expects. class(w.mt) dim(w.mt) str(w.mt) coul

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-11-01 Thread S Ellison
actor, '<-') can use. *though plenty of reason to warn of unexpected consequences if not, of course S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __

Re: [R] Adding a column to an **empty** data.frame

2016-11-02 Thread S Ellison
> Now, how can I add a third column name to that empty df? You could use functions that generate zero-length objects. Examples: df$newv <- vector(mode="numeric") #logical by default, so <-vector() would give you a zero-length logical df$newi <- integer() df$newf &

Re: [R] Text categories based on the sentences

2016-11-16 Thread S Ellison
> I have data set contains one variable "*Description*" > > *Description** Category* > > 1. i want ice cream food > 2. i like banana very much fruit > 3. tomorrow i will eat chick

Re: [R] Issues with the way Apply handled NA's

2016-11-16 Thread S Ellison
NA) > plabor A slightly more compact variant that avoids the intermediate 'vals' variable is to apply an anonymous function that does the check internally: plabor$colD <- apply(plabor, 1, function(x) if(all(is.na(x))) NA else prod(x, na.rm=TRUE)) S Ellison ***

Re: [R] Variable 'A' is not a factor Error message

2016-11-16 Thread S Ellison
ot factors. You will then get a numerical gradient for each factor instead of a single offset for each upper level. That isn't really what Placket and Burman had in mind, so I would not normally start with a P-B design if I wanted to do that. Consider a response surface model instead. S

[R] rstan error: C:/Rtools/mingw_64/bin/g++: not found

2016-12-02 Thread S Ellison
Apologies for posting a possibly package-specific question, but I'm not sure whether this is an R or rstan ussue. Running rstan under R 3.1.1 in windows 10 I get the well-known error "Compilation ERROR, function(s)/method(s) not created! C:/Rtools/mingw_64/bin/g++: not found" The cause on my sy

Re: [R] Match ISO 8601 week-of-year numbers to month-of-year numbers on Windows with German locale

2017-01-18 Thread S Ellison
> -Original Message- > (yw <- format(posix, "%Y-%V")) > > # [1] "2015-52" "2015-53" "2016-53" "2016-01" > > Which, after checking back with a calendar, would give me reason to believe > that it using %V does in fact seem to work: it's an input to `format()` and R > doesn't seem to ignore

Re: [R] force axis to extend

2017-03-16 Thread S Ellison
b="") barplot(height = df$Percent[df$Sex == "Males"], add = TRUE, axes = F, col="#f8bb85", ylab="", names.arg=c("18-29", "30-44", "45-59", "60+")) axis(side=2, at = seq(-35,35,by=5), labels=format(abs(seq

Re: [R] argument to 'which' is not logical

2017-03-23 Thread S Ellison
recommend you avoid using common function names as variable names) If you do need to test elements for zeroes, though, note that '==' and '!=' are not usually recommended for comparisons with zero owing to finite numerical representation. So that may well be unwise. See the N

Re: [R] Plot Arrows with Angle and length

2017-03-29 Thread S Ellison
<- switch(units, degrees=azimuth*pi/180, radians=azimuth ) arrows(x, y, x+cos(az.rad)*length, y+sin(az.rad)*length, ...) } plot(0:6, 0:6, type="n") arrows.az(x, y, Azimuth, Length) "..." means you can pass all the

Re: [R] Plot Arrows with Angle and length - correction

2017-03-29 Thread S Ellison
radians=azimuth ) arrows(x, y, x+cos(az.rad)*size, y+sin(az.rad)*size, ...) } plot(0:6, 0:6, type="n") arrows.az(x, y, Azimuth, Length) "..." means you can pass all the other options to arrows() S Ellison > > > Thanks, > > Julio > >

Re: [R] simple random number generation

2008-07-24 Thread S Ellison
Since the standard normal distribution goes to infinity in both directions, you can't have random normal constrained to +-1.5. You can have _truncated_ standard normal, though, if that's really what you want. +-1.5 is/are the normal quantiles at pnorm(c(-1.5,1.5)). So if we generate 500 uniform

<    1   2   3   4   5   6   7   >