Re: [R] an apply question

2013-01-19 Thread David Winsemius


On Jan 18, 2013, at 9:17 PM, m p wrote:


Hello,
It should be easu but I cannot figure out how to use apply function.


Unless this is a homework question then using `apply` seems inefficient.

I am
trying to replace negative values in an array with these values + 24.
Would appreciate help. Thanks,
Mark

shours - apply(fhours, function(x){if (x  0) x - x+24})
Error in match.fun(FUN) : argument FUN is missing, with no default


You should not use the assignment operator in the expression that  
forms the consequent for `ifelse`. (Furthermore apply takes three  
arguments and you only have two.)


Vectorize:

mat1-matrix(sample(-10:10,40,replace=TRUE),ncol=5)

 mat1[mat1  0] - mat1[mat1  0]+24
 mat1
 [,1] [,2] [,3] [,4] [,5]
[1,]24   2310
[2,]   187   103   16
[3,]   10   16   16   160
[4,]336   173
[5,]   21069   16
[6,]   104600
[7,]78   210   20
[8,]   197   15   195



[[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.


David Winsemius, MD
Alameda, CA, USA

__
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] How to re-project ease( Equal Area Scalable Earth) grid with a ~25 km cylindrical projection to WGS84 0.25 degree?

2013-01-19 Thread Barry Rowlingson
On Fri, Jan 18, 2013 at 5:11 PM, Jonsson amen.alya...@bordeaux.inra.fr wrote:

 -raster(C:\\Users\\aalyaari\\Desktop\\SM_RE01_MIR_CLF31D_20100812T00_20100812T235959_246_001_7.nc,
 varname = Soil_Moisture)
 d:
 class   : RasterLayer
 dimensions  : 586, 1383, 810438  (nrow, ncol, ncell)
 resolution  : 0.2603037, 0.2916659  (x, y)
 extent  : -180, 180, -85.4581, 85.4581  (xmin, xmax, ymin, ymax)
   coord. ref. : +proj=longlat +datum=WGS84
 names   : Retrieved.soil.moisture.value
zvar: Soil_Moisture
a - spTransform(d, CRS (+proj=longlat +ellps=WGS84 +datum=WGS84
 +no_defs))
 but I got this error:

  Error in function (classes, fdef, mtable)  :
   unable to find an inherited method for function ‘spTransform’
 for signature ‘RasterLayer, CRS’


 And what is the error telling you? That there's no method for
spTransform that applies to RasterLayers.

 To transform a raster from one projection to another you need to use
projectRaster from the raster package. Note that generally this can
involve warping a raster and interpolating the new values to get a
grid of cells in the new coordinate system.

 But... you were trying to do this:

 a - spTransform(d, CRS (+proj=longlat +ellps=WGS84 +datum=WGS84  +no_defs))

where d was:

 coord. ref. : +proj=longlat +datum=WGS84

 - which is a no-op. The source and destination have the same
coordinate reference system. You need to tell raster what the
coordinate system of the source is. See ?projection - note this
doesn't change the raster or do any projection, its just to tell the
system what the coordinates in the data represent - lat,long or metres
or whatever..

I looked in the HDR file and saw nothing about the projection, so I
don't know how to specify what you've got.

 Also, you didn't point us to the .nc file you used in your example.

Also also, you should probably be posting to R-sig-geo.

Barry

__
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] import data (txt) separated by many blank spaces and lines with variable names that correspond to multiple observations.

2013-01-19 Thread mary
Hello,
 I have read other posts and in part I tried to solve my problem.
I have a txt file but the values ​​as well as being separated by many blank
spaces and lines

eg.var_a var_b   var_c
1   2 4
5 2 
62

have an encoding problem in the header, let me explain: some of the
variables grouping multiple observations throughout the text

egvar_a = 1var_b = 2,4,5 var_c=2   etc.

now I have tried to achieve by removing the header and doubling the name
of the variable where needed but the problem still remains to convert the
data that come out like this:

istr-scan(file.choose(), what = numeric, sep=\n,quote=\',
 n = -1, dec = .,flush = FALSE, fill = FALSE, strip.white = TRUE,
quiet = FALSE, blank.lines.skip = TRUE, multi.line = TRUE)

[25877] 1\t\t \t \t \t1\t \t1\t1\t1\t \t2\t4\t
[25878]  t5\t\t\t\t2\t6\t\t\t\t2   

write.table(istr, qmethod = double)
25877 1  2  4  
25878   5  2 6  2 

but remains the problem: 
- all numbers are in a unique quote  (i would like a separeted cells)  
- in txt format variables are not exhausted all in the first line, but for
example from the first to the fifth
however, when R imports, each line seems to be an observation in my case an
individual (n)

how to solve it?



