Displaying 20 results from an estimated 76 matches for "inxs".
Did you mean:
ins
2012 Apr 06
4
Order sapply
Good Afternoon,
I have the following code, but it seems that something must be doing
wrong, because it is giving the results I want.
The idea is to create segments while the value of Commutation is less than
1000.
for example, from the small set of data below
text="
val_user pos v v_star v_end commutation v_source
v_destine
1 1 96-96 1173438391 1173438391 0
2018 May 19
0
Split a data.frame
Hello,
Maybe something like the following.
splitDF <- function(data, col, s){
n <- nrow(data)
inx <- which(data[[col]] %in% s)
lapply(seq_along(inx), function(i){
k <- if(inx[i] < n) (inx[i] + 1):(inx[i + 1])
data[k, ]
})
}
splitDF(DF, "name", split_str)
Hope this helps,
Rui Barradas
On 5/19/2018 12:07 PM, Christofer Bogaso
2018 May 19
5
Split a data.frame
Hi,
I am struggling to split a data.frame as will below scheme :
DF = data.frame(name = c('a', 'v', 'c'), val = 0); DF
split_str = c('a', 'c')
Now, for each element in split_str, R should find which row of DF contains
that element, and return DF with all rows starting from next row of the
corresponding element and ending with the preceding value of the
2006 Feb 15
0
readline() for passwords?
I don't like to have my password exposed by typing at all. I also don't like
to enter it each time that I wish to open a database (or when I run scripts
automatically across a Linux cluster). My solution has been to keep a file
in my HOME directory containing the username and password for the databases.
This file has read and write permission set so only I (and root) can read
it; this is
2012 Mar 27
2
R extract parts
Good Afternoon,
I believe that my to the problem, the R has a more effective solution.
in place the use the loop
I have the following set of data, and needs to extract some sections.
user pos communications source v_destine
7 1 109 22 22
7 2 100 22 22
7 3 214 22 22
7 4 322 22 22
7 5 69920 22 161
7 6
2010 Jul 07
2
What does `_data` mean in transform()?
Hi All,
I meant to take the min row by row. But the result is apparently not
what I want. Changing min to pmin solve the problem.
> df=data.frame(X=1:10, Y=1:10)
> transform(df, Z=min(X,10-Y))
X Y Z
1 1 1 0
2 2 2 0
3 3 3 0
4 4 4 0
5 5 5 0
6 6 6 0
7 7 7 0
8 8 8 0
9 9 9 0
10 10 10 0
I try to look at the source code to understand what transform() does.
I know
2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Dear r-devel,
See below:
transform(data.frame(a = 1), 2, 3)
#> a
#> 1 1
transform(data.frame(a = 1), b=2, 3)
#> a b X3
#> 1 1 2 3
We need a small modification to make it work consistently, see below:
transform.data.frame <- function (`_data`, ...) {
e <- eval(substitute(list(...)), `_data`, parent.frame())
tags <- names(e)
## NEW LINE
2012 Jul 24
3
Collapsing a vector/data-frame based on the previous values
Hello
I have a data frame like this:
dput(states)
structure(list(Date = c("24/07/2012", "25/07/2012", "26/07/2012",
"27/07/2012", "28/07/2012", "24/07/2012", "25/07/2012", "26/07/2012",
"27/07/2012", "28/07/2012"), State = c(1L, 1L, 1L, 1L, 1L, -1L,
-1L, -1L, 1L, -1L)), .Names = c("Date",
2009 Dec 04
0
Renaming columns of a data.frame
A question that has come up a few times on r-help is how to rename columns
of a data.frame. There are several ways to do this by hand (see the list
archives). There is also a 'rename' function in the reshape package.
I often use the 'transform' function shortly after reading in a data file
and wanted to have a renaming function that has a syntax consistent with the
2012 Aug 01
1
Error message: $ operator is invalid for atomic vectors
HI,
The code was working perfectly fine yesterday and today, until half an hour ago.? Couldn't find any problems in the code. Still, I am getting error message.
myMatrix <- data.matrix(read.table(text="
Name??????????? Age
ANTONY??????? 27
IMRAN????????? 30
RAJ????????????????? 22
NAHAS????????? 32
GEO??????????????? 42
", header=TRUE))
MinMaxArray? <- data.frame(MIN =
2012 Aug 21
2
Sequence detection longer than a certain value
Hello,
I have 2 variable: one is an "id" sequence from 1:1000 and the other is
variable with real values "VI" from -15.0 to 20.0 and I want to detect id
values that have indicator values less than a certain threshold, for
example (x=1) BUT that are in sequence equal or longer than 5.
For instance, in the following column I want to recognize the sequence from
"id" 4
2010 Aug 10
3
grep problem decimal points looping
Hi R Users,
I have been trying to work out how to rename column names using grep,
basically I have generated these column names using tapply:
[1] "NAME" "X1.1" "X2.1" "X3.1" "X4.1" "X5.1" "X6.1" "X7.1" "X8.1"
[10] "X1.2" "X2.2" "X3.2" "X4.2"
2012 Aug 10
2
Regular Expressions + Matrices
Hi all,
My code looks like the following:
inname = read.csv("ID_error_checker.csv", as.is=TRUE)
outname = read.csv("output.csv", as.is=TRUE)
#My algorithm is the following:
#for line in inname
#if first string up to whitespace in row in inname$name = first string up
to whitespace in row + 1 in inname$name
#AND ID in inname$ID for the top row NOT EQUAL ID in inname$ID for the
2018 May 22
0
remove rows of a matrix by part of its row name
Hello,
Use grep to get the row indices and then subset with a *negative* index
to remove those rows.
rn <- scan(what = character(), text = "
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
")
mat <- matrix(rnorm(6*6), nrow = 6)
row.names(mat) <- rn
inx <- grep("73\\.", row.names(mat))
new_mat <- mat[-inx, ]
new_mat
Hope this helps,
Rui Barradas
On
2010 Mar 14
1
Segfault Problem c++ R interface (detailed)
Hello R Community,
I've been working on a project that uses pre-made C++ libraries (using STL)
in R and build a package. However, I've been getting an unusual segfault
that I'm unable to trace its origin. After many attempts of debugging using
gdb, commenting out parts (or all of my code) and valgrind, I'm unable to
make heads or tails about what I'm doing wrong. In fact, when
2018 May 22
4
remove rows of a matrix by part of its row name
Dear R-experts,
How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this
70/556
71.1/280
72.1/556
72.1/343
73.1/390
73.1/556
Now I would like to remove all the rows that contain the text 73.1
Any ideas or suggestion please ?
Regards
**********************
Ahmed Serag
Analytical
2007 Jul 04
7
List delays
Is it just me? After the mail list server upgrade, the average delivery
time for messages to the users list is between 4 and 5 days. The Dev
list seems fine!
Doug
--
Ben Franklin quote:
"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Note that ?transform.data.frame says arguments need to be named, so you
are testing unspecified behaviour. I guess this falls in a similar
category as the note
If some of the values are not vectors of the appropriate length,
you deserve whatever you get!
Experiments for a related Problem Report
(<https://bugs.r-project.org/show_bug.cgi?id=17890>) showed that
packages
2018 May 22
0
remove rows of a matrix by part of its row name
Hello,
Please always cc the list.
As for the question, yes, it does. If you want to remove just the ones
with exactly 73.1 use the pattern
grep("^73\\.1$", etc)
Explanation:
Beginning of string: ^
End of string: $
Escape special characters: \\ (needed because the period is a special
character.)
Hope this helps,
Rui Barradas
On 5/22/2018 12:50 PM, Ahmed Serag wrote:
> Thank
2012 Apr 27
6
Returning the coef from two coordinates
Thank you to everyone in this forum that has been helping me with the basic R
skills while I learn to apply them.
I would like to take the coefficient of two coordinates. One of them comes
from two different columns in a table:
>A
x y
a 1 3
b 2 2
c 3 1
the other is set and for this question I'll just call it (1,1)
I've been trying to find a way to return the