[R] Adding two data.frames.

2010-09-29 Thread Joel

Hi

I have two data frames that contains the same sort of data and I want do add
them together to get one big data frame, anyone know how to do that?

ex:
data.frame1
A B C
1 2 3
4 5 6 
7 8 9

and
data.frame2
A B C
9 8 7
6 5 4
3 2 1

Would then become one big set:

data.frame3
A B C
1 2 3
4 5 6
7 8 9
9 8 7
6 5 4
3 2 1


Thx for your help

//Joel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Adding-two-data-frames-tp2718771p2718771.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Adding two data.frames.

2010-09-29 Thread Joel

Thx for the help works very well for me.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Adding-two-data-frames-tp2718771p2718901.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] change y axis distance

2010-09-21 Thread Joel

Hi

I got a barplot that has values between 0-150 and the y-axis shows the steps
0 50 100 and 150 but I would like to change it to 0 10 20 30... ...130 140
150

Dont really know the word in english so sry about it beeing abit confusing
:)

Thx for your help 
Joel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/change-y-axis-distance-tp2548363p2548363.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] change y axis distance

2010-09-21 Thread Joel

Thx for all your help!
-- 
View this message in context: 
http://r.789695.n4.nabble.com/change-y-axis-distance-tp2548363p2548461.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Saveing plot to multiple locations

2010-09-13 Thread Joel

Hi 
Im trying to save a plot both to a pdf and as just a picture but without
success so if someone can help me I would be happy :)

my code:

require(party)
irisct - ctree(Species ~ .,data = iris)
data(iris)
attach(iris)
pdf('/home/joel/Skrivbord/mammamu.pdf')
try(png('/home/joel/Skrivbord/mammamu1.png'))
plot(Sepal.Length, Petal.Length, col=unclass(Species)) 
legend(4.5, 7, levels(Species), col=plot_colors, cex=0.8, fill=1:3)
try(png('/home/joel/Skrivbord/mammamu2.png'))
plot(irisct)
dev.off()
readBin(pic,'raw',1024*1024) 
readBin('/home/joel/Skrivbord/mammamu2.png','raw',1024*1024)

Ive tryed to move around the png and pdf part to see if it worked better if
they where in an other order but as I said without success.

//Joel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Saveing-plot-to-multiple-locations-tp2537133p2537133.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Saveing plot to multiple locations

2010-09-13 Thread Joel

Thx for all the help!

Dave:
Its the second ones so now it looks like this and works but its abit ugly as
you have to plot the same thing two times but dossent seem to be any other
way or?

try(png('/home/joel/Skrivbord/mammamu2.png'))
plot(irisct)
dev.off()

pdf('/home/joel/Skrivbord/mammamu.pdf')
plot(irisct)
dev.off()
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Saveing-plot-to-multiple-locations-tp2537133p2537402.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Passing aruments with source

2010-09-08 Thread Joel

Hi.

Im writing a small test program just to see how passing arguments work with
R.
From the command line everything works as expected but from inside R using
source(test.R) i dont know where and how to send in the arguments did try
source(test.R --test) but it just says that it cant find or open the file.
(without the argument part it can).

Anyone know how to make it work?

//Joel Damberg
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Passing-aruments-with-source-tp2531012p2531012.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Passing aruments with source

2010-09-08 Thread Joel

That is true but then I (or anyone else using the script) most know exactly
what the name in the script is to be able to set it correctly and so on.
Therefor it would be much better to be able to just send in the value and
let the script handle the variable setting.

But thx for the answer

//Joel Damberg
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Passing-aruments-with-source-tp2531012p2531087.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Passing aruments with source

2010-09-08 Thread Joel

Thats an idea will try it out and see how it works

Thanks a lot for your help.

Joel
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Passing-aruments-with-source-tp2531012p2531138.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 the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] NA Replacement by lowest value?

2010-01-28 Thread Joel Fürstenberg-Hägg

Hi all,

 

I need to replace missing values in a matrix by 10 % of the lowest available 
value in the matrix. I've got a function I've used earlier to replace negative 
values by the lowest value, in a data frame, but I'm not sure how to modify 
it...

 

nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative values 
to a small value, close to zero
{
   min.val = min(col[col  0])

   col[col  0] = (min.val / 10)
   col # Column index
}))

 

I think this is how to start, but the NA replacement part doesn't work...

 