--
View this message in context: 
http://r.789695.n4.nabble.com/import-data-txt-separated-by-many-blank-spaces-and-lines-with-variable-names-that-correspond-to-mult-tp4656041.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] importing large datasets in R

2013-01-19 Thread Wensui Liu
take a look at ff package
On Jan 19, 2013 7:04 AM, gaurav singh gauravonlin...@gmail.com wrote:

 Hi Everyone,

 I am a little new to R and the first problem I am facing is the dilemma
 whether R is suitable for files of size 2 GB's and slightly more then 2
 Million rows. When I try importing the data using read.table, it seems to
 take forever and I have to cancel the command. Are there any special
 techniques or methods which i can use or some tricks of the game that I
 should keep in mind in order to be able to do data analysis on such large
 files using R?

 --
 Regards
 Gaurav Singh

 [[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]]

__
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] importing large datasets in R

2013-01-19 Thread Duncan Murdoch

On 13-01-19 3:28 AM, gaurav singh wrote:

Hi Everyone,

I am a little new to R and the first problem I am facing is the dilemma
whether R is suitable for files of size 2 GB's and slightly more then 2
Million rows. When I try importing the data using read.table, it seems to
take forever and I have to cancel the command. Are there any special
techniques or methods which i can use or some tricks of the game that I
should keep in mind in order to be able to do data analysis on such large
files using R?



Specifying the type of each column with colClasses will speed up 
read.table a lot in a big file.


You have a lot of data, so having a lot of memory will help.  You may 
want to work in 64 bit R, which has access to a lot more than 32 bit R sees.


Duncan Murdoch

__
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] calculating mean matrix

2013-01-19 Thread ya
Hi list,

Thank you vey much for reading this post.

I have a data frame, I am trying to split it into a couple of data frame using 
one of the columns, say, x. After I get the data frames, I am planning to treat 
them as matrices and trying to calculate an element by element mean matrix. 
Could anyone give me some advice how to do it?

So far, I know that if I have a couple of matrices, say 
data1,data2,data3,data4...dataN, I can do it like this:

data=array(cbind(data1,data2,data3,data4,dataN), c(2, 3, N))
#2 refers to row number of matrix, 3 refers to column number of matrix, N 
refers to number of matrices to be averaged.
meanmtrx=apply(data,1:2,mean)

but I do not know how to use the resulting data frames with cbind(). Maybe 
there are other better ways. Any advice is appreciated.

Thank you very much.

Have a nice day.

