Re: [R] Different stack barplots - same color legends

2018-11-04 Thread P. Roberto Bakker
e mate van toepassing is voor u of uw >> >> >> >>>> > supervisorengroep >> >> >> >>>> > `Ik weet precies wat de ‘modernisering van de opleiding’ >> >> >> >>>> > inhoudt` >> >> >> >>&

Re: [R] Different stack barplots - same color legends

2018-11-03 Thread P. Roberto Bakker
Thank you Op do 1 nov. 2018 om 00:25 schreef Jim Lemon : > Hi Roberto, > Here is a snippet of code that translates the text responses of the > BIS-11 into numeric values. Note the reversal of the order in the > second item: > > BIS$Q1<-as.numeric(factor(BIS$Q1, > levels=c("Almost","Often","Occas

Re: [R] Different stack barplots - same color legends

2018-11-03 Thread P. Roberto Bakker
t;>> > As you see the likert items are in words, and I should change > >> >> >>>> > them > >> >> >>>> > in > >> >> >>>> > nummeric - Am I correct? > >> >> >>>> > > >> >> &g

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Richard M. Heiberger
>> >>>> > then >> >> >>>> > I >> >> >>>> > receive the nummers a strings. >> >> >>>> > >> >> >>>> > *The syntaxes* >> >> >>>> > require(plyr) >> >>

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
Say your dataframe is named prb.df: oldnames<-names(prb.df) ncol<-ncols(prb.df) names(prb.df)<-paste0("Q",1:ncol) barplot(...,names.arg=oldnames,...) Jim On Fri, Nov 2, 2018 at 1:56 AM P. Roberto Bakker wrote: > > Yes, that is an good idea, only then I loose the original column lables which >

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread P. Roberto Bakker
Yes, that is an good idea, only then I loose the original column lables which I need in my barplot. Isn't it? Op do 1 nov. 2018 om 11:03 schreef Jim Lemon : > I would use the "names" or "colnames" functions to change them to Q1, > Q2, ... as I did. > > Jim > > On Thu, Nov 1, 2018 at 9:01 PM P. Ro

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
I would use the "names" or "colnames" functions to change them to Q1, Q2, ... as I did. Jim On Thu, Nov 1, 2018 at 9:01 PM P. Roberto Bakker wrote: > > Hi Jim, > > Thank you for your quick reply. It is a great procedure. > The response options in my data.frame are (fortunately) similar in all >

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread P. Roberto Bakker
Hi Jim, Thank you for your quick reply. It is a great procedure. The response options in my data.frame are (fortunately) similar in all columns. It would be nice if I could use your procedure in all columns at once instead of each column. My data.frame contains 48 columns, each with long column na

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
Hi Roberto, What I suggested is a brute force method of translating response options into ordinal numbers. Fortunately for me, the Barratt Impulsivity Scale has relatively short and constant response options. As I programmed the test myself, I already had the questions in plain text, so I simply ad

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread P. Roberto Bakker
Hi Jim, Thank you. An additional question: as I have many columns to change in numeric, and the columns are long sentences, what is an efficient way to do this? I checked in StackOverflow but could not find the right answer Best Roberto Op do 1 nov. 2018 om 00:25 schreef Jim Lemon : > Hi Robert

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread Jim Lemon
Hi Roberto, Here is a snippet of code that translates the text responses of the BIS-11 into numeric values. Note the reversal of the order in the second item: BIS$Q1<-as.numeric(factor(BIS$Q1, levels=c("Almost","Often","Occasionally","Rarely/Never"))) BIS$Q2<-as.numeric(factor(BIS$Q2, levels=c("

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread P. Roberto Bakker
;> >>>> > of uw supervisorengroep"= "4", > >> >>>> > "de situatie in zeer hoge mate van > >> >>>> > toepassing > >> >>>> > is > >> >>&

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread Richard M. Heiberger
;>> > of uw supervisorengroep"= "2", >> >>>> > "de situatie enigszins van toepassing is voor >> >>>> > u >> >>>> > of uw >> >>>> > supervisorengroep"= "3", >&

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread P. Roberto Bakker
> >>>> > toepassing is voor u of uw supervisorengroep", > >>>> > "de situatie in geringe mate van toepassing > is > >>>> > voor > >>>> > u of uw supervisorengroep", > >>>>

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread Richard M. Heiberger
enigszins van toepassing is voor >>>> > u of >>>> > uw supervisorengroep", >>>> > "de situatie in hoge mate van toepassing is >>>> > voor u >>>> > of uw supervisorengroep", >>&

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread P. Roberto Bakker
>> > >>> > Op ma 22 okt. 2018 om 17:13 schreef David L Carlson >> >: >>> > >>> >> Your example is not reproducible since you did not give us some sample >>> >> data. I suspect that your data frame consists of columns that >&g

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread Richard M. Heiberger
; teamq <- data.frame(V1=sample(c(1, 2, 4, 5), 25, replace = TRUE), >> >> V2=sample(c(1, 2, 3, 4, 5), 25, replace=TRUE), >> >> V3=sample(c(2, 3, 4, 5), 25, replace=TRUE)) >> >> >> >> Notice that this data frame ONLY contains questions (and o

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread P. Roberto Bakker
gt;> V3=sample(c(2, 3, 4, 5), 25, replace=TRUE)) > >> > >> Notice that this data frame ONLY contains questions (and only 3 > >> questions). Here are 2 ways to get what you want. The first one stacks > the > >> data: > >> > >> teamq.sta

Re: [R] Different stack barplots - same color legends

2018-10-22 Thread Richard M. Heiberger
> str(counts) >> >> Now make the plots: >> >> cols <- c("yellow","sandybrown","orange", "darkolivegreen","green") >> barplot(counts[, 1], horiz=TRUE, col=cols, legend=TRUE) >> barplot(counts[, 2], horiz=TRUE, c

Re: [R] Different stack barplots - same color legends

2018-10-22 Thread P. Roberto Bakker
quot;,"orange", "darkolivegreen","green") > barplot(counts[, 1], horiz=TRUE, col=cols, legend=TRUE) > barplot(counts[, 2], horiz=TRUE, col=cols, legend=TRUE) > barplot(counts[, 3], horiz=TRUE, col=cols, legend=TRUE) > > You will need to adjust the xli

Re: [R] Different stack barplots - same color legends

2018-10-22 Thread David L Carlson
day, October 22, 2018 9:04 AM To: R mailing list Subject: [R] Different stack barplots - same color legends Hi, I want to make barplots from different questions (columns) in one data.frame. Each question has the same 5 likert items. Now the problem: in some questions all items are answered; in

[R] Different stack barplots - same color legends

2018-10-22 Thread P. Roberto Bakker
Hi, I want to make barplots from different questions (columns) in one data.frame. Each question has the same 5 likert items. Now the problem: in some questions all items are answered; in other less. >From the syntax below I get nice stack barplots - *but the legend colors do not* refer to the same