newMatrix = as.matrix(apply(oldMatrix, 2, function(col)

{

   min.val = min(mData, na.rm = T) # Find the smallest value in the dataset

   col[col == NA] = (min.val / 10) # Doesn't work...
   col # Column index

}

 

Does any of you have any suggestions?

 

 

Best regards,

 

Joel

 
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] NA Replacement by lowest value?

2010-01-28 Thread Joel Fürstenberg-Hägg

Thanks a lot Paul!!

 

Best,

 

Joel
 
 Date: Thu, 28 Jan 2010 10:48:37 +0100
 From: p.hiems...@geo.uu.nl
 To: joel_furstenberg_h...@hotmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] NA Replacement by lowest value?
 
 Joel Fürstenberg-Hägg wrote:
  Hi all,
 
  
 
  I need to replace missing values in a matrix by 10 % of the lowest 
  available value in the matrix. I've got a function I've used earlier to 
  replace negative values by the lowest value, in a data frame, but I'm not 
  sure how to modify it...
 
  
 
  nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative 
  values to a small value, close to zero
  {
  min.val = min(col[col  0])
  
 
  col[col  0] = (min.val / 10)
  col # Column index
  }))
 
  
 
  I think this is how to start, but the NA replacement part doesn't work...
 
  
 
  newMatrix = as.matrix(apply(oldMatrix, 2, function(col)
 
  {
 
  min.val = min(mData, na.rm = T) # Find the smallest value in the dataset
 
  col[col == NA] = (min.val / 10) # Doesn't work...
  
 use is.na(col) t find the NA's.
 
 cheers,
 Paul
  col # Column index
 
  }
 
  
 
  Does any of you have any suggestions?
 
  
 
  
 
  Best regards,
 
  
 
  Joel
 
  
  
  _
  Hitta kärleken i vinter!
  http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
  [[alternative HTML version deleted]]
 
  
  
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
  
 
 
 -- 
 Drs. Paul Hiemstra
 Department of Physical Geography
 Faculty of Geosciences
 University of Utrecht
 Heidelberglaan 2
 P.O. Box 80.115
 3508 TC Utrecht
 Phone: +3130 274 3113 Mon-Tue
 Phone: +3130 253 5773 Wed-Fri
 http://intamap.geo.uu.nl/~paul
 
  
_
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] NA Replacement by lowest value?

2010-01-28 Thread Joel Fürstenberg-Hägg

Hi Jim,

 

That's what Pauls suggested too, works great!

 

Best,

 

Joel
 
 Date: Thu, 28 Jan 2010 20:57:57 +1100
 From: j...@bitwrit.com.au
 To: joel_furstenberg_h...@hotmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] NA Replacement by lowest value?
 
 On 01/28/2010 08:35 PM, Joel Fürstenberg-Hägg wrote:
 
  Hi all,
 
 
 
  I need to replace missing values in a matrix by 10 % of the lowest 
  available value in the matrix. I've got a function I've used earlier to 
  replace negative values by the lowest value, in a data frame, but I'm not 
  sure how to modify it...
 
 
 
  nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative 
  values to a small value, close to zero
  {
  min.val = min(col[col 0])
 
  col[col 0] = (min.val / 10)
  col # Column index
  }))
 
 
 
  I think this is how to start, but the NA replacement part doesn't work...
 
 
 
  newMatrix = as.matrix(apply(oldMatrix, 2, function(col)
 
  {
 
  min.val = min(mData, na.rm = T) # Find the smallest value in the dataset
 
  col[col == NA] = (min.val / 10) # Doesn't work...
  col # Column index
 
  }
 
 
 
  Does any of you have any suggestions?
 
 Hi Joel,
 
 You probably want to use:
 
 col[is.na(col)]-min.val/10
 
 Jim
 
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem with odfWeave

2010-01-27 Thread Joel GOMBIN
Hi,

so to sum up, I'm making automated reports, in the form of tables. In each
cell of the table is an expression like (e.g.) :

\Sexpr{odfCat(round(summary(get(modele1))$coefficients[1,1],2))}


For most cells, after I run odfWeave, the results are correctly put and
formatted. But in some cells (always the same), the output.odt file has the
original expression (e.g.
\Sexpr{odfCat(round(summary(get(modele1))$coefficients[1,1],2))})
instead of the result of the evaluation of the expression.

When I look at the content.xml code of the input file, I see that in these
cells where the evaluation is not proprely run, I have something like :

text:p text:style-name=P4
\Sexpr{odfCat(round(summary(get(modele1))$coefficients[2,
text:soft-page-break/
1],2))}
/text:p


instead of the regular

text:p text:style-name=P4
\Sexpr{odfCat(round(summary(get(modele1))$coefficients[2,1],2))}
/text:p

So my question is : how can I get rid of these text:soft-page-break/ tags
that appeared for no apparent reason ? Is there a way to configure
OpenOffice Writer so that he won't put such tags ?

Thanks a lot,

Joel



On Wed, Jan 27, 2010 at 1:54 PM, Ista Zahn istaz...@gmail.com wrote:

 Hi Joel,
 Can you paste a minimal example illustrating your problem?
 Thanks,
 Ista
 On Wed, Jan 27, 2010 at 6:19 AM, Joel GOMBIN joel.gom...@gmail.com
 wrote:
  Hello,
 
  thanks to Sarah for her help. That works fine, except for one thing. When
 I
  generate my reports, using odfWeave(), some cells in my tables are filled
  with the expression I put in the input file (/Sexpr(...)) instead of the
  result of its evalutation. I suspected there was a problem in the XML
 code ;
  indeed, when I look at the content.xml file of the input ODT file, there
 are
  some text:soft-page-break/ tags in the middle of cells.
 
  Is it any way of instructing OpenOffice not to put these tags, or do I
 have
  no other choice than removing them by hand in the content.xml file ?
 
  Thanks a lot in advance,
 
  Joel
 
  On Wed, Jan 6, 2010 at 7:12 PM, Sarah Goslee sarah.gos...@gmail.com
 wrote:
 
  Hi Joel,
 
  If you actually want to make a table, you need to use odfTable. There
  are examples
  in the help for that function. Same for odfCat, but instead of
  creating a table, that will
  print your output.
 
  eg to print your output:
 
  echo=FALSE=
 odfCat(some random normal data:, rnorm(5)) # from the help file
  @
 
  or to make a table:
 
  echo=FALSE=
 x - matrix(1:12, ncol=3)
 colnames(x) - c(a, b, c)
 odfTable(x)
 odfTableCaption(A useless table)
  @
 
  ODT files are actually compressed XML files. If you just print from
  within R, there are no
  XML tags around your output and OpenOffice has no idea what to do with
 it.
  The
  various odfSomething R functions wrap the R output in XML tags so OOo
 will
  understand it in the final output.
 
  Sarah
 
  On Wed, Jan 6, 2010 at 12:41 PM, Joel GOMBIN joel.gom...@gmail.com
  wrote:
   Hello,
  
   I have encountered problems using odfdWeave. I actually have the same
  error
   message as was reported in this message (
   http://tolstoy.newcastle.edu.au/R/e6/help/09/01/0872.html), but I
 don't
   quite understand the answer made by Max Kuhn (You need to cat the
  results
   using odfCAt, otherwise you are just writing the output with no XML
  around
   it.). What I am supposed to do exactly ?
  
   What I'm trying to do is writing values I have computed earlier in the
  cells
   of a table in an ODT file.
  
   I'm very grateful in advance for any help...
  
 
 
  --
  Sarah Goslee
  http://www.functionaldiversity.org
 
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Ista Zahn
 Graduate student
 University of Rochester
 Department of Clinical and Social Psychology
 http://yourpsyche.org


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Remove part of string in colname and calculate mean for columns groups

2010-01-15 Thread Joel Fürstenberg-Hägg

Hi all,

 

I have two question. First, I wonder how to remove a part of the column names 
in a matrix? I would like to remove the _ACCX or _NAX part below. Is there 
a method where the _ as well as all characters after i can be removed?

 

 dim(exprdata)
[1]  88 512



 colnames(exprdata[,c(1:20)])
 [1] Akita_ACC1 Akita_ACC2 Akita_ACC3 Akita_ACC4 Alc.0_ACC1 
Alc.0_ACC2 Alc.0_ACC3
 [8] Alc.0_ACC4 Alc.0_ACC5 Bl.1_ACC1  Bl.1_ACC2  Bl.1_ACC3  
Bl.1_ACC4  Bla.1_ACC1
[15] Bla.1_ACC2 Bla.1_ACC3 Bla.1_ACC4 Blh.1_ACC1 Blh.1_ACC2 
Blh.1_ACC3

 

 

Secondly, I would like to calculate the mean of each column group in the 
matrix, for instance all columns beginning with Akita, and save all new 
columns as a new matrix. 

 

For instance, use:

 

 head(exprdata[,c(1:4)])
Akita_ACC1 Akita_ACC2 Akita_ACC3 Akita_ACC4
A15-101   6.668931 NA NA NA
A122001-101  10.562564  11.706395  11.608989   8.289093
A128001-101  14.946749   8.112625   8.176438  10.104254
A133001-101   5.186679   6.089870   4.119589   3.168841
A133003-101 NA NA  19.825480   2.587695
A134001-101   3.259402   4.835642   4.679607   4.490254

 

To get something like:

 

 Akita
A15-101   6.668931

A122001-101   10.54176  

A128001-101  10.10425
A133001-101   3.168841

A133003-101   2.587695 
A134001-101   4.490254

 

 

However, the column groups are of different sizes (3-10 columns) so I guess 
I'll need a method based on the column names.

 

Anyone who can help me?

 

Best regards,

 

Joel
  
_
Nya Windows 7 - Hitta en dator som passar dig! Mer information. 
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to delete matrix rows based on NA frequency?

2010-01-15 Thread Joel Fürstenberg-Hägg

Hi all,

 

I would like to remove rows from a matrix, based on the frequency of missing 
values. If there are more than 10 % missing values, the row should be deleted.

 

I use the following to calculate the frequencies, thereby getting a new matrix 
with the frequencies:

 

freqNA=rowMeans(is.na(exprdata))

 

But is there a shorter way to remove the rows based on (1-freqNA)0.1 than 
looping through the whole matrix using a for loop?

 

 

All the best,

 

Joel
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to calculate the row wise means for grouped columns in matrix?

2010-01-15 Thread Joel Fürstenberg-Hägg

Hi all,

 

I want to calculate the row wise mean of groups of columns in a matrix M. All 
columns belonging to the same group have the same column name. My idea is to 
create a new vector V containing these column names, but after first removing 
the duplicates. Then I would calculate the means using for instance rowMean() 
and by comparing the column names of M with the vector V, getting the indices 
of the columns to use.

 

What do you think, is it a good idea or not? If yes, any suggestions how to do 
it? If no, is there any alternative solution that might work better?

 

 

 

All the best,

 

Joel
  
_
Lagra alla dina foton på Skydrive. Det är enkelt och säkert!
http://www.skydrive.live.com
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problem with odfWeave

2010-01-06 Thread Joel GOMBIN
Hello,

I have encountered problems using odfdWeave. I actually have the same error
message as was reported in this message (
http://tolstoy.newcastle.edu.au/R/e6/help/09/01/0872.html), but I don't
quite understand the answer made by Max Kuhn (You need to cat the results
using odfCAt, otherwise you are just writing the output with no XML around
it.). What I am supposed to do exactly ?

What I'm trying to do is writing values I have computed earlier in the cells
of a table in an ODT file.

I'm very grateful in advance for any help...

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Exchange NAs for mean

2009-12-17 Thread Joel Fürstenberg-Hägg

Hi all,

 

I'm have a matrix (X) with observations as rows and parameters as columns. I'm 
trying to exchange all missing values in a column by the column mean using the 
code below, but so far, nothing happens with the NAs... Can anyone see where 
the problem is?

 

N-nrow(X) # Calculate number of rows = 108
p-ncol(X) # Calculate number of columns = 88
   

# Replace by columnwise mean
for (i in colnames(X)) # Do for all columns in the matrix
{ 
   for (j in rownames(X)) # Go through all rows
   {
  if(is.na(X[j,i])) # Search for missing value in the given position
  {
 X[j,i]=mean(X[1:p, i]) # Change missing value to the mean of the column
  }
   }
} 

 

All the best,

 

Joel

 


 
  
_
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Get rid of automatic title from Anova plots

2009-12-10 Thread Joel Fürstenberg-Hägg

Hi all,

 

I'm having a problem when putting the four plots (Residuals vs Fitted, Normal 
Q-Q, Scale - Location, and Residuals vs Leverage) from an Anova using 
plot(aov()) into a pdf. A string aov(df[,i] ~ cat)) is added as the main 
title, so when I use mtext() the two titles are overlapping. Does anyone know 
how to get rid of that title? I've tried plot(aov(df[,i] ~ cat), main=) but 
without succes.


 

pdf(Anova plots 0809.pdf, height=10, width=10)
par(mfrow=c(2,2), oma=c(2,2,4,2))


# Anova test for LT50 with different anthocyanin scores
df=fieldTrial[idx0809, c(31:32)]
cat=fieldTrial[idx0809, c(14)]
for (i in colnames(df))
{ 
   print(i)
   print(summary(aov(df[,i] ~ cat)))
   plot(aov(df[,i] ~ cat))
   mtext(text=paste(Anova test for, i, with different anthocyanin scores), 
cex=1.5, side=3, outer=TRUE)
}
dev.off()

 

Best regards,

 

Joel
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Multiple regression script

2009-12-07 Thread Joel Fürstenberg-Hägg

Hi all,

I'm doing Multiple linear regression for a data set. However, it takes a lot of 
time, as I would like to check every possible combination of factors, evalute 
the results based for instance on their p values, and then choose the best 
regression model.

So, I wonder if anyone might have a script for that? Or if not, do you have 
some suggestions how to create such a script?

I've been told there is a similar function in SAS, but I'm not sure how it 
works. Furthermore, I'm not sure how to deal with the evaluation of the 
results, are there any other factors I should consider, such as R square etc?

All the best,

Joel
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Lattice: multiple data sets on same plot

2009-12-03 Thread Joel Thomas
Thank you! Worked perfectly.
Is it also possible to do the same but for circular data, for example,
a density plot of circular object from the circular package using a
trellis display. I have the same set of data but var1 and var2 are
azimuth directions 0-360 so a standard density plot doesn't make much
sense.

Example data set is same as before except,
 pop - data.frame(var1=runif(2000, 0, 360), var2=runif(2000, 0, 360))

Thanks
Joel

2009/12/3 Felix Andrews fe...@nfrac.org:
 library(reshape)  ## the easy way
 xx - melt(x)
 head(xx)

 densityplot(~ value | cat1 * cat2, xx, groups = paste(variable, which),
            plot.points=FALSE, auto.key=list(columns=2),
            par.settings = simpleTheme(col = c(red,blue), lty=c(1,1,2,2)))


 Hint: using multiple terms in the formula as you did actually maps
 into the groups argument. It is generally not a good a idea to do
 that when you also specify groups directly.


 2009/12/3 Joel Thomas joel...@gmail.com:
 Hi,
 I have two data sets; one is a population and the other a sample of
 that population. I am trying to plot both on the same trellis display.

 # Example data set with two numerical attributes and two categorical
 pop - data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500))

 cat-(runif(2000)=.5)+0
 for(i in 1:length(cat)){
   if(cat[i] == 0){
      pop[i,cat1] = this
   }
   else{
      pop[i,cat1] = that
   }
 }
 cat-(runif(2000)=.5)+0
 for(i in 1:length(cat)){
   if(cat[i] == 0){
      pop[i,cat2] = here
   }
   else{
      pop[i,cat2] = there
   }
 }

 #Extract sample
 sam - pop[sample(1:2000,50),]

 #Combine data sets
 x - make.groups(pop, sam)

 #Create trellis display
 densityplot(~var1 + var2 | cat1 * cat2, data=x, groups=which,
 plot.points=FALSE, auto.key=list(columns=2))


 This does not produce what I want. I would like four density plots in
 each panel; var1 and var2 from the sample data as solid lines and var1
 and var2 from the population data as dotted lines with matching
 colours.

 densityplot(~ var1 + var2 | cat1 * cat2, data=x, groups=which,
      panel=panel.superpose,
      panel.groups = function(x, y,...){
        panel.densityplot(x, ...)
        })

 ... gives the same result.

 I've read The panel function demystified section of the book many
 times and still find the panel function mystifying. Could someone
 please explain how to do this and also how it works. Thankyou

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




 --
 Felix Andrews / 安福立
 Postdoctoral Fellow
 Integrated Catchment Assessment and Management (iCAM) Centre
 Fenner School of Environment and Society [Bldg 48a]
 The Australian National University
 Canberra ACT 0200 Australia
 M: +61 410 400 963
 T: + 61 2 6125 4670
 E: felix.andr...@anu.edu.au
 CRICOS Provider No. 00120C
 --
 http://www.neurofractal.org/felix/


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Lattice: multiple data sets on same plot

