similar to: how to use a function in aggregate which accepts matrix and outputs matrix?

Displaying 20 results from an estimated 200 matches similar to: "how to use a function in aggregate which accepts matrix and outputs matrix?"

2007 Dec 29
0
how to run my R code in Mac OS X 10.5 Leopard
Hi, I have a question in running R 2.4.1 in the Mac OS X 10.5 Leopard. I write all my R code without using any packages in R. When I run it in Windows system, it runs smoothly and correctly. Then I try to run the same code in Mac OS X 10.5 Leopard. I just copy the script file on the desktop of the Mac OS X. I find I can open the file directly as a text file. To run R in Mac OS X, I type
2008 Jun 28
1
How to estimate the parameters in a bivariate weibull distribution?
Hi,Dear all R experts, As far as I know, fitdistr() is only to estimate the parameters in univariate distributions. I have a set of data (x,y) and I assume it follows a bivariate weibull distribution. Could someone tell me a function in R that is suitable for parameter estimation in multivariate cases? Thanks in advance! Cheers, YAN
2011 Jun 01
2
interpolation and extremum location of a surface‏
Hello, I have a x,y,z file.Z is not corresponding to a simple analytical function of x and y (see below). I am trying to find the minimum location of this surface and the z value corresponding to this location by a spline interpolation or from a polynomial fit. I tried with the akima package but as the location of the point I am looking for (the minimum) is outside of the convex hull it's
2008 Mar 07
4
locate the rows in a dataframe with some criteria
Hi, netters, This is probably a rookie question but I couldn't find the answer after hours of searching and trying. Suppose there'a a dataframe M: x y 10 A 13 B 8 A 11 A I want to locate the rows where x >=10 and y="A". I know how to do it to vectors by using which, but how to do it with the dataframe? Thank you very much! Zhihua Li
2008 Jan 26
3
An R clause to bind dataframes under certain contions
Hi netters, Suppose I have two data frames X and Y. X has three colnames A, B and C. Y has three colnames A,B and D. I want to combine them into one matrix, joining the rows having the same A and B values (X$A==Y$A and X$B = Y$B). So the resulting dataframe has four variables/columns: A,B,C and D. I was wondering what's the best way to do it in R. Could anyone give me some advice? Thanks!
2007 Jul 19
3
Error: evaluation nested too deeply when doing heatmap with binary distfunction
Hi netters, I have a matrix X of the size (1000,100). The values are from -3 to +3. When I tried heatmap(X, distfun=function(c),dist(c,method="bin"),hclustfun=function(m),hclust(m,method="average")) I got the error message: Error: evaluation nested too deeply: infinite recursion / options(expressions=)? However, if I used default parameters for distfunction:
2005 Dec 12
2
store and retrieve object names in a vector
hi netters, suppose i have a series of objects X1, X2, B1,C1........... they all have the same dimensions. i want to combine into one by using cbind: y<-cbind(X1,X2,B1,C1.....) but i don't want to type the names of these objects one by one. instead, i've put their names into a vector: x<-c("X1","X2","B1","C1",....) i used y<-cbind(x).
2005 Jun 23
2
quotient and remainder
hi netters Is there a function in R that can compute the quotient and remainder of a division calculation? such that when 11 is given as the dividend and 5 the divider, the function returns 2(quotient) and 1(remainder). Thanks a lot! _________________________________________________________________ 伱佲伔佈佅伮佋佖 MSN Explorer: http://explorer.msn.com/lccn/
2005 Dec 03
2
how to subset rows using regular expression patterns
hi netters, i have a dataframe A with several columns(variables). the elements of column M are character strings. so A$M=c("ab","abc","bcd","ac","abcd","fg",....."fl"). i wanna extract all the rows where A$M match some regular expression pattern. for a simple example, let the pattern be just "ab", i wanna subset
2005 Dec 08
2
how to change a dataframe with characters to a numeric matrix?
hi netters, i have a dataframe TEST like this: Y1 Y2 Y3 X1 4 7 8 X2 6 2 Z X3 8 0 1 i would like to change it to a numeric matrix, replacing "Z" with NA Y1 Y2 Y3 X1 4 7 8 X2 6 2 NA X3 8 0 1 i've tried the function data.matrix but it didn't work. is there any easy way to do this? thanks a lot!
2005 May 30
3
how to "singlify" entries
hi netters I have a rather simple question. I have a data frame with two variables X and Y, both of which are factors. X has 100 levels while Y has 10 levels only. The data frame has 100 rows in all, so for X the values are unique, and Y has many replicate values. Now I wanna reduce the data frame into 10 rows only, according to the 10 levels of Y. I don't care which value of X is in
2005 Jul 12
2
how to generate argument from a vector automatically
hi netters i have a vector NAMES containing a series of variable names: NAMES=c(x,r,z,m,st,qr,.....nn). i wanna fit a regression tree by using the code: my.tree<-tree(y~x+r+z+m+....nn,my.dataframe) but i don't want to type out "x+r+z+m+....+nn" one by one, as there are so many variables. besides, sometimes i wanna put the code in a function. so i need to have the
2007 Jul 02
2
working with R graphics remotely
Hi netters, Now I'm connecting from my local windows machine to a remote linux machine and launch R out there using SSH. When I tried to create grahics, like using plot or heatmap, I cannot see the output. Maybe a new R window displaying the graphics has popped out in the remote machine? Or I need to change some settings for the graphics to display? I don't know. I googled it and
2008 Jan 26
3
Comparison of aggregate in R and group by in mysql
Hi, netters, First of all, thanks a lot for all the prompt replies to my earlier question about "merging" data frames in R. Actually that's an equivalence to the "join" clause in mysql. Now I have another question. Suppose I have a data frame X with lots of columns/variables: Name, Age,Group, Type, Salary. I wanna do a subtotal of salaries: aggregate(X$Salary,
2005 Aug 26
2
learning decision trees with one's own scoring functins
Hi netters, I want to learn a decision tree from a series of instances (learning data). The packages tree or rpart can do this quite well, but the scoring functions (splitting criteria) are fixed in these packages, like gini or something. However, I'm going to use another scoring function. At first I wanna modify the R code of tree or rpart and put my own scoring function in. But it
2005 Jun 21
2
how to count "associated" factors?
hi netters Suppose I have a factor X, with 10 elements and 3 levels: A B B C A C B A C C . It is easy to count the number of elements for each level: tapply(X,X,length). Now I have another factor Y, which formed a matrix with X: X| A B B C A C B A C C Y| B B C C C A A A B B I wanna count the number of elements for each of these conditions: when X=A and Y=A; when X=A and Y=B; when X=A and
2007 Jul 18
2
memory error with 64-bit R in linux
Hi netters, I'm using the 64-bit R-2.5.0 on a x86-64 cpu, with an RAM of 2 GB. The operating system is SUSE 10. The system information is: -uname -a Linux someone 2.6.13-15.15-smp #1 SMP Mon Feb 26 14:11:33 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux I used heatmap to process a matrix of the dim [16000,100]. After 3 hours of desperating waiting, R told me: cannot allocate vector of size
2007 Dec 11
1
Using predict()?
I'm trying to solve a homework problem using R. The problem gives a list of cricket chirps per second and corresponding temperature, and asks to give the equation for the linear model and then predict the temperature to produce 18 chirps per second. So far, I have: > # Homework 11.2.1 and 11.3.3 > chirps <- scan() 1: 20 2: 16 3: 19.8 4: 18.4 5: 17.1 6: 15.5 7: 14.7 8: 17.1 9: 15.4
2005 Mar 24
1
(no subject)
hi netters: I have a series of discrete variables which form a network and I want to learn the network structure from some training data. I could have used packages like deal but there are two problems. First of all, I have 10000 variables. So the possible network structure is awfully huge, I don't know how long it will take my PC to find the highest-scoring network..........maybe a
2005 Oct 26
1
a silly question on index of a matrix
Hi netters, This is probably a silly question,but I can't find the answer after searching the R-help archives online. ok, I have a matrix. I know there is a "10" somewhere in it. Now I want to know the index of the element "10" in this matrix. That is, if X[i,j]=10, I want to know i and j. Is there a R function to do this? Just like the "find" function in