search for: new1

Displaying 20 results from an estimated 48 matches for "new1".

Did you mean: new
2007 Oct 12
1
use 'lapply' to creat 2 new columns based on old ones in a data frame
There is a dataset 'm', which has 3 columns: 'index', 'old1' and 'old2'; I want to create 2 new columns: 'new1' and 'new2' on this condition: if 'index'==i, then 'new1'='old1'+add[i]. 'add' is a vector of numbers to be added to old columns, e.g. add=c(10,20,30 ...) Like this: index old1 old2 new1 new2 1 5 6 15...
2010 Jun 01
1
loop
Can any one help it will be very kind, loop statements I have this table and some more records, I want to reshape it V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 TP53 Dis1 Dis2 Dis3 Dis4 Dis5 Dis6 DCI New1 New2 New3 New4 FDI Hi2 H3 H4 GHD I1 I3 I4 I5 I6 I7 I8 I want my new table or matrix to be some thing like this V1 V2 V3 Tp53 Dis1 Dis2 Tp53 Dis1 Dis3 Tp53 Dis1 Dis4 Tp53 Dis1 Dis5 Tp53 Dis1 Dis6 Tp53 Dis2 Dis3 Tp53 Dis2 Dis4 Tp53 Dis2 Dis5 Tp53 Dis2 Dis6 Tp53 Dis3 Dis4 Tp53 Dis3 Dis5 Tp53 Dis3 Di...
2011 Sep 23
4
replace multiple string
Hi I would like to use a bash script that searches files and subdirectories name in a directory /var/ww/html/web for a specific string, and when it finds the search string, replaces the string (old1) with new string (new1), and so on old2 with new2 ....oldn with newn. replace_string.sh #!/bin/bash for db in $(find /var/www/html/web -name * -exec) do sed -e "s/old1/new1/" \ sed -e "s/old2/new2/" \ ... sed -e "s/oldn/newn/" $db done Any recommendation.. Thanks pons
2011 Feb 07
1
Seeking help to define s4 method for 'print'
...sentation(x1 = "numeric", x2 = "numeric", y1 = "character")) [1] "Me" > setMethod("print", "Me", definition=function(x) { + cat("Values of x1 & x2 are:", c(x@x1, x@x2), "\n") + }) [1] "print" > new1 = new("Me", x1=rnorm(2), x2=rt(2, 1), y1="normal") > print(new1) Values of x1 & x2 are: -2.139669 -0.2102133 -0.6293572 -26.96205 However what I wanted to have that, user should have some option to print the underlying object with as much accuracy as he wants, in te...
2008 Jun 10
2
convert characters into integers in a matrix
...I will appreciate any suggestion for this simple problem. I have a matrix of characters "A", "P", "M". I want to convert those characters to integers 0,1, 1 respectively. I am using the following R statements: exprs.new<-gsub("P",1,exprs) exprs.new1 <- gsub("A",0,exprs.new) exprs.new2 <- gsub("M",1,exprs.new1) The replaced integers are stored as characters and I cannot find a way to convert the matrix to an integer matrix. Thanks manisha [[alternative HTML version deleted]]
2001 Apr 09
5
predict problem
...2.1 (2001-01-15) Dear friends. How comes this works and produce a single prediction: x <- rnorm(15) y <- x + rnorm(15) predict(lm(y ~ x)) new <- data.frame(x = seq(-3, 3, 0.5)) predict(lm(y ~ x), new, se.fit = TRUE) pred.w.plim <- predict(lm(y ~ x), new, interval="confidence") new1 <- data.frame(x=3) predict(lm(y ~ x), new1, interval="confidence") while this refuses to take the "new" and predict ? lot <- c(30,20,60,80,40,50,60,30,70,60) hours <- c(73,50,128,170,87,108,135,69,148,132) z1 <- lm(hours~lot) new <- data.frame(x=80) predict(z1,ne...
2003 Jun 06
0
Problems building RELENG_4_8
...pe -fexceptions -DIN_GCC -D_PTHREADS -DGTHREAD_USE_WEAK -I/usr/src/gnu/lib/libgcc/../../../contrib/gcc/config -I/usr/src/gnu/lib/libgcc/../../../contrib/gcc -I. -I/usr/src/gnu/lib/libgcc/../../../contrib/gcc/cp/inc -nostdinc++ -DL_op_new -o _op_new.o /usr/src/gnu/lib/libgcc/../../../contrib/gcc/cp/new1.cc /usr/src/gnu/lib/libgcc/../../../contrib/gcc/cp/new1.cc: In function `void * operator new(unsigned int)': /usr/src/gnu/lib/libgcc/../../../contrib/gcc/cp/new1.cc:88: Internal compiler error. /usr/src/gnu/lib/libgcc/../../../contrib/gcc/cp/new1.cc:88: Please submit a full bug report. /usr/src...
2012 Aug 02
3
text search in r
I am trying to count the number of times that the characters in a string change For example- new=c(AAAABBBBBABBBABB) I want to find the number of times that B changes to A and the number of times that A changes to B. I tried the grep command but I only figured out the positions of when B changes to A when I only need the number of times it occurs. -- View this message in context:
2017 Dec 20
1
utils::unzip ignores overwrite argument, effectively
...ile()) setwd(tmp) cat("old1\n", file = "file1") cat("old2\n", file = "file2") utils::zip("files.zip", c("file1", "file2")) #> adding: file1 (stored 0%) #> adding: file2 (stored 0%) unlink("file2") cat("new1\n", file = "file1") readLines("file1") #> [1] "new1" utils::unzip("files.zip", overwrite = FALSE) #> Warning message: #> In utils::unzip("files.zip", overwrite = FALSE) : #> not overwriting file './file1 readLines("fil...
2010 Apr 14
1
Problem trying to plot Vennerable object
...rary from Rforge, this required an upgrade of R to 2.10.0 by the 'pylr' dependency. However, a very simple command fails: Vcomb <- Venn(SetNames= c("EOCT", "EOCM"), Weight=c(0, 11841, 24084, 24660)) plot(Vcomb) with this error: Error in do.call(c, lapply(.faceNames(new1), .faceEdgeNames, drawing = new1)) : 'what' must be a character string or a function What's frustrating is that a colleague with different versions of R (2.8.x) and some of the libraries gets the above function to work fine. I have no idea how to debug this error. Any help would...
2008 May 15
2
How to remove autocorrelation from a time series?
...knows how to remove auto-correlation from a frequencies time series? I've tried by differencing (lag 1) the cumulative series (in order to have only positive numbers) , but I can't remove all auto-correlation. If it's useful I can send my db. x <- # autocorrelated series new1<-cumsum(x) new2<-diff(new1,lag=1,differences = 1) acf(new2) # remains autocorrelated Thanks in advance Ciao Claudia ___________________________________ Scopri i http://www.ymailblogit.com/blog/
2012 Feb 09
2
fill an array by rows
I've dug around but not been able to find anything, am probably missing something obvious. How can I fill a three-dimensional (or higher dimension) array by rows instead of columns. eg new1 <- array(c(1:125), c(5,5,5)) works fine for me but fills it by columns and new2 <- array(c(1:125), c(5,5,5), byrow=TRUE) throws an error. Am I missing something obvious? I also tried transposing the 3-d array but that didn't work either. TIA Jim -- Dr. Jim Maas University of Eas...
2012 Sep 18
2
Formula in a data-frame
Hello all, I'm new in R, and I have a data-frame like this (dput information below): Specie Fooditem Occurrence Volume 1 Schizodon vegetal 1 0.05 2 Schizodon sediment 1 0.60 3 Schizodon vegetal 1 0.15 4 Schizodon alga 1 0.05 5 Schizodon sediment 1 0.90 6 Schizodon
2009 Jul 01
4
mbox format and UIDVALIDITY
...UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH] Logged in a2 list "" % * LIST (\NoInferiors \UnMarked) "/" "Sent" * LIST (\HasNoChildren \UnMarked) "/" "INBOX" a2 OK List completed. a3 create new1 a3 OK Create completed. a4 create new2 a4 OK Create completed. a5 select new1 * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 0 EXISTS * 0 RECENT * OK [UIDVALIDITY 1] UIDs valid * OK [UIDNEXT 1] Pr...
2008 Jul 25
0
nlminb--lower bound for parameters are dependent on each others
...e constant) When I wrote my program as: ... myfunction1 <-function(param ){..} myfunction2 <-function(param ){..} #param1=param[1] #param2=param[2] ... while (difference.Params>eps){ ... res1 <- nlminb(param.new2, myfunction1, lower = c(0, -c1/res1$par[1]), upper = Inf) param.new1<-res1$par res2 <- nlminb(param.new1, myfunction2, lower = c(0, -c1/res2$par[1]), upper = Inf) param.new2<-res2$par difference.Params <-max(abs(param.new1-param.new2)) } I got error message: Error in -res1$par[1] : invalid argument to unary operator Is there any way to implement th...
2012 Oct 21
1
Parameter Matrix
Hallo, I would like to run a model (differential equations) with a whole bunch of parameter combinations. I think the best way of doing this is to put the model function into a loop and set a matrix with the parameters: Each row will represent the parameters for one loop. I know how to compile such a matrix (via another loop, or by using rbind etc.). However I hope you guys may have a much
2013 Jan 25
1
Recoding variables (without recode() )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130125/859c4520/attachment.pl>
2011 Nov 08
2
Selecting 3 different hours in a day
...create a loop which will take out each of these hours and create a subset. I was thinking of doing a for loop using the row number since: 9am= row 10 12pm= row 13 3pm= row 16 trying to loop through to extract these 3 times each day. n=length(date_stamp) for (i in i:n) { m= 10 i= 1 new1= mv[m,] i= i+1 m= m+3 ##m+18 at row 16? } I need some help creating a loop through this! Thank you! -- View this message in context: http://r.789695.n4.nabble.com/Selecting-3-different-hours-in-a-day-tp4015010p4015010.html Sent from the R help mailing list archive at Nabble.com.
2012 Sep 15
2
How to convert the output of tapply() so that it has the same order as the input?
Hi, I try to apply a function to subsets of a data.frame. tapply() does the job, but the as output, I am looking for a vector (not an array/matrix) ordered in the same way as the original data, so I can simply cbind the result to the original data.frame. Below is a minimal example. I know that there are packages that can do these things easier, but I'm looking for a fast solution not
2013 Feb 27
2
matrix multiplication
Hi, Try this: #mat1 is the data res<-do.call(cbind,lapply(seq_len(nrow(mat1)),function(i) {new1<-do.call(rbind,lapply(seq_len(nrow(mat1[-i,])),function(j) {x1<-rbind(mat1[i,],mat1[j,]); x2<-(abs(x1[1,1]-x1[2,1])*abs(x1[1,5]-x1[2,5]))+(abs(x1[1,2]-x1[2,2])*abs(x1[1,6]-x1[2,6]))+(abs(x1[1,3]-x1[2,3])*abs(x1[1,7]-x1[2,7]))+(abs(x1[1,4]-x1[2,4])*abs(x1[1,8]-x1[2,8]))}));new1})) head(res,...