2009-12-02 Thread Joel Thomas
Hi,
I have two data sets; one is a population and the other a sample of
that population. I am trying to plot both on the same trellis display.

# Example data set with two numerical attributes and two categorical
pop - data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500))

cat-(runif(2000)=.5)+0
for(i in 1:length(cat)){
   if(cat[i] == 0){
  pop[i,cat1] = this
   }
   else{
  pop[i,cat1] = that
   }
}
cat-(runif(2000)=.5)+0
for(i in 1:length(cat)){
   if(cat[i] == 0){
  pop[i,cat2] = here
   }
   else{
  pop[i,cat2] = there
   }
}

#Extract sample
sam - pop[sample(1:2000,50),]

#Combine data sets
x - make.groups(pop, sam)

#Create trellis display
densityplot(~var1 + var2 | cat1 * cat2, data=x, groups=which,
plot.points=FALSE, auto.key=list(columns=2))


This does not produce what I want. I would like four density plots in
each panel; var1 and var2 from the sample data as solid lines and var1
and var2 from the population data as dotted lines with matching
colours.

densityplot(~ var1 + var2 | cat1 * cat2, data=x, groups=which,
  panel=panel.superpose,
  panel.groups = function(x, y,...){
panel.densityplot(x, ...)
})

... gives the same result.