ya 
[[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] calculating mean matrix

2013-01-19 Thread David L Carlson
I'm not sure I understand your question. It is always better to use an
example:

 set.seed(42)
 dataN - array(sapply(1:5, function(i) assign(paste0(data,i), 
+ matrix(rnorm(6), 2, 3))), c(2, 3, 5))
 meanmtrx - apply(dataN,1:2,mean)
 meanmtrx
 [,1]   [,2]   [,3]
[1,]  0.189669255  0.3368646 0.34261301
[2,] -0.009700353 -0.4676745 0.01974906

The result is a matrix, not a data frame, and certainly not resulting
data frames. What are you trying to cbind?

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of ya
 Sent: Saturday, January 19, 2013 8:50 AM
 To: r-help
 Subject: [R] calculating mean matrix
 
 Hi list,
 
 Thank you vey much for reading this post.
 
 I have a data frame, I am trying to split it into a couple of data
 frame using one of the columns, say, x. After I get the data frames, I
 am planning to treat them as matrices and trying to calculate an
 element by element mean matrix. Could anyone give me some advice how to
 do it?
 
 So far, I know that if I have a couple of matrices, say
 data1,data2,data3,data4...dataN, I can do it like this:
 
 data=array(cbind(data1,data2,data3,data4,dataN), c(2, 3, N))
 #2 refers to row number of matrix, 3 refers to column number of matrix,
 N refers to number of matrices to be averaged.
 meanmtrx=apply(data,1:2,mean)
 
 but I do not know how to use the resulting data frames with cbind().
 Maybe there are other better ways. Any advice is appreciated.
 
 Thank you very much.
 
 Have a nice day.
 
 ya
   [[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-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] How to re-project ease( Equal Area Scalable Earth) grid with a ~25 km cylindrical projection to WGS84 0.25 degree?

2013-01-19 Thread Jonsson
In fact,it is  netcdf file(even if the extension is DBL). I am new to
prjections and i just tried that spTransform,I did not know projectraster.
Could you please tell me what is the command using project raster.I wonder
if you have tried to re-project the file?



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-re-project-ease-Equal-Area-Scalable-Earth-grid-with-a-25-km-cylindrical-projection-to-WGS84-0-tp4655977p4656055.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] Need help with Wavelet transformation

2013-01-19 Thread Simonas Kecorius
Dear R users,

I am trying to perform a Wavelet transformation for time series data. I
found R package called: wavelets. But as far as I have tried - no luck.
I need to get something like that: http://www.jssm.org/combat/2/5/fig1.gif

Maybe some of you are familiar with this problem?

Thanks for your help.

p.s. I do also need FFT something like that:
http://www.aanda.org/index.php?option=com_imageformat=rawurl=/articles/aa/full_html/2009/06/aa09551-08/img36.gif

-- 
Simonas Kecorius
**

[[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] Hclust tree to Figtree w/ branch lengths

2013-01-19 Thread Julian Banchier
Hi,

This worked:

fit - hclust(d, method=ward)
library(ape)
p - (as.phylo(fit))
write.tree(p, file=MyNewick.tre)

Cheers,
J



--
View this message in context: 
http://r.789695.n4.nabble.com/Hclust-tree-to-Figtree-w-branch-lengths-tp4655990p4656057.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] Tinn-R and R problem

2013-01-19 Thread Rui Barradas

Hello,

This seems to be a Tinn-R question, to be addressed to its team, not to 
R-Help. Anyway, since you're using R 2.12.1, maybe the error goes away 
if you update your version of R.


Hope this helps,

Rui Barradas

Em 19-01-2013 04:30, Roslina Zakaria escreveu:

Dear r-users,

Actually, this is not a big problem, however it is a bit annoying.  Everytime I 
want to use Tinn-R and R. I have to do this step first before I can excute a 
set of R codes:

R-- configure -- temporarily (current session)

if not it will give this message:


.trPaths - paste(paste(Sys.getenv('APPDATA'), '\\Tinn-R\\tmp\\', sep=''), 
c('', 'search.txt', 'objects.txt', 'file.r', 'selection.r', 'block.r', 'lines.r'), 
sep=''



source('C:/Users/Owner/AppData/Roaming/Tinn-R/custom/Rconfigure_default.r')


Hope somebody can explain to me and help me to solve this problem?

R version 2.12.1 (2010-12-16)

Thank you so much for your 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-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] Tinn-R and R problem

2013-01-19 Thread Bert Gunter
Yes, Rui.

And, even more, the Tinn-R docs explain what to do and there's even a
Tinn-R menu item (R --Configure -- Permanent) that should fix the
matter.

For manual configuration of such things in R, see (in R)  ?Startup

-- Bert

On Sat, Jan 19, 2013 at 8:28 AM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 This seems to be a Tinn-R question, to be addressed to its team, not to
 R-Help. Anyway, since you're using R 2.12.1, maybe the error goes away if
 you update your version of R.

 Hope this helps,

 Rui Barradas

 Em 19-01-2013 04:30, Roslina Zakaria escreveu:

 Dear r-users,

 Actually, this is not a big problem, however it is a bit annoying.
 Everytime I want to use Tinn-R and R. I have to do this step first before I
 can excute a set of R codes:

 R-- configure -- temporarily (current session)

 if not it will give this message:

 .trPaths - paste(paste(Sys.getenv('APPDATA'), '\\Tinn-R\\tmp\\',
 sep=''), c('', 'search.txt', 'objects.txt', 'file.r', 'selection.r',
 'block.r', 'lines.r'), sep=''



 source('C:/Users/Owner/AppData/Roaming/Tinn-R/custom/Rconfigure_default.r')


 Hope somebody can explain to me and help me to solve this problem?

 R version 2.12.1 (2010-12-16)

 Thank you so much for your 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-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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] Deformulation and R

2013-01-19 Thread Lorenzo Isella

Dear All,
I hope this is not too off-topic.
Essentially, I need to know if there is any R package which can help me  
with a deformulation project.
Suppose e.g. that you know from a chemical analysis the fat, mineral,  
vitamin, energy [and so on] content of a certain food product.
You also know the ingredients of this product (e.g. milk, lactose,  
vegetable oil) and you know the chemical composition of each ingredient in  
terms of fat, minerals, vitamins etc...
At this point the question, assuming that the procedure to create the  
product from the ingredients does not alter the chemical composition of  
any ingredient, is to determine the amount of each ingredient (milk,  
lactose, vegetable oil) in the final product.

Can anyone point me in the right direction?
Many thanks

Lorenzo

__
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] Deformulation and R

2013-01-19 Thread Jeff Newmiller
Algebra 1?
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Lorenzo Isella lorenzo.ise...@gmail.com wrote:

Dear All,
I hope this is not too off-topic.
Essentially, I need to know if there is any R package which can help me
 
with a deformulation project.
Suppose e.g. that you know from a chemical analysis the fat, mineral,  
vitamin, energy [and so on] content of a certain food product.
You also know the ingredients of this product (e.g. milk, lactose,  
vegetable oil) and you know the chemical composition of each ingredient
in  
terms of fat, minerals, vitamins etc...
At this point the question, assuming that the procedure to create the  
product from the ingredients does not alter the chemical composition of
 
any ingredient, is to determine the amount of each ingredient (milk,  
lactose, vegetable oil) in the final product.
Can anyone point me in the right direction?
Many thanks

Lorenzo

__
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-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] Error in mer_finalize(ans) : Downdated X'X is not positive definite, 8.

