[R] Problem with uniroot.all

2013-12-26 Thread Aurélien Philippot
Dear R experts, I am trying to find all the solutions of an equation. Here is an example: integrand1<- function(x){1/x*dnorm(x)} integrand2<- function(x){1/(2*x-50)*dnorm(x)} integrand3<- function(x,C){ cd<- 1/(x+C) return(cd) } res<- function(C){ ce<-integrate(integrand1, lower=1, upper=

Re: [R] Problem with uniroot.all

2013-12-26 Thread Duncan Murdoch
On 13-12-26 6:26 AM, Aurélien Philippot wrote: Dear R experts, I am trying to find all the solutions of an equation. Here is an example: integrand1<- function(x){1/x*dnorm(x)} integrand2<- function(x){1/(2*x-50)*dnorm(x)} integrand3<- function(x,C){ cd<- 1/(x+C) return(cd) } res<- funct

Re: [R] Erroneous Column Removing Result From User-Defined Function.....

2013-12-26 Thread Adams, Jean
Levent, I would suggest that you get your data the way you want it first, then use the assign() function at the very end of your for() loop. I also think you could simplify the arguments in your assign() function. myfun <- function(dyolu, dadi, dsayi) { for(i in 1:dsayi) { ad <- paste(dadi, i, s

Re: [R] Fitdistr and mle

2013-12-26 Thread Ben Bolker
On 13-12-26 04:13 AM, Tia Borrelli wrote: > > Thank you, this is code i'm running, very simple but my problem was on > the interpretation of the difference between the functions. > > library(fImport) > data.oggi = Sys.timeDate() > ftse_mib = yahooSeries("FTSEMIB.MI", from="2009-09-01", to=data.og

Re: [R] Fitdistr and mle

2013-12-26 Thread Tia Borrelli
Thank you so much, you have been very helpful! Il Giovedì 26 Dicembre 2013 15:39, Ben Bolker ha scritto: On 13-12-26 04:13 AM, Tia Borrelli wrote: > > Thank you, this is code i'm running, very simple but my problem was on > the interpretation of the difference between the functions. > > lib

[R] Counts of duplicate rows as a new column without grouping of duplicates raws.

2013-12-26 Thread Bartłomiej Taciak
Hi everyone, My data looks like this one: AB C 1 a 1 ff 2 b 1 re 3 c 1 sd 5 a 2 as 6 c 4 fe 7 d 5 tt 8 d 5 tt 9 d 9 oi I want to add a new column D, which will contain how many an element from the column A is repeated,

[R] Здорово, появился вариант, заставить вернуться здоровое зрение

2013-12-26 Thread Alisa Esperova
Практически каждой субъект, имеет очки, может Это снять и с поддержкой нетрудных восстановить свои глазодвигательные мышцы и снова глядеть на мир без очков и линз. Это вполне возможно, широкодоступно, неоднократно опробовано и об вот этом идет разговор. И если уж Вы хотите восстановить свои

[R] Results from Vegan metaMDS varry depending on set.seed

2013-12-26 Thread Vinny Moriarty
I've got an ecological data set that I've worked up to the point of having a relative abundance matrix I created with the decostand() command in Vegan. Here is the distance matrix data: S1<-c(0.4451517, 0.37919827, 0.10590466, 0.06974540) S2<-c(0.5064846, 0.32464164, 0.09679181, 0.07208191) S

Re: [R] Counts of duplicate rows as a new column without grouping of duplicates raws.

2013-12-26 Thread arun
Hi, Try: dat1 <- read.table(text="A    B    C 1 a    1    ff 2 b    1    re 3 c    1    sd 5 a    2    as 6 c    4    fe 7 d    5  tt 8 d    5  tt 9 d    9  oi",sep="",header=TRUE,stringsAsFactors=FALSE)  within(dat1,D<-ave(seq_along(A),A,FUN=length)) A.K. On Thursday, December 26,

Re: [R] Counts of duplicate rows as a new column without grouping of duplicates raws.

2013-12-26 Thread arun
Also, you could try: library(plyr) ddply(dat1,.(A),mutate, D=length(A)) #or library(data.table)  dt1 <- data.table(dat1,key='A')  dt1[,D:=.N,by='A'] A.K. On , arun wrote: Hi, Try: dat1 <- read.table(text="A    B    C 1 a    1    ff 2 b    1    re 3 c    1    sd 5 a    2    as 6 c    4    fe 7

Re: [R] spending most of my time in assignments?

2013-12-26 Thread Ross Boylan
On Thu, 2013-12-19 at 20:37 -0500, Duncan Murdoch wrote: > On 13-12-19 6:37 PM, Ross Boylan wrote: > > My code seems to be spending most of its time in assignment statements, > > in some cases simple assignment of a model frame or model matrix. > > > > Can anyone provide any insights into what's go

Re: [R] The difference between SAS and R

2013-12-26 Thread Greg Snow
When I first saw that comic, my thought was "where would APL fit in that graph?" (http://en.wikipedia.org/wiki/APL_(programming_language)) On Sun, Dec 22, 2013 at 2:00 AM, peter dalgaard wrote: > > On 20 Dec 2013, at 18:53 , Kevin Wright wrote: > >> SAS uses words. R uses symbols. >> >> See thi

Re: [R] R command execution at specific time from within R

2013-12-26 Thread Greg Snow
If you really have to do this within R (see Dirk's reply for other options) then the tclTaskSchedule function in the tcltk2 package is one option. However this can be dangerous if you are using the same instance of R while waiting. You might accidentally change something that affects or is affect

Re: [R] Categorial data analysis

2013-12-26 Thread Michael Friendly
On 12/25/2013 3:58 AM, Guy Rotem wrote: Hi, I want to analysis the effect of two continuous independent variables (rain and slope) on a categorical dependent variable (soil type). Do you know how doing it? You could look a my short course notes for Visualizing Categorical Data with SAS and R,

[R] Problems installing some packages using Ubuntu 12.04

2013-12-26 Thread Hallikainen Ville (METLA)
Dear R people using Ubuntu I'd like to run R in my Ubuntu 12.04. I have R v. 3.02. Many packages are available, but package mi is not. Loading indicates a zero status. I have tried to install it from carn using the terminal commands and via R-studio. I have install it into my Mac recently and i

Re: [R] Problems installing some packages using Ubuntu 12.04

2013-12-26 Thread Uwe Ligges
On 26.12.2013 23:39, Hallikainen Ville (METLA) wrote: Dear R people using Ubuntu I'd like to run R in my Ubuntu 12.04. I have R v. 3.02. Many packages are available, but package mi is not. Loading indicates a zero status. I have tried to install it from carn using the terminal commands and v