similar to: filling columns in frame according to another column frame

Displaying 20 results from an estimated 20000 matches similar to: "filling columns in frame according to another column frame"

2005 Mar 01
6
lattice -- panel order display
R-help, I'm using 'xyplot' in lattice package which plots length frecuencies by year (10). The order I get is not logical and the 'index.cond' argument to 'xyplot' is a bit cumbersome when it comes to plot a great deal of (in my case years). I have tried sorting the conditioning variable but still get the same result. Is there any easy way to do it without making use
2005 Jul 25
5
passing formula arguments cv.glm
I am trying to write a wrapper for the last example in help(cv.glm) that deals with leave-one-out-cross-validation (LOOCV) for a logistic model. This wrapper will be used as part of a bigger program. Here is my wrapper funtion : logistic.LOOCV.err <- function( formu=NULL, data=NULL ){ cost.fn <- function(cl, pred) mean( abs(cl-pred) > 0.5 ) glmfit <- glm(
2005 Mar 02
5
Differences between package and library terminology
Just out of curiosity, what is the difference between the terms for package and library ? Why are we loading a package with the library() command ? If this is a case of RTFM, I would be happy to do so if pointed in the right direction. I have searched the FAQ and mail archives and only came up with http://tolstoy.newcastle.edu.au/R/help/05/02/12162.html but this still does not explain what is
2008 Sep 11
9
How to load functions in R
Hello, I am trying to use self created functions in other scripts than the one where they are stored. For the moment I am using the following structure of commands to do that: 1. Load the text file with the functions in the current script: x=parse("path") 2. transform the tex in a function: f1=eval(x[1]), f2=eval(x[2]) if more than one function is stored in the text file 3. use the
2005 Jul 18
5
colnames
Hi, I have a matrix with column names starting with a character in [0-9]. After some matrix operations (e.g. copy to another matrix), R seems to add a character 'X' in front of the column name. Is this a normal default behaviour of R? Why has it got this behaviour? Can it be changed? What would be the side effect? Thank you. Regards, Gilbert [[alternative HTML version deleted]]
2002 Sep 02
1
Coplot graph size manipulation
I am currently plotting a graph with the function coplot() conditional on two factors which gives me 36 sub-panels. I have a few questions in general about changing the size of the graph. My question follows : a) I have a fair bit of text to put on the margin sides using mtext(). What is the best way to shrink the whole graph to say 80 - 90% so that I can include a bit more words. b) Since I am
2005 Nov 09
5
How to find statistics like that.
Hi there, Suppose mu is constant, and error is normally distributed with mean 0 and fixed variance s. I need to find a statistics that: Y_i = mu + beta1* I1_i beta2*I2_i + beta3*I1_i*I2_i + +error, where I_i is 1 Y_i is from group A, and 0 if Y_i is from group B. It is large when beta1=beta2=0 It is small when beta1 and/or beta2 is not equal to 0 How can I find it by R? Thank you very much
2010 Apr 05
2
changing column names in a dataframe
Hi folks, I have imported data from an Excel spreadsheet. Columns in that spreadsheet are named "name", "x", and "y", and several sets of those columns appear in the worksheet. For example: name x y name x y test1 1 3 test2 4 4 test1 2 2 test2 5 5 test1 3 1 test2 6 6 When I import these data into R, into a dataframe, I end up with something like this:
2005 Nov 06
3
How can I assign an argument to transfer whether by ref or by value?
Hello guys, I am wondering the default way of transferring arguments in R. Is it by value or by ref in default case, or could that be changed explicitly? Cheers, Xiaofan --- Xiaofan Li Department of Applied Mathematics and Theoretical Physics University of Cambridge
2003 Mar 17
4
X11 connection error in web cgi mode only
Dear all, I am trying to create a web interface using Perl-CGI to call R plots and to display them. The following codes works perfectly fine when I copy and paste into the console directly or if I save it into script.file and then R --no-save < script.file producing the graphs. jpeg("graph.jpeg", width=400, height=400) plot(rnorm(100)) dev.off() Now, I put the line system("R
2007 Jul 24
7
Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.
Hi all, If the question below as been answered before I apologize for the posting. I would like to get the frequencies of occurrence of all values in a given variable in a multivariate dataset. In short for each variable (or field) a summary of values contained with in a value:frequency pair, there can be many such pairs for a given variable. I would like to do the same for several such variables.
2012 Jun 01
2
how to add a 'label' column
Hello R users, I'd like to ask a question about how to add a new column. So, below is my situation. In order to perform the repeated ANOVA, I first imported the following table. score=read.csv("patients_tests.csv"); subject test1 test2 test3 test4 test5 test6 test7 1 ab 0.17687 0.16715 0.17009 0.16480 0.16116 0.24502 0.17975 2 cl
2004 Oct 01
3
same test statistic for t-test with and without equal variance assumption
Could some kindly tell me if I am supposed to be getting the same test statistic value with var.equal=TRUE and var.equal=FALSE in t.test ? set.seed(1066) x1 <- rnorm(50) x2 <- rnorm(50) t.test(x1, x2, var.equal=FALSE)$statistic # 0.5989774 t.test(x1, x2, var.equal=TRUE)$statistic # 0.5989774 ??? Here are my own calculations that shows that perhaps the result when var.equal=TRUE is
2003 Jun 07
3
Error Compiling e1071
Dear all, I am trying to compile the package e1071 (version 1.3-11) with R CMD INSTALL. I tried with R 1.7.0 on Redhat Linux 2.4.7-10 and R 1.6.2 on Linux 2.4.9-34smp but keep getting the same error message during configure : WARNING: g++ 2.96 cannot reliably be used with this package. Please use a different compiler. Can anyone help me with this or at least point me in the right direction ?
2005 Feb 25
2
display full form in args
Forgive me for I do not fully comprehend the idea of classes and methods but I was wondering if someone could help explain why the function args () behaves the way it does. Why does args(cut) show the simplified version instead of the more complete one as in help("cut"). This is true for few other functions (e.g. plot, rep). > args(cut) function (x, ...) Sometime I can get
2008 Feb 12
6
Matching Problem
Hi I have this vector of strings. MyData <- c("Test1","Test2","I(Test1^2)","I(Test2^3)","I(Test1.Test2^2)") where I want to extract only the text after "I(" and before "^" so that the string returned only contain c("Test1","Test2","Test1.Test2") I am not very skilled in the use of matching
2005 Jan 26
3
Still avoiding loops
Dear all, I have a matrix X with 47 lines and say 500 columns - values are in {0,1}. I'd like to compare lines. For that, I first did: for (i in 1:(dim(X)[1]-1)) for (j in (i+1):dim(X)[1]) { Y <- X[i,]+Y[j,] etc. but, since it takes a long time, I would prefer avoding loops; for that, my first idea was to add this matrix: X1=X[,rep(1:46,46:1)] to this one: res=NULL for (i in
2004 Mar 11
3
making operators act on rows of a data frame
Dear R helpers, I wish to use the "sum" operator for each row of a data frame. However, it appears that the operator acts on the entire data frame, over all columns. What is the best way to obtain row- wise operation? The following code shows my attempts so far, and their problems:- test1=array(rbinom(120,1,0.5),c(20,3)) test1[,3]=NA sum(test1[,1:2]) test1[,3][sum(test1[,1:2])>=2]=1
2003 Jul 17
3
duplicate row.names
I am looping over many data files and reading in the data with F <- read.table(filename) to read in a 22000 by 15 matrix. Works fine on the first matrix F, but I get the following error when the second file is read into F: Error in "row.names<-.data.frame"(*tmp*, value = row.names) : duplicate row.names are not allowed I have tried picking a column of the matrix and
2012 Dec 20
5
an entry level (stupid) question
Hello all, i'm a newbie to R and now I get stuck by the question, would anybody help me please? Suppose, I got the following > test <- data.frame(test1=c(c(0.00, 0.005, 0.01, 0.015, 0.02))) > test test1 1 0.000 2 0.005 3 0.010 4 0.015 5 0.020 Now I want another column inside test, named test2 for i=c(1:5), If test$test1[i] is 0, then the value of test$test2[i] is 1/test1[i] or