Displaying 20 results from an estimated 90000 matches similar to: "Directive for first and last array arguments"
2010 Oct 27
2
keep adding elements to the matrix
Hello everyone,
I would like to create a "dynamic" array to keep storing number in it
for (i in c(2:length(final))){
myarray <-final[i]-final[i-1]
myarray2<-2*final[i]
}
At the end I would like to use myarray as the x values of an array
and the myarray2 as the yvalues of the same array.
I tried cbind but it didnot work.
Could you please help me with that?
Best
2010 Nov 18
3
Sample covariance matrix in R
Hello everyone.
I would like to find the sample covariance matrix using R.
So far I read on the wikipedia what a sample_covariance is
http://en.wikipedia.org/wiki/Sample_covariance
according to wikipedia one vector is enough to calculate the sample covariance matrix.
In R I tried cov(myvector) and I get the reply that I need to pass either two argument or one matrix with x,y values .
How can I
2013 Oct 25
1
add a color band
Hi all,
I would like to ask your help to add a color band (Ι am not sure regarding the right term, this color band at the right of the plot "describing" values with their corresponding color.
For now I have only this code
test<-matrix(data=runif(10000),nrow=100)
plot(test,axes="FALSE")
axis(1,at=c(0,1),labels=c("a","b")) #
but I would like to add
2010 Nov 17
2
How to catch warnings
Hello when my code executes I receive the message that were some warnings. I want to catch warning messages at run time so to print some local variables and try to understand why this warning happens.
I searched on internet and I tried withCallingHandlers(
which seems to work but as I used Rkward the result is awful. I get a prompt to copy paste a value only while at the same time my background
2010 Oct 26
5
Zoom in in a plot
in a simple plot. When i do plot is it possible to zoom in or out or this is not
possible at all?
Best Regards
Alex
[[alternative HTML version deleted]]
2010 Sep 09
2
See what is inside a matrix
Hello everyone.. Is there any graphical tool to help me see what is inside a
matrix? I have 100x100 dimensions matrix and as you already know as it does not
fit on my screen R splits it into pieces.
I would like to thank you in advance for your help
Best Regards
Alex
[[alternative HTML version deleted]]
2012 Aug 17
5
specific matrix element tranformation
Hi guys,
I am trying to write a function that allows me to perform specific
transformations to each element of
a 2 by 2 matrix to generate a 3 by 3 matrix.
Input into function-2 by 2 matrix
Output from function -3 by 3 matrix
For example:
# a is my original 2 by 2 matrix
#b is my new 3 by 3 matrix
set.seed(2)
a=matrix(rnorm(4),ncol=2)
#let's say these are the transformations i wish to
2010 Oct 30
2
transforming a dataset for association analysis
Hi
I would like to transform a data frame like
Subject Item Score
Subject 1 Item 1 1
Subject 1 Item 2 0
Subject 1 Item 3 1
Subject 2 Item 1 1
Subject 2 Item 2 1
Subject 2 Item 3 0
....
*to *
Subject Item1 Item2 Item3 .....Item N
Subject1 1 0 1
Subject2 1 1 0
........
SubjectP..
Apologize for the simple nature of my query but I am stuck.
2013 Feb 14
2
Plot a Matrix as an Image with ggplot
Dear all,
I am trying to plot a matrix I have? as an image
str(matrixToPlot)
?num [1:21, 1:66] 0 0 0 0 0 0 0 0 0 0 .
?that contains only 0s and 1s,
where the xlabel will be Labeled as
str(xLabel)
?num [1:66] 1e+09 1e+09 1e+09 1e+09 1e+09 ...
and the yLabels will be labeled as
str(yLabel)
?num [1:21] -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 ...
I have found on the internet that I can do
2011 Jan 25
1
Learn Vectorization (Vectorize)
Greetings Friends,
I would be grateful if you can help me undestand how to make my R code more efficiently.
I have read in R intoductory tutorial that a for loop is not used so ofter (and is not maybe not that efficient) compared to other languages.
So I am trying to build understanding how to get the equivalent of a for loop using more R-oriented thinking.
If I got it right one way to do that
2010 Nov 20
2
Merge two ggplots
Hello everyone.
I am using ggplot and I need some help to merge these two plots into one.
plot_CR<-function(x,y,agentid,CRagent){
library(ggplot2)
agent<-CRagent[[agentid]] # To make following expression shorter
ggplot((data.frame(x=CRX,y=CRY,sr=agent$sr)))+
geom_point(aes(x,y,colour=cut(sr,c(0,-10,-20,-30,-40,-50,-60,-70,-80))))+
geom_text(aes(x,y,color=cut(sr,
2010 Sep 17
4
count frequency
Hello everyone,
please consider the following lines of a matrix
[574,] 59 32
[575,] 59 32
[576,] 59 32
[577,] 59 32
[578,] 59 32
[579,] 59 32
[580,] 59 32
[581,] 60 32
[582,] 60 33
[583,] 60 33
[584,] 60 33
[585,] 60 33
[586,] 60 33
[587,] 60 33
[588,] 60 33
[589,] 60 33
[590,] 60 33
[591,] 61 33
[592,] 61 33
[593,] 61
2010 Nov 01
2
transforming a dataset for association analysis RESHAPE2
I get the following message when using the reshape2 package line
> tDat.m<- melt(Dataset)
Using Item, Subject as id variables
> tDatCast<- acast(tDat.m,Subject~Item)
Aggregation function missing: defaulting to length
Note Problem Statement-
convert dataframe
Subject Item Score
1 Subject 1 Item 1 1
2 Subject 1 Item 2 0
3 Subject 1 Item 3 1
4 Subject 2 Item 1 1
5
2011 Nov 08
1
How to handle empty arguments
Dear all,
I am having a data stucture that contains Products and Time Stamps,
I have made also two lists
ProductList=list(c('Example1','Example2'...)
TimeStamp=list(c("1990-02-03 12:57:60"),c("1990-02-03 12:57:60"),
then I have made few functions that call each other
do_analysis_for_all the data<-function(arguments){
.....
2012 Feb 04
1
Making a point-sampling matrix
Dear all,
I would like to create a k,n matrix which that will include
- k random elements with value 1
-all rest zeros
-one single "1" in each row
- each column will have maximum one "1"
so far I have a so stupid function that with nested while tries to fit k numbers randomly in a row by row fashion, checking also if the c column rule is violated. In that case there is
2011 Oct 30
3
why the a[-indx] does not work?
Dear all,
Could you please explain me why
> OverloadsTesT
[1] 1 0 1 0 0 0 0 0 0 0
> a<-matrix(data=seq(1,10),nrow=10)
> a
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
[8,] 8
[9,] 9
[10,] 10
> a[-OverloadsTesT]
[1] 2 3 4 5 6 7 8 9 10
the last line does not remove the first and third element and only does the first element.?
What I
2010 Jul 28
2
Beginner stucked with raster + geoR package.
Hello everyone.
I am trying to build up understanding in R by trying to develop just some simple
scenarios.
I would like to explain you what I am trying to do and what I did so far.
I would like to put inside a RasterLayer (raster package) a Gaussian field (for
given covariance) using grf function (geoR package)
1. First I created a Raster Layer object
r <- raster() # Default values are
2016 Jun 10
1
When is PATH directive used?
Ady asked:
> Have you read the "See also" section(s) of the wiki page(s)?
Yes.
> By reading the relevant wiki pages, a user should (_hopefully_) get to
> the conclusion that the PATH directive is relevant for c32 modules, and
> not a replacement for the CONFIG / INCLUDE directives nor for relative
> paths based on the "Working Directory".
There's nothing
2012 Mar 03
4
Sliding a Window in R
Dear all,
I am having a vector of around 300.000 elements and I Want to slide fast a window from the first element until the last-Windowsize
what I have so far is the following for statement:
for (i in 1:(length(data[,1]) - windowSize)) {
out[i] <- mean(data[i:(i + windowSize - 1), ])
elements[i]<-length(i:(i + windowSize - 1))
}
but this of course takes ages to
2011 Oct 09
2
Substract "previous" element
Dear all,
I have a matrix with data and I want to substract from every value the previous element.
Let's assume that my vector(matrix) is c<-(1,2,3,4,5)
I want to get remove_previous c<-(0,1,2,3,4).
How I can do that efficiently in R?
I would like to thank you in advance for your help
B.R
Alex
[[alternative HTML version deleted]]