Hi,
Try this:
lst1-lapply(1:5,function(i) {pdf(paste0(i,.pdf));
hist(rnorm(100),main=paste0(Histogram_,i));dev.off()}) #you can change the
numbers
A.K.
I'm trying to generate a pdf called 1.pdf, 2.pdf, 3.pdf etc and it isn't
working. My code is:
x - 0
for(i in 1:1000){
x - x + 1
Hi:
I created a data frame
df - data.frame( person = c('John','Bob','Mary'), team =
c('a','b','c'), stringsAsFactors = F);
and obtained the expected output
df
person team
1 John a
2Bob b
3 Mary c
now I want to save the whole content of df preserving its row and
look up dump
On Thu, Mar 22, 2012 at 11:35 AM, mail me mailme...@googlemail.com wrote:
Hi:
I created a data frame
df - data.frame( person = c('John','Bob','Mary'), team =
c('a','b','c'), stringsAsFactors = F);
and obtained the expected output
df
person team
1 John a
2
On 2012-03-22 08:35, mail me wrote:
Hi:
I created a data frame
df- data.frame( person = c('John','Bob','Mary'), team =
c('a','b','c'), stringsAsFactors = F);
and obtained the expected output
df
person team
1 John a
2Bob b
3 Mary c
now I want to save the whole
I am trying to write a function that generates one PDf containing plots from
several .csv files within a directory. When I manually execute the code it
seems to work, but not when it is a function. I think I need to return()
something, but haven't had much luck figuring out what/how.
See R FAQ 7.22 -- in short, you need to print() your plot to the
graphics device -- just wrap xyplot() in print() and it should work.
Michael
On Tue, Mar 13, 2012 at 3:55 PM, Dgnn sharkbrain...@gmail.com wrote:
I am trying to write a function that generates one PDf containing plots from
Thank you a lot for answering so fast!
but..what do you mean by example?
I 've mentioned above the loop I used and I also show how the file looks
like
'cause its huge.
the way i read the file is
x=read.table(filename.txt,header=FALSE,sep=\t,fill=TRUE)
y=x[1:45,]
(i use only some rows in order to
Hi
Thank you a lot for answering so fast!
but..what do you mean by example?
I 've mentioned above the loop I used and I also show how the file looks
like
I do not see any loop. I do not archive all posts from R help, only those
with interesting answers :-) and if you do not keep the
Thanks a lot for the interest :)
My loop is the following
counter = 0
for (i in 1:nrow(y))
{
for (j in 1:ncol(y))
{
if (y[i,j]==Func_0005634) {
counter = counter + 1 }
if(y[i,j]==Func_0005737){
counter = counter + 1 }
if(y[i,j]==Func_0005515){
counter =
As I said to you a while back, use append = TRUE.
Michael
On Tue, Feb 7, 2012 at 4:18 AM, Felicity felicity...@hotmail.com wrote:
Thanks a lot for the interest :)
My loop is the following
counter = 0
for (i in 1:nrow(y))
{
for (j in 1:ncol(y))
{
if (y[i,j]==Func_0005634) {
Hi
now you omitted data, but never mind :-)
My loop is the following
counter = 0
for (i in 1:nrow(y))
{
for (j in 1:ncol(y))
{
if (y[i,j]==Func_0005634) {
counter = counter + 1 }
if(y[i,j]==Func_0005737){
counter = counter + 1 }
if(y[i,j]==Func_0005515){
Dear All!!
I am also new in R
and trying to write my results into a file I post here..hopefully is the
proper place
To be more secific I have this loop
counter = 0
for (i in 1:nrow(y))
{
for (j in 1:ncol(y))
{
if (y[i,j]==Func_0005634) {
counter = counter + 1 }
You don't say how you are writing to a file, but some methods have an
append = TRUE option that might be helpful.
Your code looks really inefficient as well: I don't have time to look
at it fully now, but it seems to me that you can vectorize the inner
loops quite directly:
for(j in ncol(y)){
maybe I could keep each line (having the strings)
in a file or somewhere and then
call a print function that prints them all together
from where I saved them?
Please let me know as soon as Possible!!
thank you!
--
View this message in context:
You can easily do that, but the question is what is the problem you
are trying to solve? What do you want to do with the lines you are
writing out? Are you going to read them back in or process them with
some other program? So save them in a character vector and then write
them out with 'cat'.
Honestly thank you for the prompt responding
and you are right I will tellyou what I want to do
and not the way ..since I dont know much from R
I have a txt with Proteins
Prot_10035Func_0005874 Func_0016787 Func_0003774 Func_0006898
Func_0005856 Func_0005525 Func_0005737 Func_0003924
Hi
Honestly thank you for the prompt responding
and you are right I will tellyou what I want to do
and not the way ..since I dont know much from R
I have a txt with Proteins
Prot_10035 Func_0005874 Func_0016787 Func_0003774
Func_0006898
Func_0005856 Func_0005525
data with multiple
positions in each region and assigning all of the summary results
to one
line identified by the region.
If any of you have any suggestions I would appreciate it.
--
View this message in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700031
is essentially taking the input data with multiple
positions in each region and assigning all of the summary results to one
line identified by the region.
If any of you have any suggestions I would appreciate it.
--
View this message in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R
On Jul 27, 2011, at 7:02 PM, a217 wrote:
Hello,
I have an input file:
http://r.789695.n4.nabble.com/file/n3700031/testOut.txt testOut.txt
where col 1 is chromosome, column2 is start of region, column 3 is
end of
region, column 4 and 5 is base position, column 6 is total reads,
column 7
Yes, that is the general objective. I'll look-into aggregates in R and see if
anything helps.
Thanks,
a217
--
View this message in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700071.html
Sent from the R help mailing list archive at Nabble.com
in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700031.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read
identified by the region.
If any of you have any suggestions I would appreciate it.
--
View this message in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700031.html
Sent from the R help mailing list archive at Nabble.com
Thank you both very much! The codes are pretty slick and should greatly help
me in my task.
--
View this message in context:
http://r.789695.n4.nabble.com/Writing-a-summary-file-in-R-tp3700031p3700382.html
Sent from the R help mailing list archive at Nabble.com
From: Thomas Parr [mailto:thomas.p...@maine.edu]
Sent: Thursday, December 02, 2010 10:52 PM
To: r-help-requ...@stat.math.ethz.ch
Subject: Writing to a file
I am trying to get my script to write to a file from the for loop. It is
working, but the problem is at it is outputting to two columns and
Hi Thomas,
If x contains your current results, one way to do what you want is the
following:
# data
x - read.table(textConnection(X2403,0.006049271
X2403,0.000118622
X2403,50.99600705
X2403,7.62E-150
X2419,0.012464215
X2419,9.07E-05
X2419,137.4022573
X2419,6.45E-273), sep = ,)
Hi,
I have a fairly complex object that I have written a print function for.
Thus when I do print(results), the R console shows me a whole bunch of stuff
already formatted. What I want to do is to take whatever print(results) shows
to console and then put that in a file. I am doing this using
The HELP page for 'sink' is pretty clear about this:
sink() or sink(file=NULL) ends the last diversion (of the specified
type). There is a stack of diversions for normal output, so output
reverts to the previous diversion (if there was one). The stack is of
up to 21 connections (20 diversions).
Dear all,
I am attempting to convert 10 NetCDF files into a single NetCDF file, due to
the data input requirements of a model I hope to use. I am using the ncdf
package, version 1.6. The data are global-scale water values, on a monthly
basis for 10 years (ie. 120 months of data in total; at
29 matches
Mail list logo