Displaying 20 results from an estimated 40000 matches similar to: "apply on rows and columns?"
2009 Apr 03
4
embed?
I have a question on the function 'embed'. I ran the example
x <- 1:10
embed(x, dimension=3)
This gives the output:
[,1] [,2] [,3]
[1,] 3 2 1
[2,] 4 3 2
[3,] 5 4 3
[4,] 6 5 4
[5,] 7 6 5
[6,] 8 7 6
[7,] 9 8 7
[8,] 10 9 8
I don't quite understand the output and why it is useful. First, there are only 8
2010 Mar 22
2
Factors attribute?
I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]
2011 Nov 10
3
Title for a group of plots?
I can get multiple plots on a page like:
op <- par(mfcol = c(3, 1))
What I was wondering is if there is a way to have a title for the whole
page? I can specify the title for each individual plot like:
plot(xxx, main=".")
But I would like a 'title' for the group of plots. Is this possible?
Thank you.
Kevin
[[alternative HTML version deleted]]
2004 Aug 20
3
Loss of rownames and colnames
Hi,
I am working on some microarray data, and have some problems with
writing iterations.
In essence, the problem is that objects with three dimensions don't
have rownames and colnames. These colnames and rownames would
otherwise still be there in 2 dimensional objects.
I need to generate multiple iterations of a 2 means-clustering
algorithm, and these objects thus probably need 3
2008 Oct 10
2
Leap year?
Given a Date object or simply a year is there an R function to tell me if the it is a leap year or not? I was hoping for something like 'is.leapyear'. I probably can build my own function (year divisible by 4 etc.) but I would rather use an existing function if it is available.
Thank you.
Kevin
2008 Aug 28
6
Function not returning a vector?
Why does:
(shape/scale) * (1:365/scale)^(shape - 1)
return a vector of numbers but calling a function
hasard(1:365,shape,scale)
defined like:
hazard <- function(x,shape,scale)
{
return (shape/scale) * (x/scale)^(shape - 1)
}
Only return a single value? It is like x becomes a single value passed as an argument.
Thank you.
Kevin
2009 Jan 15
1
Warning on assignment.
I have a question on whether a warning message is valid or if I just don't understand the process. Let me illustrate via some R code:
x <- 1:20
i <- x %% 2 > 0
y <- rep(1,20)
x[i] <- y
Warning message:
In x[i] <- y :
number of items to replace is not a multiple of replacement length
But it still does what I would expect for the assignment:
> x
[1] 1 2 1 4 1 6
2009 Jan 03
5
Power functions?
I had a question about the basic power functions in R.
For example from the R console I enter:
-1 ^ 2
[1] -1
but also
-1^3
[1] -1
-0.1^2
[1] -0.01
Normally pow(-1, 2) return either -Infinity or NaN. Has R taken over the math functions? If so I would think that -1^2 is 1 not -1 and -0.1^2 is 0.01 not -0.01.
Thank you.
Kevin
2007 Jul 31
1
Naming rows/columns in a 3 dimensional array/dataframe
Can I assign names to rows/columns in a i x k x j matrix / dataframe?
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or
2011 Nov 15
1
Plot alignment with mtext
I would like the text plotted with 'mtext' to be alighned like it is for
printing on the console. Here is what I have:
> print(emt)
ME RMSE MAE
MPE MAPE MASE
original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554 37.47713
1.5100050
xreg 1.561235e+01 2.008599e+03 9.089473e+02 267.05490 280.66734
2011 Nov 07
3
Upgrade R?
I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the
libraries from the 'library' directory in my existing installation (2.13.1)
to the installed R 2.14. Now I want to uninstall the old installation (R
2.13.1) and I get the error:
Internal Error: Cannot find utCompiledCode record for this version of the
uninstaller.
Any ideas?
Kevin
[[alternative HTML
2009 Oct 28
5
PDF Corrupted?
I am running R 2.9.2 and creating a PDF that I am trying to open with Adobe Reader 9.2 but when I try to open it the reader responds with
"There was an error opening this document. The file is damaged and cannot be repaired.:
I am using the R command(s):
pdf(file="cat.pdf", title="Historical Sales By Category")
for(j in 1:length(master))
{
d <-
2017 Jun 01
2
subletting an array according to dimnames
Hi all,
I have a three dimensional array with the corresponding dimension names.
I would like to subset the array according to the dimension names. For
example,
suppose I want to extract the values corresponding to A=20, B=10, C=0. I
know I
can do:
P2[dimnames(P2)$A==20, dimnames(P2)$B==10, dimnames(P2)$C==0]
But is there a better way for doing this? Thanks for your help!
Hanna
>
2011 Jan 31
4
Select rows with distinct values in a column and other conditions
My data frame looks like:
SightingID PA1 PA2 PlotID InOverlap Area1 2001 1 -99 392 Y 0.22 2002 1 -99 388 Y 0.253 2008 1 NA 104 N 0.344 2010 1 NA 71 N 0.185 2012 1 NA 61 N 0.166 2013 1 NA 61 N 0.227 2014 1 NA 62
2008 Aug 03
2
Determining model parameters
This may be a begining question. If so, please bear with me.
If I have some data that based on the historgram and other plots it "looks" like a beta distribution. Is there a function or functions within R to help me determine the model parameters for such a distirbution? Similarily for other "common" distirbutions, Poisson(lambda), Chi-Square(degrees of freedom, chi-square
2010 Jan 03
3
F77_CALL, F77_NAME definition
I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for:
F77_CALL(dpotri)
?
Thank you.
Kevin
2008 Jul 15
4
Iterations
I have a command that reads in some data:
x <- read.csv("Sales2007.dat", header=TRUE)
Then I try to organize the data:
sc <- split(x, list(x$Category, x$SubCategory), drop=TRUE)
Then I want to iterate through the data. I was able to get the following to run on the R console:
for(i in 1:length(sc))
{
sum(sc[[i]]$Quantity)
}
But notiing is primted on the console. I find
2009 Mar 26
1
Bug? FORTTRAN help
I was feeling masochistic the other day and we have been having some wierd memory problems so I started digging into the source for L-BFGS-B. In the lbgfsb.c file I see the following code:
/* Cholesky factorization of (2,2) block of wn. */
F77_CALL(dpofa)(&wn[*col + 1 + (*col + 1) * wn_dim1], &m2, col, info);
if (*info != 0) {
*info = -2;
return;
}
If I am not mistaken
2009 Oct 27
3
Non-normal residuals.
Hello,
I asked a question about what the most likely process to follow if after a time-series fit is performed the residuals are found to be non-normal. One peron responded and offered to help if I supplied a sample data set. Unfortunately now that I have a sample I have lost the emai addressl. If you are that person or have some ideas please email me back at rkevinburton at charter.net.
Thank