Re: [R] Variable and value labels

2023-07-12 Thread Anupam Tyagi
Thanks. Sorry, I have not consulted help pages, but did a web search. Web search results are referring to some package or the other for doing labels. Thanks for letting me know that this can be done in base-R. I will try to find the relevant information in R documentation. On Wed, 12 Jul, 2023,

Re: [R] Variable and value labels

2023-07-12 Thread Anupam Tyagi
Very interesting! Thanks! On Wed, 12 Jul, 2023, 7:58 pm Viechtbauer, Wolfgang (NP), < wolfgang.viechtba...@maastrichtuniversity.nl> wrote: > For value labels, factor() provides the necessary machinery. For variable > labels, one could make use of comment() (something that not too many people >

Re: [R] Variable and value labels

2023-07-12 Thread Viechtbauer, Wolfgang (NP)
For value labels, factor() provides the necessary machinery. For variable labels, one could make use of comment() (something that not too many people seem to know about). To illustrate: # look at the mtcars dataset mtcars # turn 'am' into a factor and use labels for the two possible levels

[R] Just to you

2023-07-12 Thread avi.e.gross
John, I am a tad puzzled at why your code does not work so I tried replicating it. Let me say you are not plotting what you think. When you plot points using characters, it LOOKS like it did something but not really. It labels four equally apart lines (when your data is not linear) and you are

Re: [R] Variable and value labels

2023-07-12 Thread avi.e.gross
Anupam, Your question, even after looking at other messages, remains a bit unclear. What do you mean by "labels"? What you mean by variables and values and how is that related to factors? An example or two would be helpful so we can say more than PROBABLY. Otherwise, you risk having many people

[R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-12 Thread Sorkin, John
I am trying to plot four points, and join the points with lines. I can plot the points, but I can't plot the points and the line. I hope someone can help my with my ggplot code. # load ggplot2 if(!require(ggplot2)){install.packages("ggplot2")} library(ggplot2) # Create data Time <-

Re: [R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-12 Thread Jim Lemon
Hi John, I'm not sure how to do this with ggplot, but: Time<- c("Age.25","Age.35","Age.45","Age.55") Medians<-c(128.25,148.75,158.5,168.75) > is.character(Time) # [1] TRUE - thus it has no intrinsic numeric value to plot > is.numeric(Medians) # [1] TRUE # coerce Medians to factor and then plot

Re: [R] Variable and value labels

2023-07-12 Thread Martin Maechler
> Anupam Tyagi > on Wed, 12 Jul 2023 09:18:55 +0530 writes: > Hello, > is there an easy way to do variable and value labels (for > factor variables) in base-R, without using a package. Yes, there are many. How many help pages (in R , i.e. base-R) did you consult?