search for: 5,6

Displaying 20 results from an estimated 539 matches for "5,6".

Did you mean: 1,6
2011 Nov 08
4
Intervals in function cut
When I was studying the function cut I found this example: > x <- rep(0:8, tx0) > x [1] 0 0 0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 4 4 4 5 5 5 5 5 5 5 5 5 5 6 [39] 6 6 6 6 7 7 7 8 8 8 8 8 > cut(x, b = 8) [1] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] [6] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (0.994,2] [11] (0.994,2] (0.994,2] (0.994,2] (2,3] (2,...
2023 Oct 12
4
if-else that returns vector
Hi, Following expression returns only the first element ifelse(T, c(1,2,3), c(5,6)) However I am looking for some one-liner expression like above which will return the entire vector. Is there any way to achieve this?
2023 Oct 13
1
if-else that returns vector
...rom either 'yes' or 'no' depending on whether the element of 'test' is 'TRUE' or 'FALSE'. This is actually rather startling, because elsewhere in the S (R) language, operands are normally replicated to the length of the longer. Thus c(1,2,3)*10 + c(5,6) first (notionally) replicates 10 to c(10,10,10) and then c(5,6) to c(5,6,5), yielding c(15,26,35). And this *does* happen, sort of. > ifelse(c(F,T,F), c(1,2,3), c(5,6)) => 5 2 5. But it *doesn't* apply to the test. There's another surprise. Years ago I expected that all three arg...
2007 May 10
3
Getting the last day of the month.
Hi, Given a date, how do I get the last date of that month? I have data in the form YYYYMM, that I've read as a date using > x$Date <- as.Date(ISOdate(substr(x$YearEnd,1,4),substr(x$YearEnd,5,6),1)) But this gives the first day of the month. To get the last day of the month, I tried > as.Date(as.yearmon(x$Date,frac=0)) But I don't get the last day of the month here. (Tried frac=1 too.) I then add a month to the date, substract one day from the resultant date. But this wouldn...
2012 May 10
1
storage of matrices of diff dimension together
Hi, It might be a trivial question but how do you store matrices of different dimensions read from a file or in a loop together? The best solution might be a list but I don't store the first matrix  correctly:  m = rbind(c(1,2),c(3,4),c(5,6)) t=rbind(c(1,2),c(5,6))  l = list(m) > l = list(l,t)    #I assumed that at the begining I don't have m and t at the same time to do list(m,t), but I list them, one after the other > l [[1]] [[1]][[1]]      [,1] [,2] [1,]    1    2 [2,]    3    4 [3,]    5    6 [[2]]   [,1] [,2] t  ...
2015 May 14
3
comportamiento de data.table al hacer calculos por grupos
.... Estoy haciendo calculos por grupos con data,table. Tengo un archivo (zp.res) con tres columnas que clasifican los datos (sol, con, dia) y una columna de datos numericos (media), de la siguiente forma: sol con dia media 1: con 0 1 -22.6 2: con 0 1 -36.6 3: con 0 1 -35.6 y quiero calcular el promedio de "media" (la col 4) agrupando con las variables sol,con,dia. Lo hago de la siguiente forma: med <- zp.res[, mean(media), by="sol,dia,con"] cuando reviso "med" esta todo bien, se han calculado las medias y el objeto tiene solo l...
2010 Jan 20
3
problem with origin of a plot
Dear list, I have somewhat a small problem with a plot in R. I want to produce a plot with the two axis intersection being the exact values of ( 5,6). The code i am using is" BN<-c(14.95,9.03,10.42,9.3,9.52,7.73,6.35,6.73,5.54,5.42,6.24,5.98,6.21,5.83,7.14,5.79,5.57,7.43,9.19,10.17,9.79,9.56,9.87,9.33,10.56,10.08,9.49,8.49,7.34,6.14,5.98,7.27,5.56, 7.3,6.14,6.37,5.14,5.53,5.64,6.55,7.04,9.41,9.59,9.92,10.77,9.77,10.26,8.71,8.91,9.7...
2010 Jan 20
1
Line Plot with Dates on X-axis
...umber of days since 1/1/1970. How do I either get the first block to recognize the desired format, or the second block to format the x-axis as quarters? Thank you in advance! #block 1 time.val <- as.factor(c ("2004Q1","2004Q2","2004Q3","2004Q4","2005Q1","2005Q2")) inc <- c(0.9903797, 1.3741467, 0.9938702, 0.4252443, 0.7700158, 1.1770313) # returns nice x-axis, but black points plot(time.val, inc, type="b", col="red") #block 2 time2 <- ifelse (substr(time.val,5,6) == "Q1", as.Date(paste(...
2010 Feb 04
2
Filling a logical matrices with values
Hello !! I have this problem: A matrix on True/False and as many numerical vectors as columns, but of different length. What I 'd like to get is this: set.seed(12) > dat <- as.data.frame(matrix(as.logical(sample(T:F, 30, T)),5,6)) > colnames(dat) <- letters[1:6] > rownames(dat) <- paste(letters[1:5],1:5, sep="") > dat a b c d e f a1 TRUE TRUE TRUE TRUE TRUE TRUE b2 FALSE TRUE FALSE TRUE FALSE FALSE c3 FALSE FALSE TRUE FALSE TRUE TRUE d4 TRUE TRUE TRUE FALS...
2011 Sep 12
2
function to include factors in summary data frame
...at are factors ( such as sites "A", "B", and "C") that I would like to include in the new data frame. I have done this in a clunky way using match() and a loop, but am wondering if there is a more elegant approach. Here is an example data set. #Example a<-c(rep(1:5,6)); b<-sort(b) b<-c(rep("A",10),rep("B",10),rep("C",10)) a<-c(rep(1:5,6)); b<-sort(b) d<-c(2008,2008,2009,2009,2010,2010);d<-rep(d,5) e<-rnorm(30,2,1) df<-data.frame(a,b,d,e) ; names(df)<-c("ind","site","year",&...
2008 Jul 25
3
Bug in gap.plot
Hi, all I am trying to make a plot with a axis break and I want the whole plot to be line, not points. However, when I execute the following command half of the graph is points and the other lines. gap.plot(Xdata, Ydata,gap=c(5,6),gap.axis="x",type="l") I think it might be a bug in plotrix. I would greatly appreciate your input. If there is another way to do it, I would greatly appreciate it. Best wishes, Art Roberts University of Washington Department of Medicinal Chemistry Seattle, WA 98195
2017 Jun 03
4
New var
Hi all, I have a data set with time interval and depending on the interval I want to create 5 more variables . Sample data below obs, Start, End 1,2/1/2015, 1/1/2017 2,4/11/2010, 1/1/2011 3,1/4/2006, 5/3/2007 4,10/1/2007, 1/1/2008 5,6/1/2011, 1/1/2012 6,10/15/2004,12/1/2004 First, I want get interval between the start date and end dates (End-start). obs, Start , end, datediff 1...
2015 Aug 25
6
echo password into bash script
...ho my password into some commands inside of a bash script. But I think I'm going about it incorrectly. Here's the top part of my script: #!/bin/bash pub="~/.ssh/id_rsa.pub" dps_pass="my_pass" ssh="/usr/bin/ssh" scp="/usr/bin/scp" for i in 10.10.10.2{5,6} do echo "xfring key up" echo $dps_pass | $scp $PUB digitalplatform@$i: And here's how it executes: #bash -x deploy_key.sh + pub='~/.ssh/id_rsa.pub' + dps_pass='nbcuV01P!' + ssh=/usr/bin/ssh + scp=/usr/bin/scp + for i in 10.10.10.2{5.6} + echo 'xfring key u...
2007 Sep 16
1
Putting column names in some automated way
Dear all, I have following codes: colnames(data) = c("var", "var", "var") i = c(1,2,3) Now I want construct a "for" loop starting from 1 to 3 to give the new names of columns for dataframe "data" like below colnames(data) > c("var1", "var2", "var3") Definitely I could do this manually, however I want to put
2003 Oct 06
4
Apply and its friends
Hi, Forgive a very basic question... I need to take two lists-of-lists, and apply a function to each pair of elements in the lists to return a single list... For example l1 <- list(1:5,6:10,2:15) l2 <- list(1:8,4:12,1:19,4:20) I could easily do an lapply across each of them, but is there a function that does a sort-of pairwise-apply across both together? Does anybody know of a good document that discusses this kind of basic matrix/list/vector manipulation in R? Regards, cris...
2003 Jun 09
2
Appending elements to an array
...trouble with the array structure of R. What I want to do is dynamically add/remove elements to an array. For example: Let's say I have created an array: > myArray <- array(c(3,8), dim=c(1,2)) > myArray [,1] [,2] [1,] 3 8 And I now want to, for example, push an element (5,6) on to this array so it will read: [,1] [,2] [1,] 3 8 [2,] 5 6 And then pop the first element of the array so the array now reads: [,1] [,2] [1,] 5 6 How would I do this? So far I've only read how to create an array if you know the dimensions beforehand, but...
2013 Oct 09
2
[LLVMdev] Question about anti-dependence breaker
...anti-dependence of postRAScheduler in LLVM. when I use command line "clang -target arm -mcpu=cortex-a8 -O2 -integrated-as -c test.c -o test.o" and get objdump file as follows: ldrr1, [r0,#16]----(1 str r1, [r0,#32]----(2 ldr r1, [r0,#12]----(3 str r1, [r0,#36]----(4 ldr r1, [r0,#08]----(5 str r1, [r0,#40]----(6 However, I expect that instruction pairs (1,2), (3,4) and (5,6) use different registers after postRAScheduler pass. Then, I find that postRAScheduler only handle anti-dependence mode after debug LLVM source code. More while I use gcc to compile test.c and get expected result...
2013 Mar 12
2
Bugs due to naive copying of list elements
Several bugs are present in R-2.15.3 and R-alpha due to naive copying of list elements. The bug below is due to naive copying in subset.c (with similar bugs for matrices and arrays): a<-list(c(1,2),c(3,4),c(5,6)) b<-a[2:3] a[[2]][2]<-9 print(b[[1]][2]) Naive copying in mapply.c leads to the following bug: X<-1+1 f&lt...
2011 Mar 09
2
Complex sampling?
...am trying to generate a randomized weekday survey schedule that ensures even coverage of weekdays in the sample, where the distribution of variable DOW is random with respect to WEEK. To accomplish this I need to randomly sample without replacement two weekdays per week for each of 27 weeks (only 5 are shown). However, I need to sample from a sequence (3:7) that needs to be completely depleted and replenished until the final selection is made. Here is an example of what I want to do, beginning at WEEK 1. I would prefer to do this without using a loop, if possible. sample frame: [3,4,5,6,...
2010 Jan 13
3
Operating on each row of data frame
Hi All I have a data frame in which there are 4 columns . Column 1 : name Column 2-4 : values I would like to calculate mean/Standard error of values in column 2-4 and store them in column 5,6 respectively. I have done the following but doesn't seem to work mean_N_SE <-function(x) { name <- x[1] vals <- c(x[2:4]) temp_mean <- mean(vals) SE <- sqrt(var(x)/length(x)) } apply(d,1,mean_N_SE) where d = data frame. Can someone help me with this. Thanks! -Abhi...