Displaying 20 results from an estimated 4000 matches similar to: "exporting text output to pdf"
2008 Sep 16
2
casting a character vector as an object
Greetings,
I need to compare the ratios of vector sizes like this:
length(object1) / length(object2)
I have many vector objects to compare, so I would like to do it in a loop.
I created a loop like this:
mat1 <- matrix()
for (i in 1:6)
{
for (j in 1:6)
{
mat1[i,j] <- length( paste("object",i,sep="")) /
2010 Aug 26
5
Quick GREP challenge
> grep("f[0-9]+=", "f1=5,f22=3,", value = T)
[1] "f1=5,f22=3,"
How do I make the line output c("f1", "f22") instead? (Actually, c(1,22)
would be even better).
Thank you.
--
View this message in context: http://r.789695.n4.nabble.com/Quick-GREP-challenge-tp2339486p2339486.html
Sent from the R help mailing list archive at Nabble.com.
2010 Sep 06
3
Failure to aggregate
I have a (very big - 1.5 rows) dataframe with a (POSIXt" "POSIXlt") column h
(hour). Surprisingly, I cannot calculate a simple aggregate over the
dataframe.
> n.h1 = sqldf("select distinct h, count(*) from x group by h")
Error in sqliteExecStatement(con, statement, bind.data) :
RS-DBI driver: (error in statement: no such table: x)
In addition: Warning message:
In
2010 Jan 24
3
Is there a quicker way to drop a data frame column than setting it to NULL?
If I want to drop columns x, y, z from dataframe df, is there a better
alternative to
df$x = NULL
df$y = NULL
df$z = NULL
There are sufficiently many columns remaining to make
df = subset(df, select = c(a,b,c,d[etc]))
cumbersome.
Thank you.
--
View this message in context: http://n4.nabble.com/Is-there-a-quicker-way-to-drop-a-data-frame-column-than-setting-it-to-NULL-tp1288617p1288617.html
2010 Jan 23
3
How to implement a "select distinct x, count(distinct y) ... group by x" for a data frame
... Being an R newbie, I can only think of extracting distinct x values with
unique, looping over them, extracting matching rows from the original data
frame, applying table, and recording the size of table's output alongside
the x value being checked. Is there a more elegant way?
Thank you.
--
View this message in context:
2009 Nov 24
1
merge on non-identical names
Greetings,
I need to conduct a merge on two databases containing information on
organizations, but the organization names are often non-identical and there
is no common unique identifier. Does anyone know a good way to calculate a
similarity measure on two names, or even better is there a natural language
matching function in an R package? I did some searches on this but must not
know the right
2010 Feb 14
4
Newbie woes with *apply
Dataframe cust has Date-type column open.date. I wish to set up another
column, with (first day of) the quarter of open.date.
To be comprehensive (of course, improvement suggestions are welcome),
month = function(date)
{
return(as.numeric(format(date,"%m")))
}
first.day.of.month = function(date)
{
return(date + 1 - as.numeric(format(date,"%d")))
}
first.day.of.quarter =
2009 Nov 03
3
re ading tokens
Greetings,
I am not familiar with processing text in R. Can someone tell me how to
read each line of words as separate elements in a list?
FE, I would like to turn:
word1 word2 word3
word2 word4
into a list of length two with three character elements in the first list
and two elements in the second. I know that this should be easy, but I am a
little confused by the text functions.
Thanks in
2009 Jan 24
2
IO: streaming input data
Hello -
I need to read in some tables that are embedded within data files like this:
line 1
line 2
data table
01000
10110
00011
end table
line 3
line 4
Is there any way to read just the data by telling an input device to start
reading when it encounters the keyword "data table" and stop reading at "end
table"?
Thanks in advance,
Jesse
--
View this message in context:
2010 Jan 30
2
Applying a transformation to multiple data frame columns
How can one simplify the folowing?
t$aum[is.na(t$aum)] = 0; t$aum.core[is.na(t$aum.core)] = 0
t$num[is.na(t$num)] = 0; t$num.core[is.na(t$num.core)] = 0
Thank you.
--
View this message in context: http://n4.nabble.com/Applying-a-transformation-to-multiple-data-frame-columns-tp1457641p1457641.html
Sent from the R help mailing list archive at Nabble.com.
2010 Apr 28
2
How to read contents of a text file into a single string?
... Both readLines() and scan() produce a number_of_lines x 1 vector; trying
paste(s, collapse = NULL) leaves it unaffected. How can I concatenate vector
elements (lines) into a single string?
Thank you.
--
View this message in context: http://r.789695.n4.nabble.com/How-to-read-contents-of-a-text-file-into-a-single-string-tp2069303p2069303.html
Sent from the R help mailing list archive at
2007 Oct 27
1
creating large graphs
Dear useRs,
I have a large dataset (600 to 2000 observations) that I need to cluster with a hierarchical technique, and then examine so that I can use cutree to extract various groups. I would like to visualize the results of hclust in a dendrogram, but this is obviously too much data for the normal 6 x 6 figure. Does anyone know how to make a large graph so that I can print it and view the
2010 Feb 14
2
Problems with boxplot in ggplot2:qplot
Dataframe closed contains balances of closed accounts: each row has month of
closure (Date-type column month) and latest balance. I would like to plot
by-month distributions of balances. A qplot call below produces several
warnings and no output.
Can anyone help?
Thank you.
PS. A really basic task, very similar to the examples on p. 71 of the
ggplot2 book, apart from a Date grouping column; I
2007 Nov 22
1
distance matrix to coordinate format for spatial stats
Greetings,
I would like to use some of the spatial statistics functions in R, but I am having trouble entering data. My data is already in a distance matrix format, not an X Y coordinate format (each Xij cell in the matrix represens the distance from point i to j). Does anyone know of a way to convert a distance matrix to a ppp object in spatstat, or an X,Y coordinate system for other
2010 Dec 27
1
Can't merge on datetime?
x = structure(list(date = structure(list(sec = c(0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), min = c(0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L), hour = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), mday = c(1L, 2L,
3L, 4L, 5L, 8L, 9L, 10L, 11L, 12L, 15L, 16L, 17L, 18L, 19L, 22L,
23L, 24L,
2010 Feb 02
1
[R] Suppressing scientific notation on plot axis tick labels (PR#14202)
On 02/02/2010 6:20 AM, Dimitri Shvorob wrote:
> Ruben Roa has kindly suggested using 'scipen' option - cf.
>
>> fixed notation will be preferred unless it is more than ???scipen??? digits
>> wider.
>
> However,
>
> options(scipen = 50)
> x = c(1e7, 2e7)
> barplot(x)
>
> still does not produce the desired result.
This is strange. I see what
1998 Sep 14
2
AW: How to print to CLIENT local printer?
You must create a output filter.
Edit /etc/printcap and add your client printer like this:
...
PC-PRINTER:\
:sd=/var/spool/lpd/PP01:\
:mx#0:\
:lp=/dev/null:\
:if=/var/spool/lpd/Filter/PP01:\
:sh:
...
Adjust the printcap parameters as needed (spool directory, directory to find
the filter script). Make sure the lpd can access the directory. Consult your
manual.
Now create the filter
2010 Feb 21
2
Newbie woes with par:mar
I have a simple barchart with horizontal bars and horizontal tick labels,
produced with
barplot(x, horiz = T, names.arg = c, las = 1)
The labels are longish strings, truncated on the plot. I wish to leave more
space for the left margin, and experiment with mar parameter,
barplot(x, horiz = T, names.arg = c, las = 1, mar = c(5, 15, 4, 2))
trying various values for the second vector element, but
2010 Dec 25
1
Extracting a dataframe column as a dataframe
> x = structure(list(time = structure(c(1020232904.818, 1020232904.818
), class = c("POSIXt", "POSIXct"), tzone = ""), price = c(321,
323.5)), .Names = c("time", "price"), row.names = 1:2, class = "data.frame")
> x1 = x[,c("price")]
> dput(x1)
c(321, 323.5)
Is there similar syntax that gets "price" as a
2010 Nov 19
3
Sweave Dynamic Graph Question
i have a time Series of IBM closing px from 1/1/2000 to today
I want to graph the time serie by dividing the graph by year and month
all the monthly graphs with the same year will go to one page. so from
1/1/2000 to 11/19/2010. i will have
11 pages, and each page will have 12 graphs (jan to dec) except for 2010.
I am able to do it in R, but when i use sweave, I can only print the last
page.