Displaying 20 results from an estimated 700 matches similar to: "Multi-line paste function"
2006 Apr 05
2
gsub in data frame
Hello,
I have this data frame:
### begin
d <-data.frame(matrix(c("1","--","bla",2),2,2))
d
# I want to replace the "--" by "\N" and still get a data frame.
# I tried:
out <-gsub("--","\\\\N",as.matrix(d)) #using as.matrix to get rid of factors
out
cat(out)
# But I lost my data frame
### end
Any idea?
Regards,
2006 Apr 24
2
Change the language of the labels in a graph
Hello,
How do you change the language of the labels in a graph. In this example, I
want to get French labels by changing Sys.putenv. I should get "Mai"
instead of "May".
Sys.putenv(LANGUAGE="fr")
x <- as.Date(c("1jan1960", "2jan1960", "31mar1960", "30jul1960"), "%d%b%Y")
y <-1:4
plot(x,y)
Regards,
Pierre
2007 Feb 23
1
help with RMySQL
Hi R users,
I am using RMySQL to connect to a database in MySQL.
I have 3 questions.
1)When I give the following command
dbListTables(con)
I get the output
stack imbalance in .Call, 142 then 143
stack imbalance in <-, 140 then 141
stack imbalance in {, 138 then 139
stack imbalance in standardGeneric, 126 then 127
stack imbalance in class, 121 then 122
stack imbalance in
2006 Jul 19
1
How would you export a 3-dimensional array to an SQL database?
Hello,
How would you export a 3-dimensional array to an SQL database?
a<-array(1:24, 2:4)
Is there an open source DB that would be more adequate for this type of
operation?
Is there a way to reshape/flatten a 3-dimensional array?
Regards,
Pierre Lapointe
**************************************************
AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
2006 Nov 07
1
Gregexpr - extract results with lapply
Gregexpr - extract results with lapply
Hello,
I need to extract sequences of three upper case letters in a string. In
other words, in this string:
str <-c("ABC", "this WOUld be gOOD")
The result I'm looking for is ABC WOU OOD.
With gregexpr, I can get the position and length of the sequences
gregexpr('[A-Z]{3}',str,perl=TRUE)
[[1]]
[1] 1
2007 Jan 16
1
system(mysql... Does not recognize < as passing an attribute (No HTML)
Hi,
This is my command line request: mysql -u root -ppassword -D quant
<c:/cline.txt
This line works from the command line in windows.
In R, when I try to use the system function, it does not work,
> system(paste('mysql -u root -ppassword -D quant
<c:/cline.txt'),show.output.on.console = TRUE)
ERROR 1102 (42000): Incorrect database name '<c:/cline.txt'
It seems
2006 Jun 09
3
sqlSave() and rownames=TRUE makes my Rgui crash
Hello,
I created a table in MySQL with this command
CREATE TABLE example (pk INT NOT NULL AUTO_INCREMENT,PRIMARY KEY(pk),
id VARCHAR(30),col1 VARCHAR(30),col2 VARCHAR(30))
### In R, I can connect to this table:
library(DBI)
library(RODBC)
chan <- odbcConnect("MySQL51", uid="root", pwd="xxx")
first <- sqlQuery(chan, "select * from example")
2007 Jan 16
1
system(mysql... Does not recognize < as passing an attribute
Hi,
This is my command line request: mysql -u root -ppassword -D quant
<c:/cline.txt
This line works from the command line in windows.
In R, when I try to use the system function, it does not work,
> system(paste('mysql -u root -ppassword -D quant
<c:/cline.txt'),show.output.on.console = TRUE)
ERROR 1102 (42000): Incorrect database name '<c:/cline.txt'
It seems
2006 Nov 06
2
grep searching for sequence of 3 consecutive upper case letters
Hello,
I need to identify all elements which have a sequence of 3 consecutive upper
case letters, anywhere in the string.
I tested my grep expression on this site: http://regexlib.com/RETester.aspx
But when I try it in R, it does not filter anything.
str <-c("AGH", "this WOUld be good", "Not Good at All")
str[grep('[A-Z]{3}',str)] #looking for a
2006 Mar 29
1
Data assimilation / inverse modeling in R
Hello,
I'm trying to find out if something has been written in R regarding data
assimilation and inverse modeling.
These searches do not return anything that look like Kalman filter
variations (EK, SEEK, ROEK, etc.)
help.search("assimilation")
help.search("inverse model")
Regards,
**************************************************
AVIS DE NON-RESPONSABILITE: Ce
2006 Apr 15
1
Removing Rows/Records from a Table
I would like to selectively remove rows from a table.
I had hoped that I could create a table and
selectively add rows with something like
> NewTable<-table(nrow=100, ncol=4)
> NewTable[1,]<-OldTable[10,]
but that doesn't work. The former call gives
> NewTable
ncol
nrow 4
100 1
while the latter call gives a table the length of
OldTable. Making a matrix, m, with the
2010 Dec 01
3
How to pass selection criteria in a function
Hi,
Suppose I have the following data
name score
Abel 88
Baker 54
Charlie 77
stored a table called myData.
I want to write a function that will create a table which is a subset of myData containing those have a score > 75.
I know I can do this with the following command:
subset(myData, score > 75)
But I would like to do this via a function, something like:
2006 Oct 22
1
disaggregating table
Hi all,
This should be easy, but I can't seem to figure it out.
I have a table like this named newtable
a1 a2 a3 a4 Cnts Score
1 1 0 0 4 3.28
1 0 1 1 2 2.63
I want the following:
a1 a2 a3 a4 Cnts Score
1 1 0 0 4 3.28
1 1 0 0 4 3.28
1 1 0 0 4 3.28
1 1 0 0
2011 Oct 17
5
Install the rugarch-package
Hi,
i am unable to install the rugarch package.
More than that i do not even find this package in my list of possible
packages.
Its possible than the name has changed, or the package is not longer
availiable?
Is there a similar package avaliable for garch modelling except the fGarch
what i am using now?
many Thanks
Roland
--
View this message in context:
2003 Oct 23
1
Can you create a MySQL database with RMySQL?
Is it possible to create a database in MySQL via RMySQL?
Also, is the format for the authorization field
'userName/password at databasename'? I saw an example like this somewhere
in the documenation, but I haven't found the actual specification.
Thanks,
Barnet Wagman
2005 May 22
4
Calling R from R and specifying "wait until script is finished"
Hello,
Let's say I have 50 R scripts to run. What would be the most efficient way
to run them?
I thought I could do multiple Rterms in a DOS batch file:
Ex:
Rterm <1.R> 1.txt
Rterm <2.R> 2.txt
...
Rterm <50.R> 50.txt
However, I'm afraid they will all open at the same time. I know I could
pause the batch file with something like:
PING 1.1.1.1 -n 1 -w 60000
2009 Jan 27
2
working with tables -- was Re: Mode (statistics) in R?
Ok, so I'm slowly figuring out what a factor is, and was able to follow
the related thread about finding a mode by using constructs like
my_mode = as.numeric(names(table(x))[which.max(table(x))])
Now, suppose I want to keep looking for other modes? For example,
Rgames> sample(seq(1,10),50,replace=TRUE)->bag
Rgames> bag
[1] 2 8 8 10 7 3 2 9 8 3 8 9 6 6 10 10 7 1
2005 May 19
5
Arranging Plots
Dear all,
I'd appreciate any hints how to arrange some plots.
I have three plots. I would like to arrange them in the following order:
- Plot 1 and Plot 2 should be in the upper row
- Plot 3 should be in the lower row but centered in the middle.
I hope the following sketch will help understanding my problem
================
| === === |
|| P1| |P2 | |
|| | | | |
| === === |
2005 May 25
1
Plot: Distance between tick and tick label on y-axis
Hello,
I want to reduce the distance between my ticks and their labels. I managed
to do it for the x-axis, but the y-axis puzzles me. Here's an example where
there is no space between the x-asix ticks and labels.
par(las=1)
plot(runif(50), type="l",xaxt="n",yaxt="n",ylab="", bty="l")
axis(2)
axis(1,padj=-1.5)
#However,
axis(2,padj=-1.5)
2005 May 26
1
Useful tip: Use Google to find R scripts
Hello,
Ever wondered how people use a particular function in their programs? Use
Google to find actual scripts:
filetype:R boxplot
will return real R scripts using the boxplot function.
Regards,
Pierre Lapointe
Assistant Market Strategist
***********************************************************************************
AVIS DE NON-RESPONSABILITE:\ Ce document transmis par