2013-01-19 Thread Ben Bolker
Yoav Avneon Avneony at bgu.ac.il writes:

 I have conducted an experiment in order to examine predation pressure in the
 surroundings of potential wildlife road-crossing structures.  I have
 documented predation occurrence (binary…) in these structures and calculated
 several possible explanatory variables describing the spatial heterogeneity
 in several scales.  At the landscape scale I have calculated the percentage
 of different land-uses (7) in buffers around the structures with changing
 radii (100m, 250m, 500m, 1000m and 2000m).  For each radii I have generated
 a set of all possible models from the given 7 variables related to this
 radii.
 I have tried to account for random effects. A spatial random effect – the
 structure itself as a repeated measurement, by adding the term
 (1|Road_Structure).  A temporal random effect – the observation session (is
 it correct to say that this examines possible learning in time ?), by adding
 the term (1|Session.ord).   
 I have generated 4 sets for each radii: 1) with both random effects, 2+3)
 only one (each) random effect, and 4) none.
 I have tried to model the relationships using glm, glmer and lmer.
 The problem is that in the full model (all 7 variables) of some sets with
 random effects I get the following error:
 *Error in mer_finalize(ans) : Downdated X'X is not positive definite, 8.*
 
 The only record of this error I have found in the internet is for data with
 missing observation.  This doesn't comply with my data set.  I think it
 might be a singularity problem but I don't know how to check it, and as a
 result, I obviously don't know how to fix it.
 I have attached example R scripts (for the radius 2000) and the data table.
 Any help is highly appreciated !
 Thanks and all the best,

  Questions like this (and follow-ups) should probably go to
r-sig-mixed-mod...@r-project.org.

  I don't have time to dig into this in detail, but I would start
by (1) centering and scaling all of your variables (see ?scale, and
Schielzeth 2010 _Methods in Ecology and Evolution_ and (2) checking
the correlations among your variables; if they are strongly correlated
you have lots of options (none of them perfect), much discussed on
the internet, including discarding some variables or using PCA.

__
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] calculating mean matrix

2013-01-19 Thread Arunkumar Srinivasan
One way using `Reduce`: 

