similar to: help on loop function

Displaying 20 results from an estimated 1200 matches similar to: "help on loop function"

2008 Feb 08
6
writing a function
Dear lists, I'm in my process of learning of writing a function. I tried to write a simple functions of a matrix and a vector. Here are the codes: mm<-function(m,n){ #matrix function w<-matrix(nrow=m, ncol=n) for(i in 1:m){ for(j in 1:n){ w[i,j]=i+j } } return(w[i,j]) } v<-function(n){ #function of a vector y=vector(length=n)
2008 Feb 07
2
matrix loop
Dear list, I'm trying to make a loop of a (5x10) matrix and below are my codes. Could anybody help me figure out why my loop is not working. Thanks in advance!! m<-1:5 n<-1:10 for(i in 1:length(m)) { for(j in 1:length(n)) { y[i,j]=sum(i,j) y<-as.matrix(y[i,j]) } } cheers, Anisah --------------------------------- [[alternative HTML version
2008 Feb 12
3
reverse vector elements
Dear lists, I want to write a function of a vector and reverse the order of its elements. Here is my code: revector<-function(n){ y=vector(length=n) for(i in n:1){ y[i]=i } return(y) } i want my output to be like this: y [1] 10 9 8 7 6 5 4 3 2 1 Any suggestion?? Thanks!! Cheers, Anisah ---------------------------------
2008 Jun 12
3
p-value
Dear R User, say I have this sample of data ( attach with). What i'm going to do is to test whether this data is uniformly distributed or not by finding the p-value. I've tried using the punif command but it gave me the value of 1 of all the data. Any suggestion on R command to find the p-value??Thanks in advance!! Cheers, Anisah -------------- next part
2008 Feb 05
1
Vector loop
hi, I'm in my learning process of doing a programming with "for" loop. How to make a loop of a vector of length 10 where elements are 1,2,3,4,5,6,7,8,9,10. Any suggestion needed!! Many thanks. Cheers, Anisah --------------------------------- [[alternative HTML version deleted]]
2008 Feb 17
1
extracting elements by using logical values
dear lists, My question is quite simple but i'm a new user in R and it's seem tough to me. How am i going to recall back my values??ok..it could be easy if i ilustrate my problem with the simple example. say that, x [1] 1 2 y [1] 2 3 and my logical output from my function are (Below is my function): overlapped(x,y) [1] TRUE [1] TRUE suppose i
2008 Jan 22
1
stripchart
hi, I want to plot a dotplot graph but unfortunately R does not have it any more. It suggest to use either the stripchart or the dotchart and i prefer to play around with the stripchart graph. Sadly, the result is not like i want where I'm actually wants the plots/points were scattered around the x-axis. Plus, from the results shows that and the x-axis gave a very large scale, i.e
2008 Jan 08
3
splitting the column
Hi, I have a matrix data with 21 rows and 6 columns. Below and attach with is my matrix data. My problem is to split the column into 3 subcolumns (except for column 3 and 4) . I want my new matrix data to have 14 columns and 21 rows. Kindly help is highly appreciated. [,1] [,2] [,3] [,4] [,5] [,6]
2008 Jun 27
1
finding the suitable distribution
Dear R-users, Attach with is my data..what i want to do is finding a suitable distribution for my data..I want to run a few test like the poisson and the exponential distribution. Please help me on how to find the p-value for poisson as well as the exponential distribution without knowing the parameter. Is it possible?? Thanks in advance. love, Anisah -------------- next
2008 Feb 01
2
overlapping intervals
hi!! Below I have 4 columns vector of c and d which are unequal in length.These c and d have 2 columns each where these 2 columns represent an interval values. How am I going to get an overlapping over these interval values?? Please help me sort this problem!! Thanks in advance.. c d 17130612 17587118 17712302 18100404 17712302
2023 Jan 15
1
dovecot replication - new and cur folders on mx1 and mx2
Hello, I have a question in regards to specific dovecot replication behaviour and I'm just wondering if this is actually an expected/normal behaviour, or just a version issue. I'm using dovecot 2.3.16 which is packed by default with latest Ubuntu 22.04.1 LTS server release. I setup dovecot replication pair (mx1 - mx2) which is working ok. MX1 has priority 10, MX2 has priority 20. I
2023 Jan 17
1
dovecot replication - new and cur folders on mx1 and mx2
I can confirm this in a slightly different setting, but still using two-way sync between two dovecots. On e is 2.3.19.1 running on macOS Monterey, the other is 2.3.20 running in an alpine container on Ubuntu. Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>) R&A IT Strategy <https://ea.rna.nl/> (main site) Book: Chess and the Art of Enterprise?Architecture
2023 Jan 17
1
dovecot replication - new and cur folders on mx1 and mx2
It might have a noticeable effect on clients. I encountered (probably triggered by this in some way?) that I was unable to het the 'read' bit set in macOS Mail.app. Maybe (as I am doing HA with round robin) the Mail.app client got to one dovecot repository on one tcp connection and then on the other. Is there a reason why syncing tis move from new to cur is a bad idea? Gerben Wierda
2008 Oct 22
3
coalesce columns within a data frame
Dear all, I searched the mail archives and the R site and found no guidance (tried "merge", "cbind" and terms like "coalesce" with no success). There surely is a way to coalesce (like in SQL) columns in a dataframe, right? For example, I would like to go from a dataframe with two columns to one with only one as follows: From Name.x Name.y nx1 ny1 nx2 NA
2012 Aug 17
1
DNS DoS attack
Looks like one of my name servers (CentOS 5) gets a lot of malicious queries. The cpu load is constantly about 3 %. I put on stricter limits on who is allowed recursive queries, but this does not affect the CPU load. I also updated bind. I temporarily turned on querylog (command: rndc querylog), and noticed that I get over 200 queries like this per second: > Aug 17 07:41:38 mx2
2008 May 24
1
combine elements of list into a vector
Dear R, Can anybody help me on how to combine all the elements in a list into a single vector?? I've tried using unlist command but it gave me wrong output. Below is the example of the vector output that i want and attach with is my list of data. Any suggestion?? Many Thanks breakp.start 6978022 10249966 10955201 11045352 11814604 13847633
2008 Feb 08
1
remove the missing value,NA
I have two sets of interval data.Below are my two dataset. In these dataset, there is a missing values in each of the data. I want to find the non-overlapping interval values. Here is my code: mysetdiff=function(x,y){ m=length(x) n=length(y) bx = logical(m) by = logical(n) for(i in 1:m){ for(j in 1:n){ if(x[i]<=y[j]){ bx[i] = T by[j] = T }
2012 May 15
2
Sendmail problem - baffled
Our backup mail server (which I have just re-configured) tries to contact the primary mail server, and fails. My log shows repeatedly "connection refused": May 15 22:21:41 mx2 sm-mta-rx[8674]: q4FIhPij007483: makeconnection (mail.greenspot.fi. [83.143.217.182]) failed: Connection refused by mail.greenspot.fi. May 15 22:21:41 mx2 sm-mta-rx[8674]: q4FIhPij007483: to=<myuser at
2008 Feb 09
1
error in the function
Dear lists, i want to find the non-overlapping interval values with this code: mysetdiff=function(x,y){ m=length(x) n=length(y) bx = logical(m) by = logical(n) for(i in 1:m){ for(j in 1:n){ if(x[i]<=y[j+1]){ bx[i] = T by[j] = T NA = NA } } } sx = x[!bx] sy = y[!by] s=c(sx,sy) return(s) } Below is my
2003 Aug 04
1
Novice question
Hello. I am new R user, so this question is probably quite stupid, but for the life of me I cannot figure out how to get predications using multivariate linear regression analysis. Single variable predictions work fine. I am trying the following: -- Known y's for known x's1 and x's2 ys <- c(133890, 135000, 135790, 137300, 138130, 139100, 139900, 141120, 141890, 143230, 144000,