Displaying 20 results from an estimated 3000 matches similar to: "gsub syntax help"
2009 Jul 31
1
help in using gsub and ?
Hi all,
I would like to strip the R prompt from a series of code lines and copy the resulting text into a R script. For example, consider the following :
#####
str1<-"
> library(MASS)
> data(Cars93)
> attach(Cars93)
> imosaic(data.frame(AirBags,Cylinders,Origin))"
str2<-gsub('>','',str1)
######
This gives, as expected .?
> str2
[1] "\n
2011 Aug 10
2
using if then statements in a dataframe
I used this service several months ago and was very pleased with the response.
I have a dataframe with several thousand lines and to each line I need to apply a series of "if else" statements. For each row I need either a value or a blank/NA. Below is the series of if else statements I have been trying without success to integrate into a function such as "apply".
if
2016 Nov 28
2
Looking for help with an ast matcher
Hi Piotr,
I think I found a working matcher: match
ifStmt(hasCondition(implicitCastExpr(hasImplicitDestinationType(isInteger()),
has(cxxMemberCallExpr(callee(cxxMethodDecl(hasName("compare"))),
hasArgument(0, declRefExpr().bind("str2")),
callee(memberExpr(has(declRefExpr().bind("str1"))))))))).bind("case1")
This one bind to both str1 and str2 in
2016 Nov 28
2
Looking for help with an ast matcher
Hi Piotr,
Thanks. Yeah, it seemed a little weird, but it was what got me closest. I
found out that the matcher I supplied here was working for clang-query
3.8.1. I'm working on a clang-tidy module for 4.0.0 - it's not working
there.
Could you elaborate on the "onImplicitObjectArgument"? There is no document
on it on the clang page. So I wouldn't know how it works or what it
2008 Jan 06
4
[LLVMdev] Another memory fun
Hey again)
Now I have next code:
; ModuleID = 'sample.lz'
@.str1 = internal global [8 x i8] c" world!\00" ; <[8 x i8]*>
[#uses=1]
@.str2 = internal global [8 x i8] c"hello, \00" ; <[8 x i8]*>
[#uses=1]
@.str7 = internal global [21 x i8] c"welcome to out hall!\00" ;
<[21 x i8]*> [#uses=1]
declare i32 @puts(i8*)
2016 Nov 27
2
Looking for help with an ast matcher
Adding cfe-dev, because it is related to clang, not LLVM.
2016-11-27 22:34 GMT+01:00 Piotr Padlewski <piotr.padlewski at gmail.com>:
> Hi Mads,
> Can you provide the code that you run clang-query on, or at least AST for
> the fragment you want to match?
>
> Piotr
>
> 2016-11-26 22:27 GMT+01:00 Mads Ravn via llvm-dev <llvm-dev at lists.llvm.org
> >:
>
2016 Nov 26
2
Looking for help with an ast matcher
Hi,
Hope this is the right channel for this question. I am trying to make an
ast matcher for clang-tidy to find str1.compare(str2), where both str1 and
str2 are std::string. I have this so far: http://i.imgur.com/sUma9WC.png .
But I am having a hard time finding a way to bind an id to the str1 part of
the expression.
Can anyone help me out with an idea?
Best regards,
Mads Ravn
--------------
2008 Jan 06
0
[LLVMdev] Another memory fun
It's invalid for the same reason that
char *foobar = strcat("foo", "bar");
is invalid in C. Please make sure you understand what you're asking LLVM
to do before going any further down this path. A good approach is to
write out the correct code in C and then use llvm-gcc (or the demo page
at http://llvm.org/demo ) to see what it looks like in LLVM assembly.
Nick
2008 Jan 06
0
[LLVMdev] Another memory fun
but why this code don't work:
; ModuleID = 'sample.lz'
@.str1 = internal global [6 x i8] c"world\00" ; <[6 x i8]*>
[#uses=1]
@.str2 = internal global [7 x i8] c"hello \00" ; <[7 x i8]*>
[#uses=1]
@.str7 = internal global [7 x i8] c"father\00" ; <[7 x i8]*>
[#uses=1]
@.str8 = internal global [8 x i8]
2007 Jul 23
1
CHAR(STRING_ELT( - OK but CHAR(asChar(STRING_ELT( - not, why?
Any idea why CHAR(asChar(STRING_ELT( produces NA whereas
CHAR(STRING_ELT( gets a pointer to a string? It's generally expected
that STRING_ELT should already be a character, but why the coercion does
not work? Here is a simple example (consistent over R2.5.1-R2.6 rev
42284, I didn't check earlier versions, but it used to be different in
2.4):
install.packages("inline")
2003 Feb 20
2
is.numeric
Hi,
I have a vector, which contains both strings and numbers, e.g.
> foo <- c("str1",1234,"str2",0.9876)
I want to know if a distinct element of the vector is a string or a number and
took "is.numeric", but
> is.numeric(foo[2])
[1] FALSE
because R treats the numbers in a mixed vectors as strings:
> foo
[1] "str1" "1234"
2006 Nov 12
4
[LLVMdev] need help understanding getelementptr assembler instruction
I am trying to understand the hello word assember example. This is
my version:
%str1 = internal constant [13 x sbyte] c"Hello World\0a\00"
declare int %printf(sbyte*, ...)
implementation ; Functions:
int %main() {
%str2 = getelementptr [13 x sbyte]* %str1, long 0, long 0
call int(sbyte*, ...) *%printf(sbyte* %str2)
ret int 0
}
Why is getelementptr being given two "long
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2007 Mar 27
3
Use of 'defineVar' and 'install' in .Call
Dear all,
[system and version information below]
I am trying to modify a C function for finding the root of an
expression. The function is to be called from R as .Call with input
parameters:
f: expression for which we will find the root
guesses: interval for the solution
stol: tolerance
rho: environment
The original functions I use are:
SEXP mkans(double x) {
SEXP ans;
PROTECT(ans =
2008 Jan 06
4
[LLVMdev] Another memory fun
hm.... I think, that is valid in c
but next code too doesn't works right:
; ModuleID = 'sample.lz'
@.str1 = internal global [6 x i8] c"world\00" ; <[6 x i8]*>
[#uses=1]
@.str2 = internal global [7 x i8] c"hello \00" ; <[7 x i8]*>
[#uses=1]
@.str7 = internal global [7 x i8] c"father\00" ; <[7 x i8]*>
[#uses=1]
2006 Nov 13
2
[LLVMdev] need help understanding getelementptr assembler instruction
Hi,
I must say I also was in need of this document but never knew it
existed. It seems to be linked from the faq page only. I only read
that the first day I came to LLVM. Maybe linking it from the
GetElementPtr instruction in LangRef.html would make sense.
cheers
Eric
On Nov 12, 2006, at 8:47 PM, Reid Spencer wrote:
> Ram,
>
> Please read and understand the GetElementPtr FAQ
2006 Nov 13
0
[LLVMdev] need help understanding getelementptr assembler instruction
Ram:
Let me explain and hopefully Reid or Chris will correct if I have it
wrong. The first 0 is the index into a possible array of sbyte[13]
arrays that this pointer points to. I expect GetElementPtr works this
way is to keep down the proliferation of arrays of arrays in the type
table. So you are pointing at the zeroth, and in this case only, array
of sbyte[13]. The next 0 actually
2011 Mar 10
1
about textConnection
I need read a table in a string with special format. I used read.csv and textConnection function.
But i am confuse about textConnection by follow code.
case A: It is OK£¡
str0 <- '{"abc",{"def","X,1&Y,2&Z,3"}}'
str1 <- strsplit(str0,'"')[[1]][6]
str2 <- gsub("&","\n", str1)
con <-
2006 Nov 12
0
[LLVMdev] need help understanding getelementptr assembler instruction
Ram,
Please read and understand the GetElementPtr FAQ available here:
http://llvm.org/docs/GetElementPtr.html
That will help you understand how it works. We wrote that document
specifically because this question comes up all the time.
Reid.
On Sun, 2006-11-12 at 11:13 -0800, Ram Bhamidipaty wrote:
> I am trying to understand the hello word assember example. This is
> my version:
>
2013 Mar 18
1
Problem with write.table
Hi everyone,
I'm trying to create unique filenames and then write a data frame into
these files. This is the code I am using.
str1<-"fname"
str2<-".ext.txt";
FILENAME<-paste0(str1,str2);
write.table(df,
file=FILENAME,col.names=FALSE,row.names=FALSE,quote=FALSE,sep="\t");
Ideally, a file called fname.ext.txt should be created, containing the data