Displaying 20 results from an estimated 20000 matches similar to: "Is it possible to print a data.frame without the row names?"
2007 Feb 22
3
How to print a double quote
Can anyone tell me how to get R to include a double quote in the middle
of a character string?
For example, the following code is close:
> fnd<-"Open fnd 'test'"
> cat(fnd)
Open fnd 'test'>
>
But instead of Open fnd 'test' I need: Open fnd "test". Difference
seems minor, but I am writing batch files for another
2007 Mar 01
2
FTP download from ftp.sec.gov
All,
I have managed to download files from web sites and ftp sites using R,
so just for fun I tried to do so from the SEC's ftp site using the
following code:
ftp <- "ftp://anonymous:test at ftp.sec.gov/edgar/full-index/company.idx"
download.file(url=ftp, destfile="test.txt")
And it does not work. R says it cannot open the URL. If I paste the ftp
part into IE it
2011 Sep 08
3
How to specify a variable name in the regression formula without hard coding it
I have a matrix called mat and y is the column number of my response and
x is a vector of the column numbers of my terms. The variable name of y
can change, so I don't want to hardcode it. I can find out the name as
follows:
> names(mat)[y]
[1] "er12.l"
Then I can run the regression by hard coding the variable name as
follows:
> mod <-
2011 Jul 18
1
R on a server (Windows Server 2008)
Apologies for a naive question: Can R be installed and run on a server
(operating system Windows Server 2008)?
Thank you!
--
Dimitri Liakhovitski
2008 May 02
1
How to parse XML
I would like to learn how to parse a mixed text/xml document I
downloaded from the sec.gov website (see example below). I would like
to parse this to get the value for each xml tag and then access it
within R, but I don't know much about xml so I don't even know where to
start debugging the errors I am getting in this example code. Can
anyone help me get started?
Thanks, Roger
ftp
2008 Aug 20
1
How to send Html using SQL Server db mail
All,
I have a variable called `go` and it has a single quote in the name
column of line 47 that I am trying to get rid of. I have tried using
gsub, but I cannot get the syntax correct to tell R to remove the '
(single quote).
> go[47,]
gvkey Symbol Name Rank MarketCap MemoDate
Action Analyst Reason SharesHeld
75 065105 BJ BJ'S WHOLESALE CLUB INC 0.9579
2007 May 24
1
how to change font size in HTML output
I have not been able to figure out how to change the font size for
R2HTML::HTML output. Or for output from prettyR::htmlize. If anyone
can give me a couple hints that would be great.
Thanks,
Roger J. Bos
********************************************************************** *
This message is for the named person's use only. It may
contain confidential, proprietary or legally
2010 Sep 16
2
question about converting a matrix to a dataframe
First I have a matrix called stocks1:
> class(stocks1)
[1] "matrix"
Here are the first 5 rows of the last 4 columns:
> stocks1[1:5,2:5]
[,1] [,2] [,3] [,4]
[1,] 80.73 31.95 25.4 25.69
[2,] 83.66 31.95 27.12 25.2
[3,] 83.27 32.93 28.74 26.29
[4,] 83.9 34.07 29.77 26.6
[5,] 82.74 35.18 30.24 27.41
Now, why can't I convert this into a dataframe?
2006 Nov 30
3
escape character to get " printed in output
I want to use R to run dos commands (either by create batch files or
using shell())and I need to write double quotes on the file (or shell
command). As an easier example, lets take:
> print("hello 'hello' hello")
[1] "hello 'hello' hello"
Lets say instead of the above, I wanted:
"hello "hello" hello"
If possible, how would I do that?
I
2007 Mar 21
0
Unable to register TclNotifier window class
Running R 2.4.1 in batch mode on a Windows Server 2003 machine
occasionally gives me the following error in the ".Rout" file:
Loading required package: tcltk
Loading Tcl/Tk interface ... Unable to register TclNotifier window class
This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
Does
2009 Nov 20
3
Remove leading and trailing white spaces
I have a character string and I would like to remove the leading and
tailing white spaces. The example for 'sub' shows how to remove the
trailing white spaces, but I still can't figure out how to remove both
trailing and leading white spaces because I can't find any documentation
for what "+$" means or what "\\s+$" means. Maybe its because I don't
have a
2011 Sep 06
1
How to speed up regressions (related to data.frame)
All,
I have a function that runs a set of regressions (using the rlm
function) and I notice that it run much slower on my 64-bit R than it
does on my 32-bit R. I guess the bigger bit size slows it down.
Anyway, I looked into Rprof to see how I can speed it up. I saw that
78% of the total time is spent in [.data.frame, so I tried converting my
data to a matrix using data.matrix, but then rlm
2010 Jun 30
1
problem with rbind on data.frames that contain data.frames
It took me some time to find this bug in my code. Is this a feature of
R? Am I doing something wrong?
> a=data.frame(x=1:10,y=1:10)
> b=data.frame(x=11:20,y=11:20)
> z=data.frame(1:10,11:20)
> a$z=z
> b$z=z
> rbind(a,b)
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "2", "3",
"4", :
duplicate
2005 Aug 02
3
how to print a data.frame without row.names
Dear All,
is there a simple way to print a data.frame without its row.names?
example:
datum <- as.Date(c("2004-01-01", "2004-01-06", "2004-04-12"))
content <- c('Neujahr', 'Hl 3 K.', 'Ostern')
df1 <- data.frame(datum, content)
print(df1)
datum content
1 2004-01-01 Neujahr
2 2004-01-06 Hl 3 K.
3 2004-04-12 Ostern
Can I get
2007 Oct 26
1
How to remove non-UTF-8 characters from a string
All,
I am trying to post text from an XLS spread to my wiki and I need to
remove any characters that are not UTF-8. Is there an easy gsub command
that can do this?
(I previously sent this same email to r-sig-gui. That was a mistake and
I apologize for the duplication.)
Thanks, Roger J. Bos
********************************************************************** *
This message is for the named
2010 Aug 26
3
Help with ddply to eliminate a for..loop
I created a small example to show something that I do a lot of. "scale"
data by month and return a data.frame with the output. "id" represents
repeated observations over "time" and I want to scale the "slope"
variable. The "out" variable shows the output I want. My for..loop
does the job but is probably very slow versus other methods. ddply
2010 Mar 23
2
Creating pdfs using qplot in qqplot2
I am trying to create plots within a for loop and output them to a pdf.
Here is a working example using plot:
gg <- data.frame(datadate=1:4, spread=5:8)
pdf()
for (i in 1:3) {
plot(gg$datadate, gg$spread, main=i)
}
dev.off()
I am trying to learn more about ggplot2 so I try a slight modification
and it doesn't work. Anyone
2012 Feb 15
1
LaTeX and Sweave on windows
I am completely new to LaTeX and Sweave, so I am trying to follow the
tutorial in the following link:
http://www.r-bloggers.com/using-latex-r-and-sweave-to-create-reports-in-
windows/
I installed MiKTeX 2.9 and TeXnicCenter, but I get a build error when
compiler the example file:
The two errors are: "Error: running 'texi2dvi' on 'test.tex' failed" and
"R> !
2011 Jul 12
2
foreach not recognizing functions in memory
All,
I am not understanding the scoping used in foreach when it is used
inside a function. I keep getting "could not find function" errors for
functions that are in memory when I try to use foreach within a function
call. I have a simple example below. "testFun" is in memory and works
when called by foreach directly, but when I place foreach in a function
called
2011 Sep 08
2
Variable scoping question
I modified an example in the object.size help page to create a function
I want to be able to run:
"mysize" <- function() {
z <- sapply(ls(), function(w) object.size(get(w)))
as.matrix(rev(sort(z))[1:5])
}
mysize()
When I test the lines inside the function it works fine:
> z <- sapply(ls(), function(w) object.size(get(w)))
> as.matrix(rev(sort(z))[1:5])