I've read The panel function demystified section of the book many
times and still find the panel function mystifying. Could someone
please explain how to do this and also how it works. Thankyou

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Decision trees with factors and numericals

2009-11-24 Thread Joel Fürstenberg-Hägg

Hi all,

 

Does any of you know how to make a decision tree when the data set contains 
factors and numericals?

I've got a data frame with 3 columns, where y and x1 are numerical and x2 
contains factors. Is it possible to use the rpart package, and in that case 
how? Otherwise, is there another alternative?

 

This is what I've tried so far

 

 rpart(LT50_NA ~ Raf + Antho, data=decTreeNA, method=anova) # Have tried 
 method=class as well
Error in as.character(x) : 
  cannot coerce type 'closure' to vector of type 'character'

 

Best regards,

 

Joel
  
_
Lagra alla dina foton på Skydrive. Det är enkelt och säkert!
http://www.skydrive.live.com
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] From R to LaTeX to pdf?

2009-11-24 Thread Joel Fürstenberg-Hägg

Hi all,

 

Anyone experienced in the LaTeX format?

 

I'm trying to use the xtable package to create nice anova tables, but how do I 
do to produce a pdf from the resulting LaTeX table? I've tried WinShell and 
MiKTeX, but I couldn't get any of them working...

 

Here's an example of the output in R:

 

% latex table generated in R 2.9.2 by xtable 1.5-6 package
% Tue Nov 24 14:17:32 2009
\begin{tabular}{lr}
  \hline
  Df  Sum Sq  Mean Sq  F value  Pr($$F) \\ 
  \hline
cat  2  40.50  20.25  6.66  0.0019 \\ 
  Residuals  107  325.13  3.04 \\ 
   \hline
\end{tabular}

 

Best regards,

 

Joel
  
_
Lagra alla dina foton på Skydrive. Det är enkelt och säkert!
http://www.skydrive.live.com
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Error in text.rpart(fit) : fit is not a tree, just a root

2009-11-24 Thread Joel Fürstenberg-Hägg

Hi all,

 

I've tried to make a decision tree for the following data set:

 

Level X Response
279 C 2.4728646   -9.445
341 B 0.5986398   -9.413
343 B 1.1786271   -9.413
384 D 1.4797870   -9.413
390 C 2.0364569   -9.133
391 D 0.9365739   -9.133
452 A 1.2858741  -11.480
455 C 1.3256245   -9.413
510 C 0.5758865   -9.413
537 D 1.9289431   -9.413
540 C 1.8646144   -9.413
554 B 1.3903752  -10.080

 

Using these commands:

 

 fit=rpart(Response ~ X + Level, data=decTree, method=anova, 
 control=rpart.control(minsplit=1))
 
 printcp(fit) # display cp table  

Regression tree:
rpart(formula = Response ~ X + Level, data=decTree, method = anova, 
control = rpart.control(minsplit = 1))

Variables actually used in tree construction:
character(0)

Root node error: 4.4697/12 = 0.37247

n= 12 

CP nsplit rel error
1 0.01  0 1


I don't get a tree...

 

 plot(fit) # plot decision tree  
Error in plot.rpart(fit) : fit is not a tree, just a root
 text(fit) # label the decision tree plot  
Error in text.rpart(fit) : fit is not a tree, just a root

 

Can anyone tell me what's going wrong and give a hint how to solve it?

 

Best regards,

 

Joel

 

 
  
_
Nya Windows 7 - Hitta en dator som passar dig! Mer information. 
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 3D plot, rotatable and with adjustable symbols

2009-11-19 Thread Joel Fürstenberg-Hägg

Hi all,

 

I've tried to make a 3D plot, but have run into some problems.

 

I'd like to have a plot that I can rotate interactively using the mouse, which 
is possible using the plots3d {R.basic}. However, I would like to change the 
symbols used as the points, but there's no pch in plot3d().

 

If I use the Scatterplot3d package, I'm able to change this, but not able to 
rotate the plot interactively.

 

Does anyone know a solution to this? Maybe another package is better?

 

Best regards,

 

Joel
  
_
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Trellis settings get lost when printing to pdf

2009-11-13 Thread Joel Fürstenberg-Hägg

Hi all,

 

I've got some problems when changing the trellis settings for the lattice 
plots. The plots look exactly as I want them to when calling show.settings() as 
well as when plotting them in the graphical window. But when printing to a pdf 
file, none of the settings are used!? Does anyone know what might have 
happened? Because the when changing the trellis settings, these should remain 
in the new state until you close R right..?

 

# Change settings for the boxplot appearance
new.dot=trellis.par.get(box.dot)
new.rectangle=trellis.par.get(box.rectangle)
new.umbrella=trellis.par.get(box.umbrella)
new.symbol=trellis.par.get(plot.symbol)
new.strip.background=trellis.par.get(strip.background)
new.strip.shingle=trellis.par.get(strip.shingle)
new.dot$pch=|
new.dot$col=black
new.rectangle$col=black
new.rectangle$fill=grey65
new.umbrella$col=black
new.umbrella$lty=1 # Continous line, not dotted
new.symbol$col=black
new.strip.background$col=grey87 # Background colour in the upper label
new.strip.shingle$col=black # Border colour around the upper label
trellis.par.set(box.dot=new.dot, box.rectangle=new.rectangle, 
box.umbrella=new.umbrella, plot.symbol=new.symbol, 
strip.background=new.strip.background, strip.shingle=new.strip.shingle)

 

Best regards,

 

Joel
  
_
Nya Windows 7 - Hitta en dator som passar dig! Mer information. 
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loadings and scores from fastICA?

2009-11-12 Thread Joel Fürstenberg-Hägg

Ok, so then the S gives the individual components, good. Thanks Tony!

But what about the principal components from the PCA plot, how are they 
calculated?

And are the linear mixing matrix A really the same as the loadings/weights? 
There must be different loadings for the PCA and ICA right?

Best regards,

Joel

 Date: Wed, 11 Nov 2009 14:29:06 -0700
 From: tpl...@acm.org
 To: joel_furstenberg_h...@hotmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] Loadings and scores from fastICA?
 
 The help for fastICA says:
 
  The data matrix X is considered to be a linear combination of
  non-Gaussian (independent) components i.e. X = SA where columns of
  S contain the independent components and A is a linear mixing
  matrix.
 
 The value of fastICA is a list with components S (the estimated source 
 matrix) and A (the estimated mixing matrix).  Are these what you want?
 
 -- Tony Plate
 
 Joel Fürstenberg-Hägg wrote:
  Hi all,
  
   
  
  Does anyone know how to get the independent components and loadings from an 
  Independent Component Analysis (ICA), as well as principal components and 
  loadings from a Pricipal Component analysis (PCA) using the fastICA 
  package? Or perhaps if there's another way to do ICAs in R?
  
  
  Below is an example from the fastICA manual 
  (http://cran.r-project.org/web/packages/fastICA/fastICA.pdf)
  
   
  
  if(require(MASS))
  {
   x - mvrnorm(n = 1000, mu = c(0, 0), Sigma = matrix(c(10, 3, 3, 1), 2, 
  2))
   x1 - mvrnorm(n = 1000, mu = c(-1, 2), Sigma = matrix(c(10, 3, 3, 1), 
  2, 2))
   X - rbind(x, x1)
   a - fastICA(X, 2, alg.typ = deflation, fun = logcosh, alpha = 1, 
  method = R, row.norm = FALSE, maxit = 200, tol = 0.0001, verbose = TRUE)
   par(mfrow = c(1, 3))
   plot(a$X, main = Pre-processed data)
   plot(a$X%*%a$K, main = PCA components)
   plot(a$S, main = ICA components)
  }
  
   
  
  Best regards,
  
   
  
  Joel

  _
  Hitta kärleken i vinter!
  http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
  [[alternative HTML version deleted]]
  
  
  
  
  
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
  
_
Hitta kärleken nu i vår!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] prcomp() PCA vs fastICA() PCA?

