Re: [R] Creating Dummy Var in R for regression?

2016-08-05 Thread jeremiah rounds
Something like: d = data.frame(score = sample(1:10, 100, replace=TRUE)) d$score_t = "low" d$score_t[d$score > 3] = "medium" d$score_t[d$score >7 ] = "high" d$score_t = factor(d$score_t, levels = c("low", "medium", "high"), ordered=TRUE) #set ordered = FALSE for dummy variables X = model.matrix(

Re: [R] Creating Dummy Var in R for regression?

2016-08-05 Thread Shivi Bhatia
Thanks you all for the assistance. This really helps. Hi Bert: While searching nabble i got to know R with factors variables there is no need to create dummy variable. However please consider this situation: I am in the process of building a logistic regression model on NPS data. The outcome varia

Re: [R] RGL library loading issues

2016-08-05 Thread David Winsemius
> On Aug 5, 2016, at 1:34 PM, Duncan Murdoch wrote: > > On 05/08/2016 1:04 PM, Adrian Johnson wrote: >> Dear group: >> I installed rgl on my mac through terminal. I used >> install.packages(rgl) and selected 118 server option. >> Installation went well until, I get message checking if installe

Re: [R] adding a date column with dplyr

2016-08-05 Thread MacQueen, Don
What's wrong with this? df$Night <- as.POSIXct( paste(format(df$Date,'%Y-%m-%d'),'21:30')) or df$Night <- trunc(df$Date,'day') + 21*60*60 + 30*60 I believe both of those satisfy "the day of tracking for each animal, but with the time of 21:30". But perhaps you meant the day that tracking starte

Re: [R] Creating Dummy Var in R for regression?

2016-08-05 Thread Bert Gunter
Just commenting on the email subject, not the content (which you have already been helped with): there is no need to *ever* create a dummy variable for regression in R if what you mean by this is what is conventionally meant. R will create the model matrix with appropriate "dummy variables" for fac

Re: [R] Creating Dummy Var in R for regression?

2016-08-05 Thread ruipbarradas
Hello, Your ifelse will never work because reasons$salutation== "Mr" & reasons$salutation=="Father" is always FALSE and so is reasons$salutation=="Mrs" & reasons$salutation=="Miss". Try instead | (or), not & (and). Hope this helps, Rui Barradas   Citando Shivi Bhatia : > Dear Team, > > I need

Re: [R] RGL library loading issues

2016-08-05 Thread Duncan Murdoch
On 05/08/2016 1:04 PM, Adrian Johnson wrote: Dear group: I installed rgl on my mac through terminal. I used install.packages(rgl) and selected 118 server option. Installation went well until, I get message checking if installed packages working and nothing happens. I opened another terminal wi

Re: [R] makePSOCKcluster launches different version of R

2016-08-05 Thread Martin Morgan
On 08/05/2016 12:07 PM, Guido Kraemer wrote: Hi everyone, we are running R on a Linux Cluster with several R versions installed in parallel. If I run: library(parallel) cl <- makePSOCKcluster( rep('nodeX', 24), homogeneous = FALSE, rscript = '/usr/local/apps/R/R-3.2.2/bin/Rscript' ) fr

[R] Creating Dummy Var in R for regression?

2016-08-05 Thread Shivi Bhatia
Dear Team, I need help with the below code in R: gender_rec<- c('Dr','Father','Mr'=1, 'Miss','MS','Mrs'=2, 3) reasons$salutation<- gender_rec[reasons$salutation]. This code gives me the correct output but it overwrites the reason$salutation variable. I need to create a new variable gender to ca

Re: [R] R help

2016-08-05 Thread Ulrik Stervbo
I'm not quite sure if this is what you are looking for: example.df <- data.frame(words= c("A T", "Z H", "B E", "C P H"), badwords = c("A|I|J|H|K|L")) # Extract the column with bad words badwords <- example.df$badwords badwords <- as.character(badwords[1]) # Subset the data.frame subset(example.d

[R] RGL library loading issues

2016-08-05 Thread Adrian Johnson
Dear group: I installed rgl on my mac through terminal. I used install.packages(rgl) and selected 118 server option. Installation went well until, I get message checking if installed packages working and nothing happens. I opened another terminal window and types library(rgl) and I see my X11qu

[R] makePSOCKcluster launches different version of R

2016-08-05 Thread Guido Kraemer
Hi everyone, we are running R on a Linux Cluster with several R versions installed in parallel. If I run: library(parallel) cl <- makePSOCKcluster( rep('nodeX', 24), homogeneous = FALSE, rscript = '/usr/local/apps/R/R-3.2.2/bin/Rscript' ) then still R-3.0.0 gets launched on nodeX. Vers

