[R] Text Mining - Remove punctuation not removing quotes and dashes

2015-06-07 Thread Anindya Sankar Dey
Hi, I have been doing some text mining. I created the DTM matrix using the following steps. corpus1<-VCorpus(VectorSource(resume1$Dat1)) corpus1<-tm_map(corpus1,content_transformer(tolower)) dtm<-DocumentTermMatrix(corpus1, control = list(removePunctuation = TRUE,

Re: [R] problems editing R console

2015-06-07 Thread Mark Sharp
Rosa, See save() and load() functions for background. However, I suspect you will want to do something as described in the article in this link http://www.fromthebottomoftheheap.net/2012/04/01/saving-and-loading-r-objects/ Mark R. Mark Sharp, Ph.D. Director of Primate Records Database South

Re: [R] problems editing R console

2015-06-07 Thread Carlos Andrade
Rosa, Why not just re-load the .txt file (which I imagine be a data frame) and then edit? See: http://www.inside-r.org/r-doc/utils/read.table *I would imagine something along the lines:* simulation_results <- read.table("path_to_text_file_of_simulation") #Double check the parameters on the fun

Re: [R] problems editing R console

2015-06-07 Thread Bert Gunter
I believe that you need to learn to use a code editor/IDE. R is a programming language. See here: http://www.rstudio.com/ or here: http://www.sciviews.org/_rgui/ Otherwise, I also don't understand. Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainl

Re: [R] problems editing R console

2015-06-07 Thread stephen sefick
?saveRDS On Sun, Jun 7, 2015 at 5:58 PM, Rosa Oliveira wrote: > Dear Mark, > > > I’ll try to explain better. > > Imagine I write: > > library(foreign) > library(nlme) > > set.seed(1000) > n.sample<-1 #sample size > M <- 5 > DP_x <- 2 > x <- rnorm(n.sample,M,DP_x) > p <- pnorm(-3+x) > y <- rb

Re: [R] problems editing R console

2015-06-07 Thread Rosa Oliveira
Dear Mark, I’ll try to explain better. Imagine I write: library(foreign) library(nlme) set.seed(1000) n.sample<-1 #sample size M <- 5 DP_x <- 2 x <- rnorm(n.sample,M,DP_x) p <- pnorm(-3+x) y <- rbinom(n.sample,1,p) dp_erro <- 0.01 erro <- rnorm(n.sample,0,dp_erro) x.erro <- x+erro but w

Re: [R] source code for dbeta

2015-06-07 Thread Duncan Murdoch
On 07/06/2015 6:11 PM, Mark Sharp wrote: > Varun, > > If you type dbeta at the command line you get the R source, which in this > case tells you that the code is calling a compiled source. This is indicated > by the line No, that says that the R code (what is shown) is compiled. What indicate

Re: [R] source code for dbeta

2015-06-07 Thread Mark Sharp
Varun, I apologize. I hit send before completing. Look at the source document in the link I provided. dbeta is part of the stats package, which is part of the core R system and I do not think it is available as a standalone package. The linked document provides instructions for finding base R

Re: [R] source code for dbeta

2015-06-07 Thread Mark Sharp
Varun, If you type dbeta at the command line you get the R source, which in this case tells you that the code is calling a compiled source. This is indicated by the line See the following. > dbeta function (x, shape1, shape2, ncp = 0, log = FALSE) { if (missing(ncp)) .Call(C_dbe

[R] problems editing R console

2015-06-07 Thread Rosa Oliveira
Dear all, I’m doing simulations on R, and as my code is being changed and improved I need to, sometimes, work in finished simulations, i.e, After my simulation is over I need to settle another setting. The problem is that I need to get back to the previous result. When I save the result it sa

Re: [R] if else statement for rain data to define zero for dry and one to wet

2015-06-07 Thread roslinazairimah zakaria
Dear all, All works well. Thank you so much for your help. D## Function 1 wet_dry1 <- function(x,thresh=0.1) { for(column in 1:dim(x)[2]) x[,column] <- ifelse(x[,column]>=thresh,1,0) return(x) } wet_dry1(dt) ## Function 2 wet_dry2 <- ( dt >= 0.1)*1 wet_dry2 wet_total <- colSums(wet_dry2) p

[R] source code for dbeta

2015-06-07 Thread Varun Sinha
Hi, I am trying to find the source code for dbeta function. I tried edit(dbeta) and this is what I got: > edit(dbeta) function (x, shape1, shape2, ncp = 0, log = FALSE) { if (missing(ncp)) .Call(C_dbeta, x, shape1, shape2, log) else .Call(C_dnbeta, x, shape1, shape2, ncp, log) }

[R] Cross-over Data with Kenward-Roger correction

2015-06-07 Thread knouri
Dear all:for the folowing data, a two-period, two treatment (A=1 vs. B=2) cross-over is fitted using the folowing SAS code.  data one; input  Sbj  Seq  Per  Trt  PEF; cards; 1  1   1   1   310 1  1   2   2   270 4  1   1   1   310 4  1   2   2   260 6  1   1   1   370 6  1

Re: [R] Simulating data from a nested design

2015-06-07 Thread Greg Snow
The examples on the help page for the function "simfun" in the TeachingDemos package have some examples of simulating data from nested designs with some terms fixed and some random. I don't think any of the examples match your conditions exactly, but could be modified to do so (changing a random e

Re: [R] how to read a local JSON file

2015-06-07 Thread Prof Brian Ripley
On 07/06/2015 08:10, Berend Hasselman wrote: On 07-06-2015, at 07:50, Ye Lin wrote: Hi All, I downloaded a data file from dropbox and its in JSON format. here is my code: library(RJSONIO) data <- fromJSON(file='C:/Users/Downloads/sample.json') Lines <- readLines("C:/Users/Downloads/sample.j

Re: [R] how to read a local JSON file

2015-06-07 Thread Berend Hasselman
> On 07-06-2015, at 07:50, Ye Lin wrote: > > Hi All, > > I downloaded a data file from dropbox and its in JSON format. > > here is my code: > library(RJSONIO) > data <- fromJSON(file='C:/Users/Downloads/sample.json') > Lines <- readLines("C:/Users/Downloads/sample.json") > df <- as.data.frame(