similar to: how to word-wrap text in labels in plots?

Displaying 20 results from an estimated 1000 matches similar to: "how to word-wrap text in labels in plots?"

2010 Sep 30
7
how to make list() return a list of *named* elements
If I combine elements into a list b <- c(22.4, 12.2, 10.9, 8.5, 9.2) my.c <- sample.int(round(2*mean(b)), 5) my.list <- list(b, my.c) the names of the elements seems to get lost in the process: > str(my.list) List of 2 $ : num [1:5] 22.4 12.2 10.9 8.5 9.2 $ : int [1:5] 11 8 6 9 20 If I explicitly name the elements at list-creation, I get what I want: my.list <- list(b=b,
2007 Nov 01
2
ploting a comparison of two scores, including the labels in the plot
Hello r-help! I have data with two kind of ratings on status of 100 occupations. The first kind of rating is on the percieved "objective" status that these occupations have in society at large, and the second kind or rating is on the status that the respondents think that these occuption *should* have. The ratings were originally integer values in the rage 1-9, but in the current data,
2008 Feb 19
3
simple usage of "for"
Hi list I have a data frame I would like to loop over. To begin with I would like crosstabulations using the first variabel in the data frame, which is called "meriter". > table(meriter[[1]], meriter[[3]]) ja nej Annan 0
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,
2010 Apr 29
2
getting random integers
I want 100 integers. Each integer, x, can be in the range 1 =< x => 10. Does the following code give 1 and 10 the same chances to be selected as 2:8? round(runif(100, min = 1, max = 10)) -- Hans Ekbrand -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: Digital signature URL:
2009 Feb 17
1
frequency table for multiple variables
Hi r-help! Consider the following data-frame: var1 var2 var3 1 3 1 4 2 2 2 3 3 2 2 3 4 4 4 NA 5 4 3 5 6 2 2 3 7 3 4 3 How can I get R to convert this into the following? Value 1 2 3 4 5 var1 0 3 2 2 0 var2 1 3 1 2 0 var3 0 0 4 1 1 TIA, -- Hans Ekbrand (http://sociologi.cjb.net) <hans at
2009 Apr 08
1
read.spss, locale and encodings
I must be missing something obvious here: According to the help page for read.spss, the reencode option is only active when R is run under a UTF-8 locale. read.spss can only import the SPSS file when run under a iso88591(5) locale, under a UTF-8 locale I get: Error in read.spss("wo.sav") : error reading system-file header In addition: Warning message: In read.spss("wo.sav")
2009 Apr 08
1
Student
Hi, I have problem. In the function below (test and test2) i want the function test not to print the variable data but i want the function test2 to use the variable test$data. This is the creation of the variable data: > matrice=c(1:10) > matrice=matrix(matrice,nrow=5,ncol=2) This is the function test: > test=function(data){ + return(list(x=5,data=data)) + } This is the function
2008 Mar 03
3
Plot using colors
Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab="zeit [s]",ylab="Variation [%]", col = ifelse(var <= varstability, 'green','red')) this works well! But since I add a type="l" to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. Thanks. --
2012 Mar 10
3
function input as variable name (deparse/quote/paste) ??
Hi all Say I have a function: myname=function(dat,x=5,y=6){ res<<-x+y-dat } for various input such as myname(dat1) myname(dat2) myname(dat3) myname(dat4) myname(dat5) how should I modify the 'res' line, to have new informative variable name correspondingly, such as dat1.res dat2.res dat3.res dat4.res dat5.res stored in the workspace. This is only an example of a complex
2012 Mar 10
2
Issues in installing rgl in Mac OS 10.6.8
Dear All, I am trying to install rgl on my mac notebook from the source file. I tried using: /usr/bin/R64 CMD INSTALL rgl_0.92.798.tar.gz and get the following error message: checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package ?rgl? * removing ?/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl? *
2012 Mar 02
3
speed up merge
Hello, I have a nasty loop that I have to do 11877 times. The only thing that slows it down really is this merge: xx1 = merge(dt,ua_rd,by.x=1,by.y= 'rt_date',all.x=T) Any ideas on how to speed it up? The output can't change materially (it works), but I'd like it to go faster. I'm looking at getting around the loop (not shown), but I'm trying to speed up the merge first.
2011 Aug 16
3
Text wrap
Hi everyone. I have a long label that I would like to split. I found that I could use "strwrap" for simple text. However, this is not working with this label: str = expression(paste("< 20 ?m phytoplankton ","(cells ? ",mL^-1,")")) plot(...., ylab = strwrap(str,20),...) I suspect this is because I'm using "expression" for form my label.
2005 Apr 15
2
abbreviate or wrap dimname labels
For a variety of displays (mosaicplots, barplots, ...) one often wants to either abbreviate or wrap long labels, particularly when these are made up of several words. In general, it would be nice to have a function, abbreviate.or.wrap <- function(x, maxlength=10, maxlines=2, split=" ") { } that would take a character vector or a list of vectors, x, and try to abbreviate or wrap
2012 Apr 27
1
Wrap names.arg text in barplot
Hello! Does anyone know of a handy way to wrap the names.arg text in a barplot? I'm creating a bar plot with rather long labels; I can adjust the margins, but I'd also like to have the text wrap to about 4cm. Thanks! Kyle H. Ambert Doctoral Candidate, Bioinformatics Oregon Health & Science University ambertk@gmail.com [[alternative HTML version deleted]]
2009 Oct 19
1
How do I wrap a long mixed text/math expression in an axis label?
I would like to wrap a y-axis label onto two lines. My label is an expression containing both text and math symbols. I have looked at plotmath, strsplit(), strwrap(), deparse(), do.call(), substitute() and bquote(). Based on previous posts, I can get plain text to wrap. However, when I try these methods on my label, the exact string is returned, rather than evaluating the math symbols. My
2010 Jul 13
2
Wrap column headers caption
Hi: Using this dataframe with quite long column headers, how can I wrap the text so that the columns are narrower. I was trying to use strwrap without success. Thanks reportDF <- structure(list(IDDate = c("3/12/2010", "3/13/2010", "3/14/2010", "3/15/2010"), FirstRunoftheYear = c("33 (119 ? 119)", "n (0 ? 0)", "893 (110 ?
2009 Apr 07
0
Converting a whole dataframe (including attributes) from latin1 to UTF-8
Hi list! Short version: How do I convert a whole data.frame from latin1 encoding to utf8? I get SPSS files with latin1 encoding. My OS is GNU/Linux and the locale sv_SE.utf8, and I normally interface R with Emacs/ESS. I have used the following hack to convert a data.frame in latin1 to utf8: > Sys.setlocale(category = "LC_ALL", locale = "sv_SE.iso88591") > foo <-
2004 Dec 03
1
How to wrap or split labels on plot
Dear R gurus, I want to wrap labels that are too long for a plot. I have looked at strsplit(), substr(), nchar(), and strwrap(). I think it's some combination but I'm having difficulty trying to figure out the right combo. I think I need to create some new matrix containing the labels already split, though I'm not sure if maybe there is a quick and dirty way to address this
2009 Aug 25
2
allowing line wrap for long strip text in xyplot (lattice)
Hi. Am brand new to R and to mailing lists - have never posted anywhere before, so hope I do this right. Am using R 2.9.1 with lattice graphics (just installed, fully up to date). Am doing trellis xyplot with y (emp=employment), x (yearmo=a time measure) and conditioning variable (indf - factor describing industry) -- i.e., (emp ~ yearmo | indf), where all three variables are in a dataframe. The