Displaying 20 results from an estimated 600 matches similar to: "loop for a large database"
2006 Mar 06
4
Contingency table and zeros
Hello,
Let's assume I have a vector of integers :
> myvector <- c(1, 2, 3, 2, 1, 3, 5)
My purpose is to obtain the cumulative distribution of these numerical
data, i.e. something like :
value nb_occur.
<=1 2
<=2 4
<=3 6
<=4 6
<=5 7
For this, I create a table with ;
> mytable <- table(myvector)
1 2 3 5
2 2 2 1
However, table() returns an array
2012 Mar 06
1
frequency count by row
I feel this is a very easy thing but I've never done it before and it is
getting frustrating.
I have a big data.frame (1445846 rows, 15 col)
that looks like this:
V1 V2 V3 V4 V5
1 home sister brother chair 0
2 cat dog animal 0 0
3 girl boy 0
2012 Mar 10
2
Window on a vector
Dear all,
I have a large vector (lets call it myVector) and I want to plot its value with the logic below
yaxis<-myVector[1]
yaxis<-c(xaxis,mean(myvector[2:3])
yaxis<-c(xaxis,mean(myvector[4:8])
yaxis<c(xaxis,mean(myvector[9:16])
yaxis<c(xaxis,mean(myvector[17:32])
this has to stop when the new ..... yaxis<c(xaxis,mean(myvector[1024:2048]) will not find the correspondent number
2013 Aug 27
1
R Language Newbie
Hi,
set.seed(29)
myVector<- rnorm(100)
?seq(1,100,by=2)
# [1]? 1? 3? 5? 7? 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
#[26] 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
myVector[seq(1,100,by=2)]
rev(myVector)
?sum(myVector>0)
#[1] 46
#or
?table(myVector>0)
#
#FALSE? TRUE
?#? 54??? 46
A.K.
Hey guys, this is my first week
2007 Dec 18
6
All anchored series from a vector?
>From: Johannes Graumann <johannes_graumann at web.de>
>Date: 2007/12/18 Tue PM 04:40:37 CST
>To: r-help at stat.math.ethz.ch
>Subject: [R] All anchored series from a vector?
lapply(1:length(myvector) function(.length) {
c(myvector[1}:myvector[.length])
})
but test it because i didn't.
>Hi all,
>
>What may be a smart, efficient way to get the following result:
2008 Nov 06
2
Fwd: SWIG with R and C++ STL
Hi, all
I didn't get any response from swig for my question.
see if I can get some help here
Thanks
---------- Forwarded message ----------
From: charlie <charlie.xia.fdu@gmail.com>
Date: Tue, Nov 4, 2008 at 1:55 PM
Subject: SWIG with R and C++ STL
To: swig-user@lists.sourceforge.net
Hi all,
I am new to SWIG. I encountered some problem when I try to SWIG to R some
C++ modules.
Here
2006 Apr 04
2
Selecting out certain values from a MATRIX
I have two objects, one matrix and one vector.
I want to use my vector to subset certain values out of my matrix.
For example:
I want to tell R, to select out all rows in myMatrix into a new myMatrix2 IF
that corresponding row is less than a 0.5 in myVector.
So:
myMatrix = a matrix of 8000 by 20
myVector = vector of 8000
myMatrix2 = a matrix of < 8000 by 20 (based on selection criteria in
2009 Feb 15
1
Overloading in R
I have been trying to write a new class that reimplements the vector
class. As a test of my overloading I decided to try and and call
t.test on two vectors which were objects of my class rather than the
default class.
The overloaded length I wrote seems to work correctly. I used
setMethod("length", "myvector", ...)
setMethod("mean", "myvector", ...)
2011 Sep 30
3
is member
Dear all,
I have a vector with number that some of them are part of the
seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4)
LEt's say that is called myvector the vector with the numbers.
Is there in R something like this?
is.member(myvector,seq(1,800,4))
I would like to thank you in advance for your help
B.R
Alex
[[alternative HTML version deleted]]
2008 Aug 22
1
grep, gsub and metacharacters
Hello,
I have an expression that I want to substitute for something else.
myvector<-c("ajkhfkiuwe","Variable(kg/min)")
if I use the following code to extract "variable(kg/min)" and substitute it for "va"
gsub(myvector[grep("var", myvector, ignore=T)], "va", myvector)
grep identifies the element of the vector that matches my
2012 Jan 16
3
list: index of the element, that is TRUE
Dear People,
I have got the following example for a vector and the index of the TRUE
element:
Myvector <- c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
which(Myvector)
Now I would like to find out the same for a list:
Mylist <- list(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE)
...
Does anyone know how to do this?
Thank you very much in advance,
Marion
[[alternative HTML
2009 Aug 25
3
Regular expression to define contents between parentheses
Hello dear R-helpers,
I haven't been able to figure out of find a solution in the R-help archives about how to delete all the characters contained in groups of parenthesis. I have a vector that looks more or less like this:
myvector<-c("something (80 km/h, sd) & more (6 kg/L,sd)", "somethingelse (48 m/s, sd) & moretoo (50g/L , sd)")
I want to extract all
2008 Jul 10
2
Finding Values that Occur Most Often in a Vector
Hi,
Is there a way to do it?
For example I have the following vector:
> print(myvector)
> [1] -295.8045 -295.8045 -295.8045 -295.8045 -325.4754 -295.8045 -295.8045
[8] -295.8045 -413.2099 -295.8045
I want it to return -295.8045, which occur most often.
- Gundala Viswanath
Jakarta - Indonesia
2012 Mar 14
1
check for data in a data.frame and return correspondent number
Dear R-ers,
still the newbie. With a question about coordinates of a vector appearing or
not in a data.frame.
I have a data.frame (MyData) with 3 columns which looks like this:
V1 V4 redNew
red-j 10.5032 appearance blood-n
red-j 9.3749 appearance ground-n
red-j 10.2167
2008 Aug 11
4
how can I do this sum?
Hi,
Suppose I have a vector in real number
(x1, x2, x3, x4, x5, x6)
My question is how I can get
x5*x3*x1 + x6*x4*x2 ?
Thanks a lot.
Dot.
--
View this message in context: http://www.nabble.com/how-can-I-do-this-sum--tp18931693p18931693.html
Sent from the R help mailing list archive at Nabble.com.
2009 May 28
1
custom sort?
Sounds simple but haven't been able to find it in docs: is it possible to
sort a vector using a user-defined comparison function? Seems it must be,
but "sort" doesn't seem to provide that option, nor does "order" sfaics
--
View this message in context: http://www.nabble.com/custom-sort--tp23770565p23770565.html
Sent from the R help mailing list archive at Nabble.com.
2009 May 28
1
custom sort?
Sounds simple but haven't been able to find it in docs: is it possible to
sort a vector using a user-defined comparison function? Seems it must be,
but "sort" doesn't seem to provide that option, nor does "order" sfaics
--
View this message in context: http://www.nabble.com/custom-sort--tp23770565p23770565.html
Sent from the R help mailing list archive at Nabble.com.
2015 Oct 22
2
C_LogLin (stats/loglin)
Hi everyone,
I have a question regarding a C function of the "stats" package in R.
I tried to understand the ?loglin? basic function of the ?stats?
package implemented in
R. The implemented function itself runs without any problem (perhaps
see sample). When I
ran it line by line it stopped at the lines 23-24 of the
loglin-function; (the following line):
z <- .Call(C_LogLin,
2011 Sep 29
1
multiplying list with vector
hello everybody,
i have got a question about lists:
i have got the following commands:
mylist <- list("v1"=c(1,2,2,1),"v2"=c(2,2,2,1),"v3"=c(1,1,1,1))
myvector <- c(100,10000,1000000)
now i would like to multiply each element of the list with the corresponding
element of the vector, that is to say:
v1*100
v2*10000
v3*1000000
i only could think of lapply
2010 Jul 26
4
using string variable as order() function argument
Hello,
In my script I would like to use a loop, which sorts the dataframe
according to different columns, pointed by the string variable.
id col1 col2 col3
1 10 0 4 8
2 11 1 2 2
3 12 0 8 3
4 13 0 5 5
Usually the order() function can be used like this:
sorted = mytable**[order(column3) , ]
which results in properly sorted table:
**