2009-11-11 Thread Joel Fürstenberg-Hägg

Hi all,

 

I wonder what the difference is between the functions prcomp and the PCA 
plotting method used in example 3 from the fastICA package. They give totally 
different plots. The reason for asking is that I've earlier used prcomp, but 
now I should do an ICA, and I guess I cannot compare the PCA plot from prcomp 
with the ICA plot if the two PCA plots looks different?

 

Does anyone knows anything about this? Maybe there's a different approach 
that's better?

 

 

if(require(MASS))

{
   x - mvrnorm(n = 1000, mu = c(0, 0), Sigma = matrix(c(10, 3, 3, 1), 2, 2))
   x1 - mvrnorm(n = 1000, mu = c(-1, 2), Sigma = matrix(c(10, 3, 3, 1), 2, 2))
   X - rbind(x, x1)
   a - fastICA(X, 2, alg.typ = deflation, fun = logcosh, alpha = 1,
   method = R, row.norm = FALSE, maxit = 200,
   tol = 0.0001, verbose = TRUE)
   par(mfrow = c(1, 3))
   plot(a$X, main = Pre-processed data)
   plot(a$X%*%a$K, main = PCA components)
   plot(a$S, main = ICA components)
}


PC=prcomp (X, center=T, scale=T)
hcl=hclust(dist(df))
plot(PC$x[,1],PC$x[,2], main=PCA components (prcomp))

 

 

Best regards,

 

Joel
  
_
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Loadings and scores from fastICA?

2009-11-11 Thread Joel Fürstenberg-Hägg

Hi all,

 

Does anyone know how to get the independent components and loadings from an 
Independent Component Analysis (ICA), as well as principal components and 
loadings from a Pricipal Component analysis (PCA) using the fastICA package? Or 
perhaps if there's another way to do ICAs in R?


Below is an example from the fastICA manual 
(http://cran.r-project.org/web/packages/fastICA/fastICA.pdf)

 

if(require(MASS))
{
 x - mvrnorm(n = 1000, mu = c(0, 0), Sigma = matrix(c(10, 3, 3, 1), 2, 2))
 x1 - mvrnorm(n = 1000, mu = c(-1, 2), Sigma = matrix(c(10, 3, 3, 1), 2, 
2))
 X - rbind(x, x1)
 a - fastICA(X, 2, alg.typ = deflation, fun = logcosh, alpha = 1, 
method = R, row.norm = FALSE, maxit = 200, tol = 0.0001, verbose = TRUE)
 par(mfrow = c(1, 3))
 plot(a$X, main = Pre-processed data)
 plot(a$X%*%a$K, main = PCA components)
 plot(a$S, main = ICA components)
}

 

Best regards,

 

Joel
  
_
Hitta kärleken i vinter!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] PCA with tow response variables

2009-11-04 Thread Joel Fürstenberg-Hägg

Hi all,

 

I'm new to PCA in R, so this might be a basical thing, but I cannot find 
anything on the net about it.

I need to make a PCA plot with two response variables (df$resp1 and df$resp2) 
against eight metabolites (df$met1, df$met2, ...) and I don't have a clue how 
to do... and I've only used the simplest PCAs before, like this:

 

pcaObj=prcomp(t(df[idx, c(40:47)]))

biplot(pcaObj)

 

Anyone who knows how to do?

 

Best rageds,

 

Joel
  
_
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Change negative values in column

2009-11-03 Thread Joel Fürstenberg-Hägg

Hi all,

 

I'm trying to write a script that changes all negative values in a data frame 
column to a small positive value, based on the the minimum value of the column.

However, I get the following error:

 

