Re: [R] Urgent - R help - Multivariate - Naive Bayes code for R

2018-05-24 Thread PIKAL Petr
Hi Within https://rseek.org/ I got quite a lot pages from query Multivariate Bernouli classification Maybe some of them could help you. Cheers Petr Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení odpovědnosti: https:

[R] how to make the code more efficient using lapply

2018-05-24 Thread Stephen HonKit Wong
Dear All, I have a following for-loop code which is basically intended to read in many excel files (each file has many columns and rows) in a directory and extract the some rows and columns out of each file and then combine them together into a dataframe. I use for loop which can do the work but q

[R] Prelude in R: a new introduction in R

2018-05-24 Thread Florent Bled
Hello every one! I'm really excited to finally introduce you and the world to "Prelude in R". www.preludeinR.com As you might have guessed by the name, this website is designed to give any person (students, managers, wildlife professionals, etc) the keys to start learning R, from scratch, using

[R] Urgent - R help - Multivariate - Naive Bayes code for R

2018-05-24 Thread Athmakuru Prasad
Friends, I am doing a URL classification, based on certain key words whether it contains an executive information or not. I have already went through 50K URL's and identified the key words and made it as 0, 1 ( 0 - do not have the key word and 1 - have the key word) and 0- do not contain executive

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Rui Barradas
Hello, I still don't understand, my code returns each imputation in a separate data.frame. mydata <- split(Imputed, cumsum(c(0, diff(Imputed$Y) != 1))) mydata[[1]] # X1 X2 Y #1 1 0 1 #2 2 1 2 #3 1 0 3 #4 2 1 4 #5 1 1 5 #6 2 1 6 #7 1 0 7 #8 2 1 8 And mydata[[2]] will be the o

Re: [R] Predictions from a Cox model - understanding centering of binary/categorical variables

2018-05-24 Thread Bert Gunter
Generally speaking, primarily statistical issues, which this appears to be, are OT on R-help, which is concerned with R programming issues (although they do someties intersect). You might therefore do better on a statistical forum such as stats.stackexchange.com (especially if you do not get a sat

[R] Predictions from a Cox model - understanding centering of binary/categorical variables

2018-05-24 Thread Bonnett, Laura
Dear all, I am using R 3.4.3 on Windows 10. I am preparing some teaching materials and I'm having trouble matching the by-hand version with the R code. I have fitted a Cox model - let's use the ovarian data as an example: library(survival) data(ovarian) ova_mod <- coxph(Surv(futime,fustat)~age+

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread MacQueen, Don via R-help
It would help if you show exactly the structure of your desired result, using the simple example data you supplied (what, exactly, do you mean by "array"?) If you want mydata[[1]] "to provide the values for all three 3 variables (Y, X1 and X2) of the first imputation only" then this will do it:

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Ioanna Ioannou
Hello everyone, Thank you for this. Nonetheless it is not exactly want i need. I need mydata[[1]] to provide the values for all 3 variables (Y, X1 and X2) of the first imputation only. As it stands it returns the whole database. Any ideas? Best, ioanna F

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Gerrit Eichner
Why not use as.matrix(Imp) in this case? Regards -- Gerrit Am 24.05.2018 um 17:04 schrieb Bert Gunter: This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric) vector

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Bert Gunter
This is one of those instances where a less superficial knowledge of R's technical details comes in really handy. What you need to do is convert the data frame to a single (numeric) vector for, e.g. a matrix() call. This can be easily done by noting that a data frame is also a list and using do.ca

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Rui Barradas
Hello, I am not sure I understand the question, but see if the following is what you want. split(Imputed, cumsum(c(0, diff(Imputed$Y) != 1))) Hope this helps, Rui Barradas On 5/24/2018 3:46 PM, Ioanna Ioannou wrote: Hello everyone, I want to transform a data.frame into an array (lets

[R] Manipulation of data.frame into an array

2018-05-24 Thread Ioanna Ioannou
Hello everyone, I want to transform a data.frame into an array (lets call it mydata), where: mydata[[1]] is the first imputed dataset...and for each mydata[[d]], the first p columns are covariates X, and the last one is the outcome Y. Lets assume a simple data.frame: Imputed = data.frame(

Re: [R] Problem with adding a raster and a brick

2018-05-24 Thread Michael Sumner
On Thu, 24 May 2018 at 18:41 Mark R Payne wrote: Hi, I seem to be having a problem adding the following two raster objects together - one is a rasterLayer, the other is a rasterBrick. The extent, resolution, and origin are the same, so according to my understand it should work. The objects look

[R] Problem with adding a raster and a brick

2018-05-24 Thread Mark R Payne
Hi, I seem to be having a problem adding the following two raster objects together - one is a rasterLayer, the other is a rasterBrick. The extent, resolution, and origin are the same, so according to my understand it should work. The objects look like so: > obs.clim class : RasterLayer dime