Displaying 20 results from an estimated 8000 matches similar to: "transform 3 numeric vectors empty of 0/1"
2012 Nov 08
5
map two names into one
Thanks.
Yes. Your approach can identify:
Glaxy ace S 5830 and
S 5830 Glaxy ace
But you can not identify using same program:
Iphone 4S 16 G
Iphone 4S 16G
How should I solve both in same time.
Kind regards,Tammy
[[alternative HTML version deleted]]
2013 Sep 05
2
binary symmetric matrix combination
Hi,
May be this helps:
m1<- as.matrix(read.table(text="
y1 g24
y1 0 1
g24 1 0
",sep="",header=TRUE))
m2<-as.matrix(read.table(text="y1 c1 c2 l17
?y1 0 1 1 1
?c1 1 0 1 1
?c2 1 1 0 1
?l17 1 1 1 0",sep="",header=TRUE))
m3<- as.matrix(read.table(text="y1 h4??? s2???? s30
?y1 0 1 1 1
?h4 1 0 1 1
?s2 1 1 0 1
?s30 1 1 1
2010 Aug 24
3
multiple assignments ?
Simple one, have read and googled, still no luck!
I want to create several empty vectors all of the same length.
I would like multiple empty vectors (vec1, vec2, vec3) and want to create them all in one line.
I've tried
vec1,vec2,vec3 <- vector(length=5)
and
c(vec1,vec2,vec3) <- vector(length=5)
and several other attempts but nothing seems to work ... suggestions?
Thanks
Jim
2004 Jul 09
3
Problem with bwplot
Try factor(vec2) in your bwplot() call.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Ernesto Jardim
Sent: Friday, July 09, 2004 9:41 AM
To: Mailing List R
Subject: [R] Problem with bwplot
Hi,
I'm ploting some box-and-whisker plots with bwplot but I'm not getting
any box-and-whiskers ... just dots.
2012 Aug 24
6
updating elements of a vector sequentially - is there a faster way?
I would like to know whether there is a faster way to do the below
operation (updating vec1).
My objective is to update the elements of a vector (vec1), where a
particular element i is dependent on the previous one. I need to do this on
vectors that are 1 million or longer and need to repeat that process
several hundred times. The for loop works but is slow. If there is a faster
way, please let
2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there
I'm currently trying to figure out how to keep my "factor" levels for a
variable when moving it from one data frame or matrix to another.
Example below:
vec1<-(rep("10",5))
vec2<-(rep("30",5))
vec3<-(rep("80",5))
vecs<-c(vec1, vec2, vec3)
resp<-rnorm(2,15)
dat<-as.data.frame(cbind(resp, vecs))
2011 Oct 01
2
Returning vector of values shared across 3 vectors?
Help-Rs,
I've got three vectors representing participants:
vec1 <- c(4,5,6,7,8,9,10,11,12,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81)
vec2 <- c (1,2,3,4,5,6,7,8,9,10,11,12,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66)
vec3 <- c (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,52)
I'd
2012 May 04
1
Equality of multiple vectors
Hello,
I'm writing a piece of code where I need to compare multiple same length
vectors.
I've gone through the basic functions like identical() or all(), but they
only work for comparing 2 vectors. From 3 vectors on, it doesn't work .
Example: Assuming
vec1 <- c (1,2,3,4,5)
vec2 <- c(1,2,3,4,5)
vec3 <- c(1,2,3,4,4)
identical (vec1,vec2,vec3) returns TRUE, since the 2
1999 Dec 16
2
R question
I have the following question, which is elementary but I am unable to
answer.
In a for(i=10) loop, I am trying to represent the 10 1-dimensional vectors
l1, l2,... l10 by some expression that will run through these values.
ie. soppose I want to add l1 + ... + l10
I could go
x <- 0
for(i in 1:10){ x <- x+ l(i)}
This should return x to be the sum of the 10 li's for i from 1 to 10
2013 Jul 02
2
Replacing strings to numbers
Hi guys,
I was wondering if any one is able to help me on a problem that I was stuck
with for a long time. It involves the replacement of character strings with
numbers. The character string can take on only 3 possible values, for
instance:
AA
AT
TT
I would want R to replace AT with 0. Between AA and TT, I want to compare
the frequency of either value, and then for the one which occurs more, I
2013 Aug 29
4
Add new calculated column to data frame
Hi,
I have a following data set:
id event time (in sec)
1 add 1373502892
2 add 1373502972
3 delete 1373502995
4 view 1373503896
5 add 1373503996
...
I'd like to add new column "time on task" which is time elapsed between two
events (id2 - id1...). What would be the best approach to do that?
Thanks,
Srecko
[[alternative HTML
2013 Feb 17
1
addition in the initial question
Dear Elisa,
Try this:
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
vec2<-vec1[1:26]
names(vec2)<-LETTERS[1:26]
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i)
2013 Apr 04
3
summing vectors
Hi All,
Year Area Q Bin FD
I have a large dataset I need to re-structure. It looks something
like this: 2000 1 1 5 0 2000 1 1 10 1 2000 1 1 15 23 2000 1 1 20 12 2000
1 1 25 1 2000 2 1 5 1 2000 2 1 10 3 2000 2 1 15 15 2000 2 1 20 11 2000
2 1 25 3 2000 1 2 5 0 2000 1 2 10 1 2000 1 2 15 23 2000 1 2 20 12 2000
1 2 25 1 2000 2 2 5 1 2000 2 2 10 3 2000 2 2 15 15 2000 2 2 20 11
2013 Feb 17
6
histogram
HI Elisa,
You could use ?cut()
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2005 Jun 20
3
vectorisation suggestion
Hi All,
I am counting the number of occurrences of the terms listed in one
vector in another vector.
My code runs:
for( i in 1:length(vector3)){
vector3[i] = sum(1*is.element(vector2, vector1[i]))
}
where
vector1 = vector containing the terms whose occurrences I want to count
vector2 = made up of a number of repetitions of all the elements of
vector1
vector3 = a vector of NAs that is
2013 Aug 26
4
transform variables
Dear all!
I have a data frame composed by 13 columns (year, and 12 months). I want to
transform this data base in another like this
year month values
1901 1
1901 2
1901 3
.....
1901 12
1902 1
1902 2
....
1902 12
Is there a possibility to succeed that in R?
Thank you!
best regards!
CR
--
---
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str.
2009 Jun 22
2
Help on creating a sequence of vectors
I want to create a number of vectors like :
vec1 <- rnorm(1)
vec2 <- rnorm(2)
vec3 <- rnorm(3)
and so on...........
Here I tried following :
for (i in 1:10) paste("vec", i, sep="") <- rnorm(i)
However obviously that is not working. Here vectors I need to be seperated
i.e I do not want to create a "list". How to modify above code?
--
View this
2000 Jun 17
2
R 1.1.0 for Windows
Windows binaries at CRAN (bin/windows/Windows-NT/base) have been updated
to R-1.1.0. See below for a list of Windows-specific changes.
We thanks all the people who checked over pre-test versions.
guido masarotto
(for the R-core team)
Windows-specific changes to R
=============================
There is now a GUI preferences editor on the Edit menu in Rgui.
A data entry editor is now
2000 Jun 17
2
R 1.1.0 for Windows
Windows binaries at CRAN (bin/windows/Windows-NT/base) have been updated
to R-1.1.0. See below for a list of Windows-specific changes.
We thanks all the people who checked over pre-test versions.
guido masarotto
(for the R-core team)
Windows-specific changes to R
=============================
There is now a GUI preferences editor on the Edit menu in Rgui.
A data entry editor is now
2009 Mar 09
3
How to write a function that accepts unlimited number of input arguments?
Dear R-helpers:
I am an R newbie and have a question related to writing functions that
accept unlimited number of input arguments.
(I tried to peek into functions such as paste and cbind, but failed, I
cannot see their codes..)
Can someone kindly show me through a summation example?
Say, we have input scalar, 1 2 3 4 5
then the ideal function, say sum.test, can do