similar to: Applying "toupper" to only portions of text strings

Displaying 20 results from an estimated 7000 matches similar to: "Applying "toupper" to only portions of text strings"

2008 Apr 11
3
strsplit and sapply
Colleagues, I have some text: TEXT <- c("a", "bb;ccc", "dddd;eeeee;ffffff") I want to retrieve the portion of each element before the first semicolon. I can split each element using strsplit: SPLIT <- strsplit(TEXT, ";") This yields: > SPLIT [[1]] [1] "a" [[2]] [1] "bb" "ccc" [[3]] [1] "dddd"
2013 Apr 11
4
Understanding contents of packages
Colleagues During the transition to R3.0.0 (OS X), one of the packages that I used -- SASxport -- did not work until I used the "type=source" option in install.packages. This led to an adventure: 1. I downloaded the package source: SASxport_1.2.4.tar.gz 2. in the SASxport/R folder, I found all the functions that are part of the package. I became interested in whether I could
2005 Jul 22
3
Question regarding subsetting
I run R 2.1.1 in a Linux environment (RedHat 9) although my question is not platform-specific. Consider the following: > A <- c("Prefix-aaa", "Prefix-bbb", "Prefix-ccc") > B <- strsplit(A, "-") > B [[1]] [1] "Prefix" "aaa" [[2]] [1] "Prefix" "bbb" [[3]] [1] "Prefix" "ccc" How
2011 Jun 13
3
combine the data frames into comma separated list.
Hi R users, I am new to R and am trying to merge data frames in the following way. Suppose I have n data frames each with two fields. Field 1 is common among data frames but may have different entries. Field 2 is different. Data frame 1: Src Target1 1 aaa 1 bbb 1 ccc 2 aaa 3 ddd Data frame 2: Src Target2 2 aaaa 3 dddd 4 bbbb 4
2017 Sep 22
1
Embedding PDF into RTF document via R language
R 3.4.1 OS X and Windows Colleagues I have a complicated problem that includes several components: R RTF PDF Using R (and a slew of RTF commands), I assemble a text document with an RTF extension. The document contains text, tables, and images (JPEG format, previously created with R). To ?import? the JPEG images into the document, I use the following R code: cat("\\pard\\qc
2009 Apr 13
3
toupper does not work in sub + regex
Hi, I don't know what I am doing wrong to the toupper does not seem working in sub + regex. The following returns 's' not the upper class 'S' as I expect: sub("q_([a-z])[a-zA-Z]*",toupper('\\1'),"q_sviRaw") Can someone tell me where I did wrong? Thanks, Richard [[alternative HTML version deleted]]
2011 Jun 14
1
[Resolved] combine the data frames into comma separated list.
Hi Thanks Gabor for your suggestion. I am posting the code that worked for me. dataframe1 = data.frame(cbind(Src = c(1,1,1,2,3), Target1 = c('aaa','bbb','ccc','aaa','ddd'))); #must be data frame dataframe2 = data.frame(cbind(Src = c(2,3,4,4,4), Target2 = c('aaaa','dddd','bbbb','eeee','ffff'))); dataframe3 =
2011 Mar 25
2
Finding the common portion of strings
Colleagues R: 2.12.2 OS X I have a set of text objects in the form (I am showing 3 of what is more likely to be 20 or so): OBJECTS <- c("abcSOMETHINGCOMMONegf", "xSOMETHINGCOMMONyz", "SOMETHINGCOMMONnme") As you can see, all contain "SOMETHINGCOMMON" and the position varies. But, I don't know what that "SOMETHINGCOMMON" is. Is there an
2010 Feb 12
1
Identifying special characters in a text file
Colleagues R 2.10.1 on a Mac I read in textfiles using readLines, then I process those files, then I use R to execute another program. Occasionally those files contain characters other than letter / numbers / routine punctuation marks. For example, a bullet (option-8 on a Mac) triggers the problem. Although R can read and process those characters, the other program cannot so I would like to
2008 Dec 09
2
Replacing tabs with appropriate number of spaces
Colleagues, Platform: OS X (but issue applies to all platforms) Version: 2.8.0 I have a mixture of text and data that I am outputting via R to a pdf document (using a fixed-width font). The text contains tabs that align columns properly with a fixed-width font in a terminal window. However, when the PDF document is created, the concept of a tab is not invoked properly and columns do
2009 Nov 13
5
Help with complicated regular expression
Colleagues, I am using R (2.9.2, all platforms) to search for a complicated text string using regular expressions. I would appreciate any help you can provide. The string consists of the following elements: SOMEWORDWITHNOSPACES any number of spaces and/or tabs ( any number of spaces and/or tabs integer any number of spaces and/or tabs ) Examples include: WORD ( 123 ) WORD(1 )
2011 Mar 29
2
Probing a function
R 2.12.2 Windows 7 Colleagues, I just took advantage of the function: readWindowsShortcut in R.utils. It accomplished my goals and I was interested in learning its inner workings. So, I typed the function at the command line (without arguments or parentheses). R returned: function (...) UseMethod("readWindowsShortcut") <environment: namespace:R.utils> providing no
2011 Apr 10
3
Adding margin text to lattice graphics
Colleagues I am learning lattice graphics (R 2.12.2; OS X). Several days ago, I inquired about adding margin text to lattice graphics. Jim Price offered a useful reply, suggesting that I add: page = function(page) grid.text('words', x = 0.5, y = 0.01) to my call to the function. The entire function that he suggested was; xyplot(1 ~ 1, par.settings = list(layout.heights =
2023 Jan 16
3
Printing special characters
R 4.2.2 OS X Colleagues A file that I have read includes strings like this: "EVENT ? 30 sec" When I include the string in a graphic using: mtext(STRING, ?) it appears as: "EVENT ... 30 sec" Is there a simple work-around (short of reformatting all the strings, then using plotmath)? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax:
2009 Jan 15
1
[Q] R CMD check signals error on code that works from UI
Add the following to example section of a dot-Rd manpage: ## :WHY: The following kills R CMD check but runs fine on console. foos <- c("aaa", "bbb", "ccc") cat(sapply(foos, function(foo) { sprintf("name: %-18s upper: %s\n", foo, toupper(foo)) }), sep="") R CMD
2010 Jul 20
1
Registered / trademark signs
Colleagues, What is the easiest means to embed a: ? (registered) or ? (trademark) sign in text in a graphic. I would like to use mtext and avoid plotmath, if possible. Ideally, the sign should be superscripted but I can easily sacrifice that. Optimally, I need a solution that works in both OS X and Windows (? XP) and with R versions ? 2.11 Thanks in advance. Dennis Dennis Fisher MD P <
2018 Feb 22
2
Problem with geterrmessage()
Luke Thanks ? I revised the code to: ERRORMESSAGE <- try(source(USERSCRIPTFILE, local=T), silent=T) print(ERRORMESSAGE) now returns: $value [1] 0 $visible [1] FALSE Not clear what to make of that. Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax: 1-866-PLessThan (1-866-753-7784) www.PLessThan.com > On Feb 22, 2018, at 12:45 PM, luke-tierney at
2010 May 05
1
Unexpected call to "require"
Colleagues I am executing a length script in R (20K lines). At one point, it returns: > Loading required package: tcltk > Loading Tcl/Tk interface ... done > Loading required package: Hmisc > Loading required package: survival > Loading required package: stats > Loading required package: graphics > Loading required package: splines > Attaching package: 'Hmisc'
2020 Oct 24
0
Package recommendations for outputting table with cell formatting
Will this need to be done many times? If not, it might be just as easy to apply conditional formatting to cells after they're already in Excel. On Fri, Oct 23, 2020 at 8:28 PM Dennis Fisher <fisher at plessthan.com> wrote: > > R 4.0.2 > OS X > > Colleagues > > I have the unfortunate need to create a large number of tables (destined for a Word document). I need to
2009 Sep 29
3
Deleting a column in a dataframe by name
Colleagues, Hopefully a simple problem: I want to delete a column with a known name from a dataframe. I could write: FRAME <- FRAME[, names(FRAME) != NAMETODELETE] or FRAME <- FRAME[, !names(FRAME) %in% c(NAME1, NAME2, ETC)] Is there some simpler means to accomplish this? Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone: 1-866-PLessThan (1-866-753-7784)