set.seed(45)
grp - factor(rep(letters[1:10], each=10)) # equivalent of your column x
# dummy data
df   - as.data.frame(matrix(sample(1:1000, replace=T), 
ncol=length(levels(grp
# solution
Reduce('+', split(df, grp))/length(levels(grp))


Arun


On Saturday, January 19, 2013 at 3:49 PM, ya wrote:

 Hi list,
 
 Thank you vey much for reading this post.
 
 I have a data frame, I am trying to split it into a couple of data frame 
 using one of the columns, say, x. After I get the data frames, I am planning 
 to treat them as matrices and trying to calculate an element by element mean 
 matrix. Could anyone give me some advice how to do it?
 
 So far, I know that if I have a couple of matrices, say 
 data1,data2,data3,data4...dataN, I can do it like this:
 
 data=array(cbind(data1,data2,data3,data4,dataN), c(2, 3, N))
 #2 refers to row number of matrix, 3 refers to column number of matrix, N 
 refers to number of matrices to be averaged.
 meanmtrx=apply(data,1:2,mean)
 
 but I do not know how to use the resulting data frames with cbind(). Maybe 
 there are other better ways. Any advice is appreciated.
 
 Thank you very much.
 
 Have a nice day.
 
 ya 
 [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org (mailto: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]]

__
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] Merge 2 columns into 1 column

2013-01-19 Thread qt2hot4u
Hey everyone,

I just can’t wrap my head around this problem: I got 2 Columns with 4 
columns. They basically look like this:
1 2 3 4
… … … …

I want to merge the two CSVs into a two-column list, which should look like 
this:
1  3 2  4
… …
… …

This is what I came up with so far:
files - paste(list.files(files.dir, pattern = *.csv), sep = )# Scan
mergedfiles - do.call(rbind, lapply(files, read.csv)) # Merge

Obviously this will only merge the two CSVs into a four column list. Is there 
any way to merge columns 1  3 and columns 2  4 of both files into a single 
list?

Thanks and all the best
Kenji



[[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] Is it possible to create color ramp legend in spplot for discontinuous data ?

2013-01-19 Thread Jd Devkota
Hello All,

I have a discontinuous dataset and I used spplot to plot the points.

I was wondering whether it is possible to show the legend of the plot as
color ramp. I saw that on continuous data. If anyone could tell me that
would be great.

Another thing I would like to know is how can we create the horizontal
legend. By default, the legend is vertical.

I was able to shift the legend inside the plot but not horizontal. Some of
the code I used is as follows:

##Polygon as major plot and contour as layout
## Put north icon on the map
l2 = list(SpatialPolygonsRescale, layout.north.arrow(), offset =
c(439000,3368000), scale = 4000)
l3 = list(SpatialPolygonsRescale, layout.scale.bar(), offset =
c(46,3352000), scale = 5000, fill=c(transparent,black))
l4 = list(sp.text,c(46,3351500),0)
l5 = list(sp.text,c(465000,3351500),100 m)
cuts=c(0,5,10,15,20,25,30,35,37,39,40)

p1 -
spplot(data1,sp.layout=list(list(sp.polygons,hello),l2,l3,l4,l5),axes=T,xlab=Eastings,cuts=cuts,
ylab=Northings,lwd=2,cex=1.2,col.regions = rainbow(100, start = 3/15, end
= 1))

# Legend in Spplot
names(p1$legend) - inside
p1$legend$inside$x - 0.15
p1$legend$inside$y - 0.9
plot(p1)

Thank you so much.

Janesh

[[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] calculating mean matrix

2013-01-19 Thread ya
Dear Arun and David,

Thank you very much for the response.

Arun's code works. Thank you very much.

David, I am sorry that I did not quite get the mean of your code, but still, 
thank you very much for helping.

Best regards,

ya 


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of ya
 Sent: Saturday, January 19, 2013 8:50 AM
 To: r-help
 Subject: [R] calculating mean matrix
 
 Hi list,
 
 Thank you vey much for reading this post.
 
 I have a data frame, I am trying to split it into a couple of data
 frame using one of the columns, say, x. After I get the data frames, I
 am planning to treat them as matrices and trying to calculate an
 element by element mean matrix. Could anyone give me some advice how to
 do it?
 
 So far, I know that if I have a couple of matrices, say
 data1,data2,data3,data4...dataN, I can do it like this:
 
 data=array(cbind(data1,data2,data3,data4,dataN), c(2, 3, N))
 #2 refers to row number of matrix, 3 refers to column number of matrix,
 N refers to number of matrices to be averaged.
 meanmtrx=apply(data,1:2,mean)
 
 but I do not know how to use the resulting data frames with cbind().
 Maybe there are other better ways. Any advice is appreciated.
 
 Thank you very much.
 
 Have a nice day.
 
 ya
  [[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]]

__
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] Doing mixed stock analysis with predict function using DFA

2013-01-19 Thread Melanie Zoelck
Dear R Help Mailing List Members,

I have some baseline data (attached) on which I plan to run a DFA in R to find 
out the best predictor variables that best allow discrimination between the 
different stocks. I then need to apply this DFA function to the mixed data set 
(attached), which contains all the predictor variables of the baseline data 
set, but does not contain a stock variable, as their origin is unknown and I am 
trying to classify the mixed stock fish back to their origin stock using the 
DFA function generated from the baseline data. My question is whether it is 
possible to use the predict function with the generated DFA function and 
provide the mixed data set as the newdata argument within this to generate the 
classification, even though the mixed data set does not contain the stock 
variable? 

Unfortunately, the mixstock package that has recently become available is not 
capable of dealing with continuous variables at this time, so I am unable to 
use it.

I would be grateful for any guidance you may be able to provide.

Thank you,

Melanie

Melanie Zölck (Zoelck)
PhD Candidate
Galway-Mayo Institute of Technology
Marine and Freshwater Research Centre
Commercial Fisheries Research Group
Department of Life Science
Dublin Road
Galway
Republic of Ireland
E-mail: mzoe...@hotmaill.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] dummy encoding in metafor

2013-01-19 Thread Alma Wilflinger
Hi,

I am quite new to R and in need of some advice. I am trying to conduct a meta 
regression over a some studies with about 7 mod variables which I have to dummy 
encode.

I have found the following piece of code in the manual for the metafor library:

### manual dummy coding of the allocation factor
alloc.random - ifelse(dat$alloc == random, 1, 0)
alloc.alternate - ifelse(dat$alloc == alternate, 1, 0)
alloc.systematic - ifelse(dat$alloc == systematic, 1, 0)

### test the allocation factor (in the presence of the other moderators)
### note: alternate is the reference level of the allocation factor
### note: the intercept is the first coefficient, so btt=c(2,3)
rma(yi, vi, mods=cbind(alloc.random, alloc.systematic, year, ablat), data=dat, 
method=REML, btt=c(2,3))

What I do not understand is the following: 
How does R know which columns in my data.frame are related to the dummy encoded 
variables?

It is clear that in the call of cbind I just do not use the reference variable 
as a parameter but I do not get it how R knows that alloc.random and 
alloc.systematic refer to the column alloc in the data frame.

Thank you very much in advance for your help,


kind regards, 
Alma
[[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] Cluster Analysis and PCoA (mixt variables)

2013-01-19 Thread Julien Mvdb
Hello everyone,

 I mail you because of my lake of knowlegde regarding statistics.
I'm using the CA and PCoA (but maybe should I use some other techniques) to
determine the differences and similarities between a large sample of plants
using different kind of traits through matrix of mixte variables.
I understood that the daisy() function using the gower metric and defining
the different type of variable is a good way to deal with such mixt
variable. And in fact, my plots (cluster{agnes})(more that my PCoA) are
quite reflecting what I was expecting from the aspect of those different
plants.

My problem :
The problem now is that I need to understand wich variables are considered
to produce the dissimilarity matrix that is used for the cluster analysis
or the PCoA. In other word, how are construct the branch of my Cluster
Analysis tree?

It has been one month since I tried to figured most of the things out of
what I know today in data analysis and R software world. So, I'm really
sorry for asking so simple things that do not exactly focus on the R issues
but I tried in many ways but I just can't figure it out.
Thank you

Julien Mehl Vettori

[[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] Merge 2 columns into 1 column

2013-01-19 Thread David Winsemius

On Jan 19, 2013, at 8:08 AM, qt2ho...@gmail.com wrote:

 Hey everyone,
 
 I just can’t wrap my head around this problem: I got 2 Columns with 4 columns.

OK, this is simply incoherent.


 They basically look like this:
 1 2 3 4
 … … … …
 
 I want to merge the two CSVs into a two-column list, which should look like 
 this:
 1  3 2  4
 … …
 … …
 
 This is what I came up with so far:
 files - paste(list.files(files.dir, pattern = *.csv), sep = )# Scan
 mergedfiles - do.call(rbind, lapply(files, read.csv)) # Merge
 
 Obviously this will only merge the two CSVs into a four column list.

I doubt that claim. Can you provide a reproducible example to prove me wrong?


 Is there any way to merge columns 1  3 and columns 2  4 of both files into 
 a single list?
 
 Thanks and all the best
 Kenji
 
 
 
   [[alternative HTML version deleted]]

-- 

David Winsemius
Alameda, CA, USA

__
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] a confidence interval from an ANOVA model

2013-01-19 Thread Erin Hodgess
Dear R People:
I have a data set with trt and resp:
trt resp
A 23
A 28
A 37
A 30
B 37
B 44
B 31
B 35
C 42
C 47
C 52
C 38

And I did read.table, constructed an aov object and ran the summary on
the aov object.  I also ran the TukeyHSD function.  All is well so
far.
My question is:  is there a way to put together a confidence interval
from the aov object on a particular mean, please?  It seems like there
should be.

Thanks,
Have a great night/day,
Sincerely,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] Fwd: a confidence interval from an ANOVA model solved

2013-01-19 Thread Erin Hodgess
Just use confint




-- Forwarded message --
From: Erin Hodgess erinm.hodg...@gmail.com
Date: Sat, Jan 19, 2013 at 8:11 PM
Subject: [R] a confidence interval from an ANOVA model
To: R help r-h...@stat.math.ethz.ch


Dear R People:
I have a data set with trt and resp:
trt resp
A 23
A 28
A 37
A 30
B 37
B 44
B 31
B 35
C 42
C 47
C 52
C 38

And I did read.table, constructed an aov object and ran the summary on
the aov object.  I also ran the TukeyHSD function.  All is well so
far.
My question is:  is there a way to put together a confidence interval
from the aov object on a particular mean, please?  It seems like there
should be.

Thanks,
Have a great night/day,
Sincerely,
Erin


--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] calculating mean matrix

2013-01-19 Thread arun


Hi,

This could be also done by:
#Using Arun's example:
 res- Reduce('+', split(df, grp))/length(levels(grp))
 res
 #     V1    V2    V3    V4    V5    V6    V7    V8    V9   V10
#1  417.3 792.2 504.2 506.1 513.9 480.7 545.4 564.4 473.7 486.2
#2  585.8 416.6 409.5 417.8 480.1 586.4 436.1 615.1 449.8 501.2
#3  459.3 449.1 542.0 411.6 404.6 507.6 472.0 344.0 363.2 485.1
#4  591.1 448.4 482.6 464.0 554.0 374.1 567.9 450.0 477.9 488.0
#5  433.1 438.2 441.4 596.4 356.9 461.6 356.7 457.4 434.9 510.4
6 # 425.7 498.3 452.0 489.4 302.8 538.1 270.6 418.6 564.1 545.8
#7  755.1 526.4 615.2 559.9 483.3 379.7 439.3 458.8 528.5 564.0
#8  599.7 579.4 473.2 585.1 508.3 643.7 432.1 587.2 547.6 506.2
#9  471.8 321.0 375.8 394.4 355.5 434.4 532.1 640.5 490.1 619.1
#10 356.6 434.3 403.9 445.0 416.2 532.8 570.9 548.9 697.9 488.8
library(plyr)

 res1-aaply(laply(split(df,((1:nrow(df)-1)%/% 10)+1),as.matrix),c(2,3),mean)

res1
#    X2
#X1  V1    V2    V3    V4    V5    V6    V7    V8    V9   V10
 # 1  417.3 792.2 504.2 506.1 513.9 480.7 545.4 564.4 473.7 486.2
 # 2  585.8 416.6 409.5 417.8 480.1 586.4 436.1 615.1 449.8 501.2
 # 3  459.3 449.1 542.0 411.6 404.6 507.6 472.0 344.0 363.2 485.1
 # 4  591.1 448.4 482.6 464.0 554.0 374.1 567.9 450.0 477.9 488.0
 # 5  433.1 438.2 441.4 596.4 356.9 461.6 356.7 457.4 434.9 510.4
 # 6  425.7 498.3 452.0 489.4 302.8 538.1 270.6 418.6 564.1 545.8
 # 7  755.1 526.4 615.2 559.9 483.3 379.7 439.3 458.8 528.5 564.0
  #8  599.7 579.4 473.2 585.1 508.3 643.7 432.1 587.2 547.6 506.2
  #9  471.8 321.0 375.8 394.4 355.5 434.4 532.1 640.5 490.1 619.1
  #10 356.6 434.3 403.9 445.0 416.2 532.8 570.9 548.9 697.9 488.8
A.K.



- Original Message -
From: ya xinxi...@126.com
To: r-help r-help@r-project.org
Cc: 
Sent: Saturday, January 19, 2013 9:49 AM
Subject: [R] calculating mean matrix

Hi list,

Thank you vey much for reading this post.

I have a data frame, I am trying to split it into a couple of data frame using 
one of the columns, say, x. After I get the data frames, I am planning to treat 
them as matrices and trying to calculate an element by element mean matrix. 
Could anyone give me some advice how to do it?

So far, I know that if I have a couple of matrices, say 
data1,data2,data3,data4...dataN, I can do it like this:

data=array(cbind(data1,data2,data3,data4,dataN), c(2, 3, N))
#2 refers to row number of matrix, 3 refers to column number of matrix, N 
refers to number of matrices to be averaged.
meanmtrx=apply(data,1:2,mean)

but I do not know how to use the resulting data frames with cbind(). Maybe 
there are other better ways. Any advice is appreciated.

Thank you very much.

Have a nice day.

ya 
    [[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-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] Is it possible to create color ramp legend in spplot for discontinuous data ?

2013-01-19 Thread Ista Zahn
Hi Janesh,

I'm going to ask you the same thing you were asked when you posted
this question on the r-sig-Geo list: What is data1? Please give us the
output of dput(data1), or make another example that we can reproduce.

Best,
Ista

On Sat, Jan 19, 2013 at 7:16 AM, Jd Devkota janesh.devk...@gmail.com wrote:
 Hello All,

 I have a discontinuous dataset and I used spplot to plot the points.

 I was wondering whether it is possible to show the legend of the plot as
 color ramp. I saw that on continuous data. If anyone could tell me that
 would be great.

 Another thing I would like to know is how can we create the horizontal
 legend. By default, the legend is vertical.

 I was able to shift the legend inside the plot but not horizontal. Some of
 the code I used is as follows:

 ##Polygon as major plot and contour as layout
 ## Put north icon on the map
 l2 = list(SpatialPolygonsRescale, layout.north.arrow(), offset =
 c(439000,3368000), scale = 4000)
 l3 = list(SpatialPolygonsRescale, layout.scale.bar(), offset =
 c(46,3352000), scale = 5000, fill=c(transparent,black))
 l4 = list(sp.text,c(46,3351500),0)
 l5 = list(sp.text,c(465000,3351500),100 m)
 cuts=c(0,5,10,15,20,25,30,35,37,39,40)

 p1 -
 spplot(data1,sp.layout=list(list(sp.polygons,hello),l2,l3,l4,l5),axes=T,xlab=Eastings,cuts=cuts,
 ylab=Northings,lwd=2,cex=1.2,col.regions = rainbow(100, start = 3/15, end
 = 1))

 # Legend in Spplot
 names(p1$legend) - inside
 p1$legend$inside$x - 0.15
 p1$legend$inside$y - 0.9
 plot(p1)

 Thank you so much.

 Janesh

 [[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-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] Merge 2 columns into 1 column

2013-01-19 Thread arun


HI,

Not clear what you are trying to do:

set.seed(25)
df1-as.data.frame(matrix(sample(1:40,20,replace=TRUE),ncol=4))
set.seed(15)
df2-as.data.frame(matrix(sample(1:40,20,replace=TRUE),ncol=4))
 do.call(rbind,lapply(list(df1,df2),`[`,c(2,4)))
#   V2 V4
#1  40  6
#2  26 22
#3  14 30
#4   3 20
#5  12 30
#6  40 34
#7  33 18
#8  11 39
#9  28  6
#10 34 32

do.call(rbind,lapply(list(df1,df2),`[`,c(1,3)))
#in reading from read.csv()
do.call(rbind,lapply(lapply(files,read.csv),`[`,c(1,3)))
A.K.



- Original Message -
From: qt2ho...@gmail.com qt2ho...@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Saturday, January 19, 2013 11:08 AM
Subject: [R] Merge 2 columns into 1 column

Hey everyone,

I just can’t wrap my head around this problem: I got 2 Columns with 4 columns. 
They basically look like this:
1 2 3 4
… … … …

I want to merge the two CSVs into a two-column list, which should look like 
this:
1  3 2  4
… …
… …

This is what I came up with so far:
files - paste(list.files(files.dir, pattern = *.csv), sep = )# Scan
mergedfiles - do.call(rbind, lapply(files, read.csv)) # Merge

Obviously this will only merge the two CSVs into a four column list. Is there 
any way to merge columns 1  3 and columns 2  4 of both files into a single 
list?

Thanks and all the best
Kenji



    [[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-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] Data interpolation using R from the user given data

2013-01-19 Thread Jd Devkota
I have a time series of more than 2500 points. I also have observed data
set but it is not continuous. I want to use the observed data set and find
out the modeled data from the time series data. After the modeled data has
been found out for the same time I want to plot the correlation plot and
display the equation and coefficient of correlation on the plot.

The sample time series can be found on the following link
https://www.dropbox.com/s/uxg0g1h7vbhxp3z/33010G10.csv


The observed data is as follows:

260.323 25.170
267.316 25.520
274.313 24.950
281.333 25.140
288.326 24.130
295.319 19.540
302.330 10.280
309.323 17.340
317.326 18.300
323.323 11.280
329.355 12.450
337.333 9.050
351.323 14.620
364.389 16.350
372.368 19.400
379.382 10.980
393.382 14.260
414.377 11.640
421.382 10.660
428.378 3.950
435.382 18.950
442.378 18.180
449.378 20.570
456.368 18.400
463.375 11.770
470.382 18.130
477.372 18.370
484.368 21.310
491.375 24.200
498.378 24.070
505.382 18.600
512.389 24.670
526.392 28.310
533.406 28.310
540.399 28.700
547.375 28.400
554.389 27.050

Please let me know how can I efficiently arrange the dataset so that I
could repeat this for several other locations. Thank you so much.

Best Regards,
J Dev

[[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] select rows with identical columns from a data frame

2013-01-19 Thread Sam Steingold
 * Rui Barradas ehvconeen...@fncb.cg [2013-01-18 21:02:20 +]:

 Try the following.

 complete.cases(f)  apply(f, 1, function(x) all(x == x[1]))

thanks, this works, but is horribly slow (dim(f) is 766,950x2)

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://truepeace.org http://palestinefacts.org
http://thereligionofpeace.com http://honestreporting.com http://ffii.org
usually: can't pay == don't buy. software: can't buy == don't pay

__
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] select rows with identical columns from a data frame

2013-01-19 Thread Bert Gunter
But David W. and Bill Dunlap gave you solutions that also work and are
much faster, no?!

-- Bert

On Sat, Jan 19, 2013 at 9:41 PM, Sam Steingold s...@gnu.org wrote:
 * Rui Barradas ehvconeen...@fncb.cg [2013-01-18 21:02:20 +]:

 Try the following.

 complete.cases(f)  apply(f, 1, function(x) all(x == x[1]))

 thanks, this works, but is horribly slow (dim(f) is 766,950x2)

 --
 Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 
 11.0.11103000
 http://www.childpsy.net/ http://truepeace.org http://palestinefacts.org
 http://thereligionofpeace.com http://honestreporting.com http://ffii.org
 usually: can't pay == don't buy. software: can't buy == don't pay

 __
 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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.