data.frame(as.table(as.matrix(table(paste('MyData$',V1),
paste('MyData$',V2), useNA = "ifany"
name2<- c(V1, V2, "Frequency")
names(dMyT) <- name2
ggplot(data = na.omit(dMyT), aes(fill=V2, y=Frequency, x=V1)) +
geom_bar(position="do
. I believe there is a way to do it. I tried “paste” function (as
below), but it did not work either.
Any comment/help is deeply appreciated.
Kind Regards
Seyit Ali
##
V1 <- "Gender"
V2 <- "Hand"
MyT2 <- tabl
,V1),
paste('MyData$',V2), useNA = "ifany"
name2<- c(V1, V2, "Frequency")
names(dMyT) <- name2
ggplot(data = na.omit(dMyT), aes(fill=V2, y=Frequency, x=V1)) +
geom_bar(position="dodge", stat="identity")
Hello,
Or maybe V1 and V2 are variables that hold column names?
If so see thess StackOverflow posts [1], [2]. The trick is to use [[,
not $ to extractthe columns.
V1 <- "Gender"
V2 <- "Hand"
MyT2 <- table(MyData[[V1]], MyData[[V2]])
[1]:
https://stackoverflow.com/questions/1886/dynami
Sorry, Bert, I also forgot to copy to the list.
Hi Seyet Ali,
If you have created the data frame, you probably know that "Gender",
"Hand" and "Gr" are the names of the vectors of values that are joined
in the data frame "MyData". You now wish to change those names. I
don't know why you would chang
This is a *plain text* list. As you can see from the included text that I
received, the HTML version that you sent was somewhat mangled by the
server. I do not know whether or not enough got through for you to get a
helpful reply, but if not, re-send *to the list, not me* in *plain text*.
Bert Gu
Dear R users,
�
I have a data frame as below. In part 1, I have created a table for Gender and
Hand, performed Chi-Square test and made graph using ggplot.
�
I want to replace the original variable names (Gender and Hand) with V1 and V2
and to be able to perform those things again as in #pa
7 matches
Mail list logo