similar to: paste - eliminate spaces?

Displaying 20 results from an estimated 70000 matches similar to: "paste - eliminate spaces?"

2009 May 07
1
paste with apply, spaces and NA
Hello everyone, I've come up with a problem with using paste() inside apply() that I can't seem to solve. Briefly, if I'm using paste to collapse the rows of a data frame, AND the data frame contains strings with spaces, AND there are NA values in subsequent columns, then paste() introduces spaces. This only happens with that particular combination of data values and commands. I have
2001 May 01
2
6 times faster by eliminating apply
This is some kind of follow-up to my previous posts. I have further improved the speed of my program 6 times by eliminating all the apply(). It turns out that apply is slow, is slower than direct loop, it is an order slower than a matrix operation alternative. Here is one example. The first apply version runs 19 seconds, the second loop version runs 13 seconds, the third matrix version runs 1
2003 Jan 02
1
rounding errors in max.col()
Hello, I suppose this is a general behavior with external function calls, so I do not post (yet) a specific bug report. Could someone explain this? a <- rep(1, 20) + rnorm(20, mean=0.00001, sd=0.0001) b <- embed(a, 3) # I want to know where the item in column 2 is greated than both col 1 and 3 (peak) test1 <- max.col(b) == 2 # ... or I could use a less optimal code test2 <- apply(b,
2006 Mar 22
2
Choose.files to give shortnames
Hi I am writing a script to generate a QC report for some data based on a number of files. I am currently using the choose.files function to select the files as not all the files need to be QC'd. One minor issue is that choose.files returns the complete path of the filename (eg "C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible to use choose.files to
2008 Jun 26
2
create new column with colnames resulting from paste()
Dear UseRs, I would like to know the way to create a new column by naming it simultaneously. For example, in for() loop I want to create columns named as paste("test", i, sep = ""), as shown below. ---------------------------- dt <- data.frame(a = c(1, 2, 3), b = c(3, 2, 2), c = c(1, 3, 5)) for(i in 1:2){ dt$as.name(paste("test", i, sep = ""))
2006 Jan 23
4
Converting from a dataset to a single "column"
I have a dataset of 3 ?columns? and 5 ?rows?. temp<-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67)) I wish to convert this to a single ?column?, with column 1 on ?top? and column 3 on ?bottom?. i.e. 5 10 14 56 7 4 2 8 3 34 28 4 52 34 67 Are there any functions that do this, and that will work well on much larger datasets (e.g. 1000 rows, 6000 columns)?
2006 Aug 15
3
question re: "summarry.lm" and NA values
Is there a way to get the following code to include NA values where the coefficients are ?NA?? ((summary(reg))$coefficients) explanation: Using a loop, I am running regressions on several ?subsets? of ?data1?. ?reg <- ( lm(lm(data1[,1] ~., data1[,2:l])) )? My regression has 10 independent variables, and I therefore expect 11 coefficients. After each regression, I wish to save the
2012 Mar 12
3
[LLVMdev] scalarrepl fails to promote array of vector
Hi Chris, Thanks for your reply. You said that scalarRepl gets shy about loads and stores of the entire aggregate. Then I use a test case: ; ModuleID = 'test1.ll' define i32 @fun(i32* nocapture %X, i32 %i) nounwind uwtable readonly { %stackArray = alloca <4 x i32> %XC = bitcast i32* %X to <4 x i32>* %arrayVal = load <4 x i32>* %XC store <4 x i32>
2012 Mar 12
0
[LLVMdev] scalarrepl fails to promote array of vector
Hi Fan, > You said that scalarRepl gets shy about loads and stores of the entire > aggregate. Then I use a test case: > > ; ModuleID = 'test1.ll' > define i32 @fun(i32* nocapture %X, i32 %i) nounwind uwtable readonly { > %stackArray = alloca <4 x i32> > %XC = bitcast i32* %X to <4 x i32>* > %arrayVal = load <4 x i32>* %XC > store
2013 Jan 08
2
Applying a user-defined function
Hello List, My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. > #now Write a new function using the above cut ()/quantile function to apply on different columns of the data frame > > CutQuintiles <- function(x) { + cut (test1$x,quantile (test1$x,
2016 May 05
6
Code which should exit 1 is exiting 0
I have IR at https://ghostbin.com/paste/daxv5 <https://ghostbin.com/paste/daxv5> which is meant to exit 1, but it is always exiting 0. I'm using it as a template for checking if two functions @test1 and @test2 are equivalent by checking against the exhaustive possible i16 values. For this particular example it should be enough to know that for certain i16, @test1 and @test2 are *not*
2006 Mar 14
2
Multi-line paste function
Here's my contribution to R. When R interacts with external programs (MySQL, cURL, etc.), it often requires a pasted string that is sent to these programs. For readability reasons, it is often preferable to have complex commands (SQL for example) spread on several lines. However, the normal paste function requires to add additional ' ", ' at the end of each line and another '
2008 Dec 26
3
lm() with same formula but different column/factor combinations in data frame
Hi, I am trying to find an efficient way of applying a linear regression model to different factor combinations in a data frame. I want to obtain the output with minimal or no use of loops if possible. Please let me know if this query is unclear. Thanks, Murtaza
2004 Oct 17
2
Errors while compiling packages with namespace?
Hello, I try to set up namespaces for packages. It is fine for several of them, except one whose compilation fails (under Windows XP & R 2.0.0): ---------- Making package svViews ------------ adding build stamp to DESCRIPTION installing NAMESPACE file and metadata Error in parse(file, n, text, prompt) : syntax error on line 21 Execution halted make[2]: *** [nmspace] Error 1 make[1]: ***
2010 Apr 05
2
changing column names in a dataframe
Hi folks, I have imported data from an Excel spreadsheet. Columns in that spreadsheet are named "name", "x", and "y", and several sets of those columns appear in the worksheet. For example: name x y name x y test1 1 3 test2 4 4 test1 2 2 test2 5 5 test1 3 1 test2 6 6 When I import these data into R, into a dataframe, I end up with something like this:
2011 Oct 13
3
[LLVMdev] RFC: Representation of OpenCL Memory Spaces
The problem I want to address in this discussion is the representation of OpenCL/CUDA memory spaces in LLVM IR. As support for OpenCL and CUDA mature within Clang, it is important that we provide a way to represent memory spaces in a way that is (1) sufficiently generic that other language front-ends can easily emit the needed annotations, and (2) sufficiently specific that LLVM optimization
2012 Jun 01
2
how to add a 'label' column
Hello R users, I'd like to ask a question about how to add a new column. So, below is my situation. In order to perform the repeated ANOVA, I first imported the following table. score=read.csv("patients_tests.csv"); subject test1 test2 test3 test4 test5 test6 test7 1 ab 0.17687 0.16715 0.17009 0.16480 0.16116 0.24502 0.17975 2 cl
2006 Feb 10
1
Question on big JPG plots in function warpping format
Hello: I have problems generating big JPG plots in functions. the following code runs fine in the script: #### runs fine in script, generate 40k "test1.jpg" in the given directory plotPlatesAlong <- c(1:5) plotDirPath <- paste(dataPath, "OutputPlots\\", sep="") filename <- paste(plotDirPath,"test1.jpg", sep="") jpeg(file=filename)
2011 Jun 01
1
Function to save plots
Hello, I'm using ROCR to plot ROC Curves and I want to automate the saving of plots into PNG files using a custom function. My data frames are named like test1, test2, test3. Each data frame has three variables: method1, method2, goldstandard. Right now, for each plot I have to run: png('test1_method1.png') plot(performance(prediction(test1$method1, test1$goldstandard),
2010 Feb 02
2
mysterious extra spaces appearing in expression paste
Hi, i'm trying to put a legend on some figures and they're coming out a bit wonky. here's an example: a <- c(1:10) par(mfrow=c(2,1)) plot(a,type="s",lwd=3) leg <- c(expression(paste("data1 (",rho,"=1)")), expression(paste("data2 (",rho,"=0.0)"))) legend("bottomright",legend=leg,col=c(1,2),lwd=3)