[R] adding a date column with dplyr

2016-08-05 Thread Alice Domalik
Hi all, I'm having some difficulties adding a conditional element to my code. I have a time series data set that contains GPS tracking coordinates for a population of animals. IDDate Latitude Longitude 15K12 2014-05-22 04:33

[R] Graphical output of density for the function gammamixEM (package mixtools)

2016-08-05 Thread Marine Regis
Hello, I'm using the function gammamixEM from the package mixtools. How can I return the graphical output of density as in the function normalmixEM (i.e., the second plot in plot(x, density=TRUE)) ? Thank you very much for your time. Have a nice day. Marine [[alternative HTML versio

[R] (Solved] Re: pubmed.mineR

2016-08-05 Thread David Winsemius
> On Aug 4, 2016, at 9:52 PM, Mehdi Najafi wrote: > > -- Forwarded message -- > From: Mehdi Najafi > Date: Fri, Aug 5, 2016 at 9:17 AM > Subject: pubmed.mineR > To: r...@igib.in > > > Hi dear helper, it has been a pleasure to read magnificat paper titled > "pubmed.mineR: An R

Re: [R] R help

2016-08-05 Thread ruipbarradas
Hello, Please use ?dput to post a data example. Use something like the following, where 'dat' is the name of your data.frame. dput(head(dat, 30))  # paste the output of this in a mail Hope this helps, Rui Barradas   Citando Вова Грабарник : > Dear R command, > > I was wondering if I could a

[R] R help

2016-08-05 Thread Вова Грабарник
Dear R command, I was wondering if I could ask you recommendations on my problem if that is fine with you. Basically, I have a data frame with 5 columns and 10 000 tweets recorded(rows). Those columns are: numberofatweet(number), tweet (actual textual tweet), locations(from where tweet sent), badw

Re: [R] Freq in dataframe

2016-08-05 Thread Marc Schwartz
> On Aug 5, 2016, at 4:43 AM, Tripoli Massimiliano > wrote: > > Dear R users, > > # This is my data: > > ddat <- array(c(8,10,7,13,8,15, > 7,9,6,9,7,10, > 11,13,7,16,8,16 > ), > dim = c(2,3,3), > dimnames = list( >

Re: [R] Freq in dataframe

2016-08-05 Thread peter dalgaard
You want to use the as.data.frame method for tables, so > ddat <- as.table(ddat) > as.data.frame(ddat) Time Dose Group Freq 1 Week 32 Dose 1 A8 2 Week 52 Dose 1 A 10 3 Week 32 Dose 2 A7 4 Week 52 Dose 2 A 13 5 Week 32 Dose 3 A8 6 Week 52 Dose 3

[R] Segmentation Fault on Unix box with nloptr, works on Windows

2016-08-05 Thread Corak, Robert (US - Newton)
I have an R script that is giving me a Segmentation Fault depending on the size of the dataset. It is only happening on our Unix installation of R Server. I am able to run it against a Windows server with the exact same data and script successfully. The Segmentation Fault occurs when I call n

[R] Fwd: pubmed.mineR

2016-08-05 Thread Mehdi Najafi
-- Forwarded message -- From: Mehdi Najafi Date: Fri, Aug 5, 2016 at 9:17 AM Subject: pubmed.mineR To: r...@igib.in Hi dear helper, it has been a pleasure to read magnificat paper titled "pubmed.mineR: An R package with text-mining algorithms to analyse PubMed abstracts". I encun

[R] SAS file

2016-08-05 Thread Yuan Jian via R-help
Hello,I have a SAS formatted file as attached, when I use lookup.xport i got error below> lookup.xport("patient.ssd01")Error in lookup.xport.inner(file) :   unable to open file: 'No such file or directory' can anyone please help me to figure it out? thanksyuan ___

[R] Freq in dataframe

2016-08-05 Thread Tripoli Massimiliano
Dear R users, # This is my data: ddat <- array(c(8,10,7,13,8,15, 7,9,6,9,7,10, 11,13,7,16,8,16 ), dim = c(2,3,3), dimnames = list( Time = c("Week 32","Week 52"), Dose = c("Dose 1","Dose 2","Dose

Re: [R] Three way correspondence analyses?

2016-08-05 Thread Suparna Mitra
Sorry somehow the mail was buried in my spam folder and I was waiting for any reply. Now when I searched specifically then found in spam. Sorry about this. This is my data format. I have three data matrix. Samples are matched > dput(Cytok_and_ProInf) structure(list(IFN._ = c(3.412082432, 3.052252