Error in if (x[i]  0) { : argument is of length zero

 

 

As well, I would minimum to be the smallest of the non-negative values...

 

 

Aa_non_neg=(fieldTrial0809$Aa) # Copy column from data frame to manipulate

 

nonNegative = function(x)
{
   minimum=min(x) # Should only use positive minimum!
   for (i in x)
   {

  if(x[i]0) # Found a negative value
  {
 x[i]=minimum/10 # Change to a new non-negative value
  }
   }
}

 

nonNegative(Aa_non_neg) # Apply function on column
  
_
Lagra alla dina foton på Skydrive. Det är enkelt och säkert!
http://www.skydrive.live.com
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Exclude rows in xyplot

2009-10-27 Thread Joel Fürstenberg-Hägg

Hi all,

I'm searching for a way to exclude outliers from my dataset while making 
xyplots. While plotting using pairs(), I exclude specific row in my data frame 
and save the settings as a variable which I later include as an argument:

# Discard outliers and save settings as idx
idx=with(fieldTrial0809, which(Pro0  Pro0.95  Fum0  Fum0.4   Mal0.1  
Mal2.5  Glc2  Glc20  Fru1  Fru30  Raf0  Raf3  Suc1  Suc14))

#Plot the numerical and ranked columns pair wise using pairs()
pdf(ranked.pdf, height=20, width=20)
pairs(fieldTrial0809[idx, c(21,26,30,32,34,36,38,40,42,44,46,48,50)], 
main=Ranked, col=blue, pch=°, gap=0.2)
dev.off()

Now I'm trying to make xyplots to compare the result from three different 
categories:

# Plot Pro against Glc for each of the three categories
xyplot(Pro ~ Glc | Categories_BBCH_ID, data=fieldTrial0809, pch=°, 
layout=c(1, 3), aspect=1, index.cond=list(3:1))

I would like to exlude outliers like above. I've found that limits can be used 
in a similar manner as with xlim and ylim, but though I've read about them I 
don't understand how to solve it... Anyone who can help me?

All the best,

Joel


  
_
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Print several xyplots to the same page in a pdf file

2009-10-27 Thread Joel Fürstenberg-Hägg

Hello everybody,

I'm using the lattice package and the xyplot to make several graphs like below. 
However, I can just print the three grouped plots onto one page as I'm putting 
them into a pdf-file, which gives me a huge amount of pages... Is it possible 
to put them all, or at least more than one on the same page, for instance put 
three groups beside each other like columns?

...
xyplot(Pro ~ Glc | Categories_BBCH_ID, data=fieldTrial0809, pch=°, 
layout=c(1, 3), aspect=1, index.cond=list(3:1))
xyplot(Pro ~ Raf | Categories_BBCH_ID, data=fieldTrial0809, pch=°, 
layout=c(1, 3), aspect=1, index.cond=list(3:1))
xyplot(Pro ~ Suc | Categories_BBCH_ID, data=fieldTrial0809, pch=°, 
layout=c(1, 3), aspect=1, index.cond=list(3:1))
xyplot(Fum ~ Aa | Categories_BBCH_ID, data=fieldTrial0809, pch=°, layout=c(1, 
3), aspect=1, index.cond=list(3:1))
xyplot(Fum ~ Pro | Categories_BBCH_ID, data=fieldTrial0809, pch=°, 
layout=c(1, 3), aspect=1, index.cond=list(3:1))
etc...

All the best,

Joel
  
_
Nya Windows 7 - Hitta en dator som passar dig! Mer information.
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Change positions of columns in data frame

2009-10-23 Thread Joel Fürstenberg-Hägg

Hi all,

Probably a simple question, but I just can't find a simple answear in the older 
threads or anywhere else.

I've added some new vectors as columns in a data frame using cbind(). As 
they're all put as the last columns inte the data frame, I would like to move 
them to specific positions. How do you do to change the position of a column in 
a data frame?

I know I can use 
fieldTrial0809=data.frame(Sample_ID=as.factor(fieldTrial0809$Sample_ID), 
Plant_ID=as.factor(fieldTrial0809$Plant_ID), ...) to create a new data frame 
with the given columns in the specified order, but there must be an easier 
way..?

All the best,

Joel
  
_
Nya Windows 7 - Hitta en dator som passar dig! Mer information. 
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Automatization of non-linear regression

2009-10-22 Thread Joel Fürstenberg-Hägg

Hi everybody,

 

I'm using the method described here to make a linear regression:

 

http://www.apsnet.org/education/advancedplantpath/topics/Rmodules/Doc1/05_Nonlinear_regression.html

 

 ## Input the data that include the variables time, plant ID, and severity
 time - c(seq(0,10),seq(0,10),seq(0,10))
 plant - c(rep(1,11),rep(2,11),rep(3,11))
 
 ## Severity represents the number of
 ## lesions on the leaf surface, standardized
 ## as a proportion of the maximum
 severity - c(
+ 42,51,59,64,76,93,106,125,149,171,199,
+ 40,49,58,72,84,103,122,138,162,187,209,
+ 41,49,57,71,89,112,146,174,218,250,288)/288
 data1 - data.frame(
+ cbind(
+ time,
+ plant,
+ severity
+ )
+ )
 
 ## Plot severity versus time 
 ## to see the relationship between## the two variables for each plant
 plot(
+ data1$time,
+ data1$severity,
+ xlab=Time,
+ ylab=Severity,
+ type=n
+ )
 text(
+ data1$time,
+ data1$severity,
+ data1$plant
+ )
 title(main=Graph of severity vs time)
 
 getInitial(
+ severity ~ SSlogis(time, alpha, xmid, scale),
+ data = data1
+ )
alpha  xmid scale 
 2.212468 12.506960  4.572391 
 
 
 ## Using the initial parameters above,
 ## fit the data with a logistic curve.
 para0.st - c(
+ alpha=2.212,
+ beta=12.507/4.572, # beta in our model is xmid/scale
+ gamma=1/4.572 # gamma (or r) is 1/scale
+ )
 
 fit0 - nls(
+ severity~alpha/(1+exp(beta-gamma*time)),
+ data1,
+ start=para0.st,
+ trace=T
+ )
0.1621433 :  2.212 2.7355643 0.2187227 
0.1621427 :  2.2124095 2.7352979 0.2187056 
 
 ## Plot to see how the model fits the data; plot the
 ## logistic curve on a scatter plot
 plot(
+ data1$time,
+ data1$severity,
+ type=n
+ )
 
 text(
+ data1$time,
+ data1$severity,
+ data1$plant
+ )
 
 title(main=Graph of severity vs time)
 
 curve(
+ 2.21/(1+exp(2.74-0.22*x)),
+ from=time[1],
+ to=time[11],
+ add=TRUE
+ )


As you can see I have to do some work manually, such as setting the numbers to 
be used for calculation of alpha, beta and gamma. I wonder if you might have an 
idea how to automatize this? I suppose it should be possible to save the output 
from getInitial() and reach the elements via index or something, but how?

 

I guess a similar approach could be used for the values of fit0?

 

Or even better, if the variables alpha, beta and gamma could be used right away 
for instance in curve(), instead of adding the values manually. But just 
exchanging the values with the varables (alpha instead of 2.21 etc) doesn't 
seem to work. What is the reason for that? Any solution?

 

A last, general but somewhat related question. If I set variables in a function 
such as para0.st - c(alpha=2.212, ...), is it just stored locally, or can it 
be used globally, I mean, can I use the variable anywhere (for instance in 
curve()) or just in the function where it was created? I'm asking because I'm 
used to Java, where the life time of local variabels only extends to the 
closing braces, while global variables can be reached everywhere.

 

The reason for automatization is that I'll have to repeat the procedure more 
than a hundred times, while making overview pair waise plots of my data, with 
both this logaritmic regression and several others (exponential, monomoelcular, 
logistic, Gompertz and Weibull).

 

 

Wish you all the best,

 

Joel
  
_
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Division of data frame and deletion of values from column

2009-10-16 Thread Joel Fürstenberg-Hägg

Hi all,

I guess this might be an easy question, but I've searched multiple help pages 
without finding any answear... so now I put my trust in you!

I have a data frame (36 variables and 556 observations). One column contains  
three factors, and I would like to divide the data frame into three new ones, 
based on the value of the factors, thereby having only one value for all 
elements of the particular column in each of the data frames. The reason is 
that I later will create plots and do statistical analyzes on these data 
frames, and I don't want those factors affecting the result.
ID Weight  Age_days ...
1   18   76.1   106
2   19   77.0   175  
3   20   78.1   121
4   21   78.2   121
5   22   78.8   106
6   23   76.3   106
.
.
.

I also have another column containing several factors, of which I would like to 
exclude one (get NA instead).

ID Weight  Age_days  Value_ID ...
1   18   76.1   106  high
2   19   77.0   175   low
3   20   78.1   121middle
4   21   78.2   121  high
5   22   78.8   106  high
6   23   76.3   106number   -- exclude
7   24   76.9   175   low
.
.
.

I really hope someone could help me, though you might think it's too easy...

Best regards,

Joel
  
_
Hitta kärleken nu i vår!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot overview xy plots from data frame?

2009-10-14 Thread Joel Fürstenberg-Hägg

Hi,

I've got a data frame (556 rows and 36 columns) from which I need to create 
several xy plots and print to pdf, in order to detect outliers and trends in 
the data. 16 of the columns contains numerical values, and I would like to 
create graphs for all combinations. It can be done manually, but creating 256 
plots by hand takes time... I guess I have to iterate through the data frame, 
but I'm not used to do that with R. Below I've written my thoughts, trying to 
combine my knowledge in Java and R, just to give you the idea: 

pdf(FieldTrial0809Overview.pdf)

int colWidth = fieldTrial[0].length;


for(i=0, icolWidth, i++)
{
for(j=0, jcolWidth, j++)
{
String colI=get.fieldTrial$i;
String colJ=get.fieldTrial$j;

plot(fieldTrial$i~fieldTrial$j, main=colI +  vs  + colJ, xlab=colI, 
ylab=colJ)
}
}

dev.off()

Anyone who know how to solve this?
Do I have to copy the 16 numerical columns to a new dataset, because they are 
not grouped and there are 20 additional non-numerical columns in the data frame.
By the way, can the iterations be made using R, or do you have to combine with 
for instance Perl?

All the best,

Joel
  
_
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read and sac files from windows 07

2009-09-01 Thread joel ulises sevilla
Dear friends maybe someone can help this freshman at R, by tell step by step
how can I read files from windows 2003-2007 to Rgui, I had tried all, no see
solution??

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Coding problem: How can I extract substring of function call within the function

2009-08-13 Thread Pitt, Joel
In order to ease my students into the R environment I am developing a package 
which installs a variety of utility functions as well as slightly modified 
versions of some standard R functions -- e.g. mean, hist, barplot,  In my 
versions of these standard R functions I either add options or alter some 
defaults that seem to create difficulties for most of my students -- for 
example, when they do barcharts for two dimensional tables they generally want 
the bars to be side-by-side and stumble over the standard default of besides=F, 
and my version of mean by default reports a mean value in the presence of NA's 
after warning of that presence (but retains the option of setting na.rm=F). (I 
don't doubt that some (if not many) of you will doubt the wisdom of this, and I 
would be happy to discuss this in more detail on other occasions.) You might 
want to think of my replacement R functions as a kind of training wheels for 
R, and, in the spirit of training wheels I include a funct!
 ion in my package that allows a user to revert to the standard version of one 
or all functions without unloading the package (and loosing its additional 
functionality). However, I want to add a function that allows a user to revert 
to running the standard R version of a given function on a one-off basis and 
that's where my problem comes up.
 
I believe that it should be possible to write a function rStd with the usage 
rStd(x,...) where x is a function -- e.g. mean, hist, barchart, and the 
remaining parameters would be any of the parameters that should be passed to 
the unmodified version of mean, hist, barchart... The problem I have is how to 
get ahold of that collection of parameters as a single character string. Now I 
know that sys.calls()[[1]] will give me the full text of the initial call, but 
the problem is to detach the ... above from that as a text string. If I could 
do that I'd be done.
 
Here's the incomplete code with comments -- see the gap set off by astericks. 
 
rStd=function(x,...){
if(missing(x))  # must have a specified function
{
   cat(Error: No function specified\n);
   return(invisible(NULL));
}
z=as.character(substitute(x));
# must include code here to check that z is the name
# of one of our altered functions
# if z is an altered function, e.g., mean
# then concatenating x with z gives the overlaid
# function -- e.g. xmean is the standard mean
#***
# Now we need to get a hold of the ... text 
 *
#   
  *
w=sys.calls()[[1]];  # this gets me the whole text of the call  *
#   
  *
# and now here's where the problem arises *
# how to I get the ... text if I could get it and say   
   *
# assign it to the variable params  
 *
# I could then set  
*
#   
  *
cmd=sprintf(x%s(%s),z,params) # see remarks above about z
   # and then it's done
eval(parse(text=cmd),sys.frame());
}
 
 
Any help would be much appreciated.
 
Regards
Joel
Joel Pitt, Ph.D.
Associate Professor  Chair
Mathematics  Computer Science
Georgian Court University
900 Lakewood Avenue
Lakewood, NJ 08540
732-987-2322

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Coding problem: How can I extract substring of function callwithin the function

2009-08-13 Thread Pitt, Joel
Thanks. It's a great solution to part of my problem. It provides the 
functionally I want would be no harder for students to use than my approach. 
I'm still interested in how to make what I was trying to do work -- simply to 
add to my own R programming proficiency. 
 
Joel



From: Erik Iverson [mailto:eiver...@nmdp.org]
Sent: Thu 8/13/2009 4:59 PM
To: Pitt, Joel; r-help@r-project.org
Subject: RE: Coding problem: How can I extract substring of function callwithin 
the function



Are you sure you just don't want to tell them about the :: operator?  It sounds 
easier than what you're proposing.

E.g.,

base::mean(c(1:10, NA))

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Pitt, Joel
Sent: Thursday, August 13, 2009 3:48 PM
To: r-help@r-project.org
Subject: [R] Coding problem: How can I extract substring of function call 
within the function

In order to ease my students into the R environment I am developing a package 
which installs a variety of utility functions as well as slightly modified 
versions of some standard R functions -- e.g. mean, hist, barplot,  In my 
versions of these standard R functions I either add options or alter some 
defaults that seem to create difficulties for most of my students -- for 
example, when they do barcharts for two dimensional tables they generally want 
the bars to be side-by-side and stumble over the standard default of besides=F, 
and my version of mean by default reports a mean value in the presence of NA's 
after warning of that presence (but retains the option of setting na.rm=F). (I 
don't doubt that some (if not many) of you will doubt the wisdom of this, and I 
would be happy to discuss this in more detail on other occasions.) You might 
want to think of my replacement R functions as a kind of training wheels for 
R, and, in the spirit of training wheels I include a funct!
 ion in my package that allows a user to revert to the standard version of one 
or all functions without unloading the package (and loosing its additional 
functionality). However, I want to add a function that allows a user to revert 
to running the standard R version of a given function on a one-off basis and 
that's where my problem comes up.

I believe that it should be possible to write a function rStd with the usage 
rStd(x,...) where x is a function -- e.g. mean, hist, barchart, and the 
remaining parameters would be any of the parameters that should be passed to 
the unmodified version of mean, hist, barchart... The problem I have is how to 
get ahold of that collection of parameters as a single character string. Now I 
know that sys.calls()[[1]] will give me the full text of the initial call, but 
the problem is to detach the ... above from that as a text string. If I could 
do that I'd be done.

Here's the incomplete code with comments -- see the gap set off by astericks.

rStd=function(x,...){
if(missing(x))  # must have a specified function
{
   cat(Error: No function specified\n);
   return(invisible(NULL));
}
z=as.character(substitute(x));
# must include code here to check that z is the name
# of one of our altered functions
# if z is an altered function, e.g., mean
# then concatenating x with z gives the overlaid
# function -- e.g. xmean is the standard mean
#***
# Now we need to get a hold of the ... text 
 *
#   
  *
w=sys.calls()[[1]];  # this gets me the whole text of the call  *
#   
  *
# and now here's where the problem arises *
# how to I get the ... text if I could get it and say   
   *
# assign it to the variable params  
 *
# I could then set  
*
#   
  *
cmd=sprintf(x%s(%s),z,params) # see remarks above about z
   # and then it's done
eval(parse(text=cmd),sys.frame());
}


Any help would be much appreciated.

Regards
Joel
Joel Pitt, Ph.D.
Associate Professor  Chair
Mathematics  Computer Science
Georgian Court University
900 Lakewood Avenue
Lakewood, NJ 08540
732-987-2322

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted

Re: [R] Coding problem: How can I extract substring of function callwithin the function

2009-08-13 Thread Pitt, Joel
Your objections are quite cogent, but I believe they are misdirected. I'm not 
at all interested in having my students ignore the existence of NA's and that's 
precisely why I'm not using the Default package as someone else suggested. But 
the mere existence of missing values in a data set doesn't make computation of 
the mean entirely useless -- why else would the na.rm option be available. If a 
student using my version of mean uses it to find the mean of a variable that 
has missing values, the function first prints a warning message and only then 
returns a value. Here's an example
 
 length(x)
[1] 101
 mean(x)
Warning: x has 3 missing values.
[1] 51.69388

My only goal in this project has been to provide them with a somewhat friendlyR 
version of R. It was not conceived as part of a quest to improve my programming 
proficiency, but my curiousity can be piqued when I run up against a 
programming problem.
 
Joel
 
 
 



From: Steve Lianoglou [mailto:mailinglist.honey...@gmail.com]
Sent: Thu 8/13/2009 5:55 PM
To: Pitt, Joel
Cc: Erik Iverson; r-help@r-project.org
Subject: Re: [R] Coding problem: How can I extract substring of function 
callwithin the function



Hi,

On Aug 13, 2009, at 5:30 PM, Pitt, Joel wrote:

 Thanks. It's a great solution to part of my problem. It provides the 
 functionally I want would be no harder for students to use than my 
 approach. I'm still interested in how to make what I was trying to 
 do work -- simply to add to my own R programming proficiency.

I wasn't going to really chime in, but I couldn't help it given the 
irony in your last sentence (sorry, I don't mean to sound like an ass).

I think trying to help your students with some bumps on the road is 
admirable, but this seems just a bit misdirected. As you say, you are 
on a quest to add to your R programming proficiency, and will apply 
this newly founded technique to actively handicap your students' 
proficiency.

I guess you're teaching some intro stat analysis class, and waving 
over the fact that functions like mean explicitly return NA in the 
presence of NA's, but this is important to know and recognize when 
analyzing any real data, because there will surely be NA's in the 
wild. Knowing that you should consciously and deliberately deal with/
ignore them from the start might be a good first/early lesson for 
students to digest.

Like I said, I don't mean to sound like an ass, but I think glossing 
over details of working with data should be avoided. Your other 
additions, like adding options to plotting/graphing functions, seem 
less harmful to me. But if you're trampling over some base:: function 
for something trivial like changing the value of one default parameter 
to something else, you might as well just get them to learn how to use 
the ?function_name asap as well.

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Coding problem: How can I extract substring of function call within the function

2009-08-13 Thread Pitt, Joel
Hi,
 
As I said in my original email, I'm sure that many of you will doubt the wisdom 
of what I'm trying to do -- and I certainly share some of your misgivings. I 
have misgivings too about the use of training wheels for bicycles, but they 
are clearly useful for some people, and, in this instance, I think that 
smoothing students passage over what I have seen to be genuine stumbling blocks 
for them outweighs the drawbacks. I am not merely changing defaults -- if that 
was all I believe I would be doing students a disservice. My version of mean 
doesn't merely return a value in the presence of missing values, it prints a 
warning if missing values are pressent. I think the one step with my version
 
 mean(x)   # my version
Warning: x has 3 missing values.
[1] 51.69388
 base::mean(x)  
[1] NA
 length(x[is.na(x)])# oops, some missing values, I wonder 
 how many?
[1] 3  # not too bad, let's look find 
the mean without them
 base::mean(x,na.rm=T)
[1] 51.69388

It has some other useful features which I needn't go into here.
 
I have not yet used this package but plan to use it in my classes this fall, 
and I thought about using alternate names for my function versions (Mean vs. 
mean, Table vs. table, Hist vs. hist -- John Fox does that in his Rcmdr) but 
decided against it. I believe that by carefully explaining the difference 
between the versions in my package and the standard versions students will be 
able to adjust to using the standard version if and when they need or choose 
to. 
 
I have considerable experience using R in both introductory and moderately 
advanced classes, and despite my enthusiasm for it have had at best very mixed 
success. I am certainly not unique in belief that by making initial exposure to 
R fit more closely to student needs we will create more real R users in the 
long run. Clearly the several different versions of menu-driven front ends have 
the same goal. Since I believe the R console is the right environment for 
exploratory data analysis I prefer to avoid the menu driven detour.
 
Regards,
Joel
 
 



From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
Sent: Thu 8/13/2009 5:19 PM
To: Pitt, Joel
Cc: r-help@r-project.org
Subject: Re: [R] Coding problem: How can I extract substring of function call 
within the function



The Defaults package can be used to change the defaults of
functions and reset them back.

There is some question on whether all this is advisable.
It will invalidate any books, documentation, examples
in the help files that come with R and other
resources on R that they might have otherwise used
by introducing deliberate differences.  Later, to learn
standard R it will be harder since they will have to
unlearn what they learned.

If you really must do this I would suggest
using different names, e.g. mean2 or Mean,
so its clear one is using non-standard versions.
In that case you don't need rStd in the first place.

Even better, perhaps a one page cheat sheet of
common forms would be better than a package
full of trivially and annoyingly changed functions, e.g.

mean(x, na.rm = TRUE)  # mean of non-missings in x
barplot(x, beside = TRUE) # bar chart placing bars beside each other

On Thu, Aug 13, 2009 at 4:48 PM, Pitt, Joelpi...@georgian.edu wrote:
 In order to ease my students into the R environment I am developing a package 
 which installs a variety of utility functions as well as slightly modified 
 versions of some standard R functions -- e.g. mean, hist, barplot,  In my 
 versions of these standard R functions I either add options or alter some 
 defaults that seem to create difficulties for most of my students -- for 
 example, when they do barcharts for two dimensional tables they generally 
 want the bars to be side-by-side and stumble over the standard default of 
 besides=F, and my version of mean by default reports a mean value in the 
 presence of NA's after warning of that presence (but retains the option of 
 setting na.rm=F). (I don't doubt that some (if not many) of you will doubt 
 the wisdom of this, and I would be happy to discuss this in more detail on 
 other occasions.) You might want to think of my replacement R functions as a 
 kind of training wheels for R, and, in the spirit of training wheels I 
 include a fun!
 ct!
  ion in my package that allows a user to revert to the standard version of 
 one or all functions without unloading the package (and loosing its 
 additional functionality). However, I want to add a function that allows a 
 user to revert to running the standard R version of a given function on a 
 one-off basis and that's where my problem comes up.

 I believe that it should be possible to write a function rStd with the usage 
 rStd(x,...) where x is a function -- e.g. mean, hist, barchart, and the 
 remaining parameters would be any of the parameters

[R] logistic regression with repeated measures

2009-08-10 Thread Joel Bried
Hello ,

I am writing because I would need some advice on the following question. I am 
working on paternity in a monogamous bird species and I am performing analyses 
to check whether the probability for a male to be cuckolded (binary variable) 
depends on his body size, the body size of his female, the degree of genetic 
relatedness to his female and nest density around his own nest (all continuous 
variables).
Since I have data for two years (2002 and 2003), I think that the best solution 
is to conduct a logistic regression for repeated measures.
However, I am a bit worried to use my entire data set. Indeed, a few 
individuals changed partner between 2002 and 2003 (they divorced or became 
widowed). For some other pairs, I have data for one year only (the birds did 
not attempt to breed the other year).
Under these conditions, I am wondering what I should do. 

Shall I use my whole data set? 

Shall I use a subset including only those males for which I have data for both 
years (in this subset, two males changed female between 2002 and 2003, but no 
female changed male. If I use pairs as a random variable, I will account for 
the non-independence of the partners within pairs, but I will have twice two 
pairs that are not independent from each other since they will have the same 
male, and these four pairs will only have one year of data)? 

Or shall I use only the pairs for which I have two years of data (in this case, 
I will only have 13 clusters, vs 55 if I use the whole data set)?

Thank you in advance for your help.

Joël Bried


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Preventing .Call from printing a blank line to the R console on Windows

2009-06-10 Thread Joel
Hello everyone,

I am using the CVODES integrator in the Rsundials package.  Every time
I call the integrator, a blank line is printed in the console.  Using
debug, I was able to isolate the problem to this line in the function
cvodes(...):

solutions = .Call(cvodes, PACKAGE = Rsundials, as.double(y), ...

Since I am running the integrator thousands of times, I wind up with
thousands of blank lines.  This makes it hard to print out periodic
updates from a for loop; they are lost among all the blank lines!

Is it somehow possible to stop this .Call command from printing a
blank line?

Thank you for your help.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


<    1   2