[R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Luca Cerone
Dear all, in my .bashrc file I have set the environment variable R_HISTFILE like this: export R_HISTFILE=$HOME/.Rhistory I then use it in my .Rprofile to have R writing all the history in a single file, rather than on a per directory basis. However this doesn't work becaus R_HISTFILE is not

Re: [R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Rainer M Krug
Luca Cerone luca.cer...@gmail.com writes: Dear all, in my .bashrc file I have set the environment variable R_HISTFILE like this: export R_HISTFILE=$HOME/.Rhistory I then use it in my .Rprofile to have R writing all the history in a single file, rather than on a per directory basis.

Re: [R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Luca Cerone
Thanks, effectively I was using RStudio (on an Ubuntu 12.04 machine). Is there any other way to make the variable available to Rstudio? Now I have simply written the path manually, but I like the idea of having a system-wide variable :) Thanks for your help, Rainer! On Tue, Apr 1, 2014 at

Re: [R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Rainer M Krug
Luca Cerone luca.cer...@gmail.com writes: Thanks, effectively I was using RStudio (on an Ubuntu 12.04 machine). Is there any other way to make the variable available to Rstudio? Now I have simply written the path manually, but I like the idea of having a system-wide variable :) Check out

Re: [R] Fwd: rbind error - duplicated row.names not allowed

2014-04-01 Thread Kenn Konstabel
deleting the old rownames might help. rownames(df1) - rownames(df2) - rownames(df3) - NULL But a reproducible example would be interestng. In simple cases there is no problem with duplicated rownames as they are automatically renamed: df1 - data.frame(A=1, B=2, row.names=A) df2 -

[R] Please help! Matrices and parameter of time

2014-04-01 Thread ANNA SIMEONIDOU
Hi, Well, the solution to my problem maybe is easy, but i have really stuck with this. I have a process which evolves in three times, so there is the parameter of time (t=1,2,3).More particularly i have three 4*4 matrices, one for each time. In other words each element has three cordinates:

[R] trouble using readOGR() function

2014-04-01 Thread remissssss
Hi all, I got some trouble trying to open a .kml file into R. Usually, the readOGR package works great for it but here I get a message error that I can't understand. When I'm typing this : myfile -readOGR(dsn=/windows/landuse.kml,layer=agricultural use) I get the following error : Error in

[R] R rms package: nomogram using imported coefficients and linear predictor

2014-04-01 Thread Yngvar Nilssen
Hi , A colleague has done an Cox-regression , on data not available to me. I ran an identical Cox regression model on similar data. If I use datadist to store the distribution summaries for included variables, and replace coefficients and linear predictor with my colleague's coefficients and

[R] rpart and randomforest results

2014-04-01 Thread Schillo, Sonja
Hi all, I have a question on rpart and randomforest results: We calculated a single regression tree using rpart and got a pseudo-r2 of roundabout 10% (which is not too bad compared to a linear regression on this data). Encouraged by this we grew a whole regression forest on the same data set

Re: [R] rpart and randomforest results

2014-04-01 Thread Mitchell Maltenfort
Is it possible that the random forest is somehow adjusting for optimism or overfitting? On Apr 1, 2014 7:27 AM, Schillo, Sonja sonja.schi...@uni-due.de wrote: Hi all, I have a question on rpart and randomforest results: We calculated a single regression tree using rpart and got a pseudo-r2

Re: [R] colors in violin plot, ggplot2

2014-04-01 Thread Monica Pisica
Hi Denis, Thank you so much. This is exactly what i needed. I am not telling you how much time i wasted to change default colors for fill and colour, coming up with pretty weird ideas, non working, of course. Thanks again, Monica Date: Tue, 1 Apr 2014 02:23:08 -0700 Subject: Re: [R]

[R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Marc Marí Dell'Olmo
Dear all, Anyone knows how to generate a vector of Normal distributed values (for example N(0,0.5)), but with a sum-to-zero constraint?? The sum would be exactly zero, without decimals. I made some attempts: l - 100 aux - rnorm(l,0,0.5) s - sum(aux)/l aux2 - aux-s sum(aux2) [1]

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Jeff Newmiller
You are on a fool's errand. Read FAQ 7.31. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] Please help! Matrices and parameter of time

2014-04-01 Thread David Carlson
Use an 3-dimensional array. ?array And any basic introduction to R. - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org

Re: [R] Please help! Matrices and parameter of time

2014-04-01 Thread Jeff Newmiller
This mailing list has a no homework policy (read the Posting Guide, please, which also requests that you post in plain text format only). If this is not homework then you will have to be a bit more specific about what you know and what you don't in order to get useful help. Questions about why

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Boris Steipe
Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x - rnorm(5000, 0, 0.5) x - c(x, -x) sum(x) hist(x) B. On 2014-04-01, at 8:56 AM, Marc Marí Dell'Olmo wrote: Dear all, Anyone knows how to generate a vector of Normal distributed

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread JLucke
The sum-to-zero constraint imposes a loss of one degree of freedom. Of N samples, only (N-1) can be random. Thus the solution is N - 100 x - rnorm(N-1) x - c(x, -sum(x)) sum(x) [1] -7.199102e-17 Boris Steipe boris.ste...@utoronto.ca Sent by: r-help-boun...@r-project.org

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Boris Steipe
But the result is not Normal. Consider: set.seed(112358) N - 100 x - rnorm(N-1) sum(x) [1] 1.759446 !!! i.e. you have an outlier at 1.7 sigma, and for larger N... set.seed(112358) N - 1 x - rnorm(N-1) sum(x) [1] -91.19731 B. On 2014-04-01, at 10:14 AM, jlu...@ria.buffalo.edu wrote:

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Marc Marí Dell'Olmo
Boris is right. I need this vector to include as initial values of a MCMC process (with openbugs) and If I use this last approach sum(x) could be a large (or extreme) value and can cause problems. The other approach x - c(x, -x) has the problem that only vectors with even values are obtained.

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Keith Jewell
It seems so simple to me, that I must be missing something. Subject to Jeff Newmiller's reminder of FAQ 7.31; if the sum is zero then the mean is zero and vice versa. The OP's original attempt of: - l - 100 aux - rnorm(l,0,0.5) s - sum(aux)/l aux2 - aux-s sum(aux2)

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread JLucke
Then what's wrong with centering your initial values around the mean? Marc Marí Dell'Olmo marceivi...@gmail.com 04/01/2014 10:56 AM To Boris Steipe boris.ste...@utoronto.ca, cc jlu...@ria.buffalo.edu, r-help@r-project.org r-help@r-project.org Subject Re: [R] A vector of normal distributed

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Rui Barradas
Hello, One way is to use ?scale. set.seed(4867) l - 100 aux - rnorm(l, 0, 0.5) aux - scale(aux, scale = FALSE) sum(aux) hist(aux, prob = TRUE) curve(dnorm(x, 0, 0.5), from = -2, to = 2, add = TRUE) Hope this helps, Rui Barradas Em 01-04-2014 16:01, jlu...@ria.buffalo.edu escreveu: Then

[R] importing multiple text files in R

2014-04-01 Thread eliza botto
Dear useRs, I have a number of text file located at a certain location with the following names. s1.txt,s2.txt,s3.txt,s4.txt,s5.txt...s120.txt when i read them, before opening them, by using filelist = list.files(pattern = .s*.txt) The are opened in the following order [1] s1.txt

[R] Remove part of a summary of a model in a regression output

2014-04-01 Thread Kumsa
I would like to drop the out put part of the output that begins with as.factor(stratadow) in the summary of a model shown below.How can I accomplish this task? Thanks summary(mod1) Family: poisson Link function: log Formula: death ~ hw + temp + as.factor(stratadow) Parametric coefficients:

Re: [R] importing multiple text files in R

2014-04-01 Thread Frede Aakmann Tøgersen
Try mixedsort in gtools package Br. Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: eliza botto Dato:01/04/2014 18.10 (GMT+01:00) Til: r-help@r-project.org Emne: [R] importing multiple text files in R Dear useRs, I have a number of text file located at a certain

[R] Times and Dates

2014-04-01 Thread Doran, Harold
Is the time and date package the right one to convert a vector, such as the following, into a time format? 12:06 11:51 11:53 12:27 14:20 12:27 The aim is to deal with a time variable numerically (find means, etc). Thanks Harold [[alternative HTML version deleted]]

[R] jointprior in deal package

2014-04-01 Thread miguel sanz
someone has solved the problem?? I have the same problem [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Plotting Satellite

2014-04-01 Thread Dao_De
I want to read the following file with and extract the longitude and latitude for certain areas. The file is satellite data from topex and contains the monthly wave energy fluxes around the worlds oceans. For doing that i have the following loop that reads the specific data. I then want to

Re: [R] Times and Dates

2014-04-01 Thread Duncan Murdoch
On 01/04/2014 12:33 PM, Doran, Harold wrote: Is the time and date package the right one to convert a vector, such as the following, into a time format? 12:06 11:51 11:53 12:27 14:20 12:27 The aim is to deal with a time variable numerically (find means, etc). I don't know which package you

Re: [R] importing multiple text files in R

2014-04-01 Thread Kenn Konstabel
you can extract numbers from your file names and then sort them like this: filelist = list.files(pattern = .s*.txt) filelist[order(as.integer(gsub([^0-9], , filelist)))] (cf with alphabetic order: filelist[order(gsub([^0-9], , filelist))] Or if you just have s1...s120 you can construct the names

Re: [R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Hadley Wickham
Use .Renviron Hadley On Tue, Apr 1, 2014 at 2:33 AM, Luca Cerone luca.cer...@gmail.com wrote: Thanks, effectively I was using RStudio (on an Ubuntu 12.04 machine). Is there any other way to make the variable available to Rstudio? Now I have simply written the path manually, but I like the

Re: [R] Remove part of a summary of a model in a regression output

2014-04-01 Thread arun
Hi, You could extract the part you wanted by: indx - grepl(as.factor,names(mod1$coefficients))  coef(summary(mod1))[!indx,] A.K. On Tuesday, April 1, 2014 1:03 PM, Kumsa waddee...@gmail.com wrote: I would like to drop the out put part of the output that begins with as.factor(stratadow) in the

Re: [R] A vector of normal distributed values with a sum-to-zero constraint

2014-04-01 Thread Greg Snow
Here is one approach to generating a set (or in this case multiple sets) of normals that sum to 0 (with a little round off error) and works for an odd number of points: v - matrix(-1/8, 9, 9) diag(v) - 1 eigen(v) x - mvrnorm(100,mu=rep(0,9), Sigma=v, empirical=TRUE) rowSums(x) range(.Last.value)

Re: [R] Create sequential vector for values in another column

2014-04-01 Thread arun
Hi, May be this helps: set.seed(14) dat1 - data.frame(shell_ID= sample(c(0208A_47_33,0208A_47_34,0912C_13_3,1400C_2_48),20,replace=TRUE),stringsAsFactors=FALSE) dat2 - dat1 ord1 - order(as.numeric(gsub([[:alpha:]]+.*,,dat1$shell_ID)),as.numeric(gsub(.*\\_,,dat1$shell_ID)) ) dat1 -

Re: [R] Char to Numeric --- Type Conversion

2014-04-01 Thread arun
Hi, May be this helps: set.seed(445) dat1 - as.data.frame(matrix(sample(seq(2,4,by=0.5),80,replace=TRUE),ncol=20),stringsAsFactors=FALSE) dat1[dat1==2] - dat1[,sapply(dat1,is.character)] - lapply(dat1[,sapply(dat1,is.character)] ,as.numeric) identical(sum(sapply(dat1,is.numeric)),

[R] 127.0.0.1:22381/doc/html/index.html won't start

2014-04-01 Thread Christian Hoffmann
Dear All, Sorry to bother you. I am using Aquamacs 3.0a (GNU Emacs 24.3.50.2), newly installed. Somehow, on my mac even the newly installed R3.0.3 will mill endlessly after M-x R waiting for 127.0.0.1:22381/doc/html/index.html to load. How can I find out, what is wrong with my

[R] 127.0.0.1:22381/doc/html/index.html won't start 2.

2014-04-01 Thread Christian Hoffmann
Dear All, Sorry to bother you. I am using Aquamacs 3.0a (GNU Emacs 24.3.50.2), newly installed, on Mac OSX 10.7.5 . Somehow, on my mac even the newly installed R3.0.3 will mill endlessly after M-x R waiting for 127.0.0.1:22381/doc/html/index.html to load. How can I find out, what is

Re: [R] Plotting Satellite

2014-04-01 Thread Michael Sumner
Hi, What are the columns in sat.mat? I can see that, sat.mat[,1:2] are longitude and latitude in some form but we don't even know what dim(sat.mat)[2] is from what you've shown. You can avoid the loops (untested): asub - sat.mat[,1] = long.min sat.mat[,1] = long.max sat.mat[,2] = lat.min

Re: [R] Plotting Satellite

2014-04-01 Thread Dao_De
sorry i forgot to put the file; Here it is https://www.dropbox.com/s/paau32l6bth5t8r/pow_sat_file.txt -- View this message in context: http://r.789695.n4.nabble.com/Plotting-Satellite-tp4687971p4687981.html Sent from the R help mailing list archive at Nabble.com.

[R] MULTIPLE LEVELS for a SINGLE VALUE in a dataframe, how do I remove these?

2014-04-01 Thread elle
I have a series of dates and times in one column. They are all in the format %m/%d/%Y %H:%M:%S; however, they are character values. I have a number of problems: 1) if I use antdist$ts[1] to just examine the FIRST value of the timestamp (ts) column, it shows that there are 144873 Levels, and it

[R] Process Forked at MAC

2014-04-01 Thread Rodrigo Martinez Flores
Dear Guys.. Thank you very much for taking time to answer these questions. I 'm running simple command directly on R console: corpus=tm_map(corpus,tolower) giving this result: The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). Once and

Re: [R] 127.0.0.1:22381/doc/html/index.html won't start

2014-04-01 Thread Duncan Murdoch
On 01/04/2014, 4:13 PM, Christian Hoffmann wrote: Dear All, Sorry to bother you. I am using Aquamacs 3.0a (GNU Emacs 24.3.50.2), newly installed. Somehow, on my mac even the newly installed R3.0.3 will mill endlessly after M-x R waiting for 127.0.0.1:22381/doc/html/index.html to load. How

Re: [R] Centered difference operation on matrix with R

2014-04-01 Thread Pascal Oettli
Dear list members, The answer is in package pracma, function gradient. Regards, Pascal Oettli On Fri, Mar 28, 2014 at 2:51 PM, Pascal Oettli kri...@ymail.com wrote: Dear list members, I am wondering whether there is any more efficient way to calculate centered difference on matrix in R?

Re: [R] labelling a plot in binom library function call

2014-04-01 Thread Pascal Oettli
Hello, The binom package is using ggplot2 to plot the density. Thus, you have to follow the ggplot2 syntax: R binom.bayes.densityplot(hpdc) + ggtitle(my plot) HTH Pascal On Tue, Apr 1, 2014 at 7:41 AM, Chris chris.bar...@barkerstats.com wrote: Hi, I'm using a function in the binom library.

[R] Difficulty coding time-forced functions in deSolve

2014-04-01 Thread Aimee Kopolow
Hi all, I'm trying to use deSolve to solve a series of differential equations with rk4 mimicking a SEIR model, while including an event/function that is not solely time-dependent. Explicitly: I want to introduce vaccination 7 days after the proportion of I2/N2 reaches 0.01. Here is the code I

Re: [R] MULTIPLE LEVELS for a SINGLE VALUE in a dataframe, how do I remove these?

2014-04-01 Thread Frede Aakmann Tøgersen
Hi 'What is your name?' When you read the data into R the first column was interpreted as a factor where the levels are the timestamps. If you used read.table() there is the stringsAsFactor you can set to FALSE so that the first column will be read in as strings instead of a factor. However