search for: strtrim

Displaying 16 results from an estimated 16 matches for "strtrim".

2010 Jun 03
3
reformat time from hhmm
...45 hours... [1] "2010-06-03 11:00:00" "2010-06-03 23:00:00" NA [4] "2010-06-03 10:01:00" "2010-06-03 12:38:00" "2010-06-03 19:22:00" Fair enough, so I tried a different angle, using an if...else statement: hours <- if(nchar(times)>3) strtrim(times,2) else strtrim(times,1) This worked great when times was only a vector of length=1, but when I try to apply it to something larger, I get the following warning: Warning message: In if(nchar(times)>3) strtrim(times,2) else strtrim(times,1) : the condition has length > 1...
2006 Oct 20
1
How to evaluate a Variable Name?
Hi, I have a dataframe Wash2005, which has daily weather data. I am doing a regression by month as follows: # FM10 Regression by Month # Plot 12 Month of OFM10, FFM10 for(i in 1:12) { Temp <- subset (Wash2005, MM == i) assign( paste('Wash2005FM10', strtrim(month.name[i],3), sep=""),lm(Temp$FM10.1 ~ Temp$FM10)) } Wash2005FM10Jan, Wash2005FM10Feb, etc holds the regression results for each month. Now, I want to sum up the residuals of all the 12 regression. How can I do that in a loop? For (i in 1:12){ Temp <- paste('sum(Wa...
2011 Nov 17
1
how to read a free text file into individual variables
...configinfo<-scan(file(configfile),ok=TRUE,n=-1) scan seems need every line have same column ? configinfo <- readLines(configfile,ok=TRUE,n=-1) methodnum <- unlist(strsplit(configinfo[2],":"))[2] methodname <- unlist(strsplit(configinfo[3],":")) time <- strtrim((unlist(strsplit(configinfo[4],":"))[2]),3) and time is a string "3 " and strtoi(time) failed and is "[1] NA" when time <- strtoi(strtrim((unlist(strsplit(configinfo[4],":"))[2]),1)) time is a integer "6" actually this parameter could be a...
2011 Nov 17
2
how to read a freetext line ?
hi everyone . Here I have a text where there are some integer and string variables.But I can not read them by readLines and scan the text is : weight ;30;130 food:2;1;12 color:white;black the first column is the names of the variables and others are the value of them. the column in different line are different. Can anyone help me ? -- TANG Jie Email: totangjie@gmail.com Tel: 0086-2154896104
2007 Aug 06
4
Function for trim blanks from a string(s)?
...anguage I've ever seen has a string function that trims blanks off strings (off the front or back or both). Ideally, it would process whole data frames/matrices etc but I don't even see one that processes a single string. But I've searched and I don't even see that. There's a strtrim function but it does something completely different. -- View this message in context: http://www.nabble.com/Function-for-trim-blanks-from-a-string%28s%29--tf4226133.html#a12022374 Sent from the R help mailing list archive at Nabble.com.
2018 Apr 02
0
New Package fansi: ANSI Control Sequence Aware String Functions
fansi provides counterparts to the base string manipulation functions substr, strwrap, strtrim, strsplit, and n(z)char that account for ANSI CSI SGR control sequences.? ANSI CSI SGR control sequences [1] can be used to format text in terminals that support them. For example the control sequence "\033[31m" causes text that follows to render in red, and the control sequence "\0...
2018 Apr 02
0
New Package fansi: ANSI Control Sequence Aware String Functions
fansi provides counterparts to the base string manipulation functions substr, strwrap, strtrim, strsplit, and n(z)char that account for ANSI CSI SGR control sequences.? ANSI CSI SGR control sequences [1] can be used to format text in terminals that support them. For example the control sequence "\033[31m" causes text that follows to render in red, and the control sequence "\0...
2010 Apr 14
2
search and replace
I have a dataframe with almost a million rows which has one column with strings. That column has several entries with the words "South", "North", "East" and "West" which I would like to replace with S, N, E, and W, respectively. Obviously, I can use gsub multiple times df $col2 <- gsub("West", "W", df$col2) which will require
2009 Aug 20
0
Sweave truncation
...st, Locked Bag 4 >Maroochydore DC Qld 4558 > >Tel: +61 7 5456 5085 >Fax: +61 7 5430 2896 >Email: <mailto:pdunn2@usc.edu.au>pdunn2@usc.edu.au >www.usc.edu.au > > > >>> Ken Knoblauch <ken.knoblauch@inserm.fr> 19/08/2009 7:56 pm >>> >perhaps, strtrim > >-- >Ken Knoblauch >Inserm U846 >Stem-cell and Brain Research Institute >Department of Integrative Neurosciences >18 avenue du Doyen Lépine >69500 Bron >France >tel: +33 (0)4 72 91 34 77 >fax: +33 (0)4 72 91 34 61 >portable: +33 (0)6 84 10 64 10 ><http://...
2006 Sep 21
0
A Call for a Smaller R Core Package
...rinsics and I know what they do." For R, I found it an intimidating task to flip through the 400+ pages core and retain a clear mind at the end. Below is a random sample of string related functions in the core package: agrep basename charmatch chartr gregexpr grep gsub regex regexpr strsplit strtrim strwrap sub In my opinion, anything that uses regular expressions belongs somewhere else. Even 'utils' seems to be a better place for random items than the 'core'. 2. Benefits of a smaller core a) A smaller core will be more carefully studied and better appreciated. If the R cor...
2006 Sep 20
1
problem coercing truncated character vector to levels
Dear R wizes, I have a data.frame of species abundances with column names consisting of 4 letter codes then an underscore and a number like this: abco_1, abco_2, abco_3, psm_1, psme_2, psme_3, etc. I would like to get an identifier for all the abco, and psme and other species etc. I used spec.fact<-substring(names(spec.count),1,4) To make a vector of the first 4 letters of
2007 Jan 31
5
Quick Question about R
Hello, Is there a way to convert a character to a number with out getting a warning? I have a vector that has both numbers and letters in it and I need to convert it to only numbers. At the moment I'm using as.numeric but it is generating a warning when it converts a letter. Is there another function out there that will do what I need or is there a way to turn off the warnings as I
2006 Oct 03
1
R-2.4.0 is released
...9; is no longer the second argument, and calls which used positional matching may be incorrect: we try to detect them. o See the section on 'Changes to S4 methods': all packages depending on 'methods' need to be re-installed. NEW FEATURES o agrep(), grep(), strwrap(), strtrim(), substr() and related functions now coerce arguments which should be character via as.character() rather than internally (so method dispatch takes place, e.g. for factors). chartr(), charfold(), tolower() and toupper() now coerce their main argument if necessary to a character vector via a...
2006 Oct 03
1
R-2.4.0 is released
...9; is no longer the second argument, and calls which used positional matching may be incorrect: we try to detect them. o See the section on 'Changes to S4 methods': all packages depending on 'methods' need to be re-installed. NEW FEATURES o agrep(), grep(), strwrap(), strtrim(), substr() and related functions now coerce arguments which should be character via as.character() rather than internally (so method dispatch takes place, e.g. for factors). chartr(), charfold(), tolower() and toupper() now coerce their main argument if necessary to a character vector via a...
2005 Apr 18
1
R-2.1.0 is released
...s been enhanced to allow the POSIX/XSI specifiers like "%2$6d", and also accepts "%x" and "%X". sprintf() does limited coercion of its arguments. sprintf() accepts vector arguments and operates on them in parallel (after re-cycling if needed). o New function strtrim() to trim character vectors to a display width, allowing for double-width characters in multi-byte character sets. o subset() now has a method for matrices, similar to that for data frames. o Faster algorithm in summaryRprof(). o sunflowerplot() has new arguments 'col' and...
2005 Apr 18
1
R-2.1.0 is released
...s been enhanced to allow the POSIX/XSI specifiers like "%2$6d", and also accepts "%x" and "%X". sprintf() does limited coercion of its arguments. sprintf() accepts vector arguments and operates on them in parallel (after re-cycling if needed). o New function strtrim() to trim character vectors to a display width, allowing for double-width characters in multi-byte character sets. o subset() now has a method for matrices, similar to that for data frames. o Faster algorithm in summaryRprof(). o sunflowerplot() has new arguments 'col' and...