2022 1:37 PM
> To: PIKAL Petr
> Cc: R-help Mailing List
> Subject: Re: [R] data frame returned from sapply but vector expected
>
> On Fri, 4 Nov 2022 15:30:27 +0300
> Ivan Krylov wrote:
>
> > sapply(mylist2, `[[`, 'b')
>
> Wait, that would simplify t
On Fri, 4 Nov 2022 15:30:27 +0300
Ivan Krylov wrote:
> sapply(mylist2, `[[`, 'b')
Wait, that would simplify the return value into a matrix when there are
no NULLs. But lapply(mylist2, `[[`, 'b') should work in both cases,
which in my opinion goes to show the dangers of using simplifying
function
On Fri, 4 Nov 2022 12:19:09 +
PIKAL Petr wrote:
> > str(sapply(mylist2, "[", "b"))
>
> List of 3
>
> $ : NULL
>
> $ :'data.frame': 5 obs. of 1 variable:
>
> ..$ b: num [1:5] 0.01733 0.46055 0.19421 0.11609 0.00789
>
> $ :'data.frame': 5 obs. of 1 variable:
>
> ..$ b:
Hallo all
I found a strange problem for coding if part of list is NULL.
In this case, sapply result is ***list of data frames*** but if there is no
NULL leaf, the result is ***list of vectors***.
I tried simplify option but it did not help me neither I found anything in
help page.
The
Aaaah finally !!! Thanks a lot !!!
Arnaud
Le lun. 26 août 2019 18 h 28, Jim Lemon a écrit :
> Hi Arnaud,
> The reason I wrote the following function is that it always takes me
> half a dozen tries with "reshape" before I get the syntax right:
>
> amdf<-read.table(text="A 10
> B 5
> C
Hi Arnaud,
The reason I wrote the following function is that it always takes me
half a dozen tries with "reshape" before I get the syntax right:
amdf<-read.table(text="A 10
B 5
C 9
A 5
B 15
C 20")
library(prettyR)
stretch_df(amdf,"V1","V2")
V1 V2_1 V2_2
1 A 105
2 B5 15
3
There is some issue with the plain text vs. HTML - please find the answer
again. If illegible kindly see the attached pic.
Best Wishes.
s.
x <- c('A', 'B', 'C', 'A', 'B', 'C')
y <- c(10, 5, 9, 5, 15, 20)
df <- data.frame(x,y)
df
f <- reshape(df, v.names = "y", idvar = "x", timevar = "y", directi
Dear Arnaud,
I just played around with your data a bit and found this to be useful. But
kindly note that I am NO expert like the other people in the group. My answer
to you is purely for help purposes. My knowledge in R too is limited. I used
the reshape function and arrived at something. I am
Hi,
I have a really simple question.
I need to convert a data.frame with the following format
A 10
B 5
C 9
A 5
B 15
C 20
in this format
A 10 5
B 515
C 920
Thanks !!!
[[alternative HTML version deleted]]
__
R-help
iling List
Subject: [R] data frame solution
Hello All,
wonder if you have thoughts on a clever solution for this code:
df <- data.frame(a = c(6,1), b = c(1000,1200), c =c(-1,3))
#the caveat here is that the number of rows for df can be anything from 1 row
to in the hundreds. I kept it
Hello All,
wonder if you have thoughts on a clever solution for this code:
df <- data.frame(a = c(6,1), b = c(1000,1200), c =c(-1,3))
#the caveat here is that the number of rows for df can be anything from 1 row
to in the hundreds. I kept it to 2 to have minimal reproducible
t<-seq(-5
Thanks Bert this will do...
Andras
Sent from Yahoo Mail on Android
On Sun, Jan 6, 2019 at 1:09 PM, Bert Gunter wrote:
... and my reordering of column indices was unnecessary: merge(dat, d, all.y
= TRUE)will do.
Bert Gunter
"The trouble with having an open mind is that people keep comi
... and my reordering of column indices was unnecessary:
merge(dat, d, all.y = TRUE)
will do.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sun, Jan 6, 20
Like this (using base R only)?
dat<-data.frame(id=id,letter=letter,weight=weight) # using your data
ud <- unique(dat$id)
ul = unique(dat$letter)
d <- with(dat,
data.frame(
letter = rep(ul, e = length(ud)),
id = rep(ud, length(ul))
) )
merge(dat[,c(2,1,3)]
Hi!
Maybe this would do the trick:
--- snip ---
library(reshape2) # Use 'reshape2'
library(dplyr)# Use 'dplyr'
datatransfer<-data %>% mutate(letter2=letter) %>%
dcast(id+letter~letter2, value.var="weight")
--- snip ---
Or did I misunderstood something?
Best,
Kimmo
2019-01-06, 13:16
Hello Everyone,
would you be able to assist with some expertise on how to get the following
done in a way that can be applied to a data set with different dimensions and
without all the line items here?
we have:
id<-c(1,1,1,2,2,2,2,3,3,4,4,4,4,5,5,5,5)#length of unique IDs may differ of
cours
859932257 Remove
Good to go now, for the moment, big smile!
Thank you for your help Sir.
WHP
From: Bill Poling
Sent: Thursday, June 14, 2018 6:49 AM
To: 'Jim Lemon'
Cc: r-help (r-help@r-project.org)
Subject: RE: [R] Data frame with Factor column missing data change to NA
#Good
HX recommended savings
Claim paid without PHX recommended savings
MRC Amount
MRC Amount
Appreciate your help Sir.
WHP
From: Jim Lemon [mailto:drjimle...@gmail.com]
Sent: Wednesday, June 13, 2018 8:30 PM
To: Bill Poling
Cc: r-help (r-help@r-project.org)
Subject: Re: [R] Data frame with Fa
Hi Bill,
It may be that the NonAcceptanceOther, being a character value, has ""
(0 length string) rather than NA. You can convert that to NA like
this:
df2$NonAcceptanceOther[nchar(df2$NonAcceptanceOther) == 0]<-NA
Jim
On Thu, Jun 14, 2018 at 12:47 AM, Bill Poling wrote:
> Good morning.
>
> #I
Good morning.
#I have df with a Factor column called "NonAcceptanceOther" that contains
missing data.
#Not every record in the df is expected to have a value in this column.
# Typical values look like:
# ERS
# Claim paid without PHX recommended savings
# Claim paid without PHX recommended savin
thank you both... assumption is in fact that a and b are always the same
length... these work for me well...
much appreciate it...
Andras
On Sunday, August 6, 2017 12:14 PM, Ulrik Stervbo
wrote:
Hi Andreas,
assuming that the increment is always indicated by the same value (in your
exam
Hi Andreas,
assuming that the increment is always indicated by the same value (in your
example 0), this could work:
df$a <- cumsum(seq_along(df$b) %in% which(df$b == 0))
df
HTH,
Ulrik
On Sun, 6 Aug 2017 at 18:06 Bert Gunter wrote:
> Your specification is a bit unclear to me, so I'm not sure t
Your specification is a bit unclear to me, so I'm not sure the below
is really what you want. For example, your example seems to imply that
a and b must be of the same length, but I do not see that your
description requires this. So the following may not be what you want
exactly, but one way to do
Dear All,
wonder if you have thoughts on the following:
let us say we have:
df<-data.frame(a=c(1,2,3,4,5,1,2,3,4,5,6,7,8),b=c(0,1,2,3,4,0,1,2,3,4,5,6,7))
I would like to rewrite values in column name "a" based on values in column
name "b", where based on a certain value of column "b" the ne
You could use transform() instead of [[<- to add columns to your data.frame
so the new columns get transformed they way they do when given to the
data.frame function itself. E.g.,
> dd <- data.frame(X=1:5, Y=11:15)
> str(transform(dd, Z=matrix(X+Y,ncol=1,dimnames=list(NULL, "NewZ"
'data.frame
> On Apr 23, 2016, at 8:59 AM, thomas mann wrote:
>
> I am attempting to add a calculated column to a data frame. Basically,
> adding a column called "newcol2" which are the stock closing prices from 1
> day to the next.
>
> The one little hang up is the name of the column. There seems to be
I am attempting to add a calculated column to a data frame. Basically,
adding a column called "newcol2" which are the stock closing prices from 1
day to the next.
The one little hang up is the name of the column. There seems to be an
additional data column name included in the attributes (dimnam
>
>
> I'm new to R and wants to read XML file as R data frame. Is there any
> package that could be used for this purpose.
>
>
> I will really appreciate your response.
>
>
> Many Thanks and
>
>
> Kind Regards
>
> --
> Muhammad Bilal
>
Hi All,
I'm new to R and wants to read XML file as R data frame. Is there any package
that could be used for this purpose.
I will really appreciate your response.
Many Thanks and
Kind Regards
--
Muhammad Bilal
Research Assistant and PhD Student,
Bristol Enterprise, Researc
Sorry, looked like there were a different number of rows in the results because
the rownames were different. I also see that the OP was interested in any
Groups, not just the two in the example, so your solution probably meets the
requirements better than mine
-
Hi Peter and Jeff!
Thanks very much for your code! Both worked perfectly in my data set!!
All best,
Raoni
2015-10-10 21:40 GMT-03:00 peter dalgaard :
>
>> On 11 Oct 2015, at 02:12 , Jeff Newmiller wrote:
>>
>> Sorry I missed the boat the first time, and while it looks like Peter is
>> getting
> On 11 Oct 2015, at 02:12 , Jeff Newmiller wrote:
>
> Sorry I missed the boat the first time, and while it looks like Peter is
> getting closer I suspect that is not quite there either due to the T2 being
> considered separate from T3 requirement.
Er, what do you mean by that?
As far as I
Sorry I missed the boat the first time, and while it looks like Peter is
getting closer I suspect that is not quite there either due to the T2
being considered separate from T3 requirement.
Here is another stab at it:
library(dplyr)
# first approach is broken apart to show the progression of t
These situations where the desired results depend on the order of observations
in a dataset do tend to get a little tricky (this is one kind of problem that
is easier to handle in a SAS DATA step with its sequential processing
paradigm). I think this will do it:
keep <- function(d)
with(d, {
Hello Jeff!
Thanks very much for your prompt reply, but this is not exactly what I
need. I need the first sequence of records. In example that I send, I
need the first seven lines of group "T2" in ID "1" (lines 3 to 9) and
others six lines of group "T3" in ID "1" (lines 10 to 15). I have to
discar
?aggregate
in base R. Make a short function that returns the first element of a vector and
give that to aggregate.
Or...
library(dplyr)
( test %>% group_by( ID, Group ) %>% summarise( Var=first( Var ) ) %>%
as.data.frame )
---
Hello R-Helpers!
I have a data-frame as below (dput in the end of mail) and need to
select just the first sequence of occurrence of each "Group" in each
"ID".
For example, for ID "1" I have two sequential occurrences of T2 and
two sequential occurrences of T3:
> test [test$ID == 1, ]
ID Group
Here's one way in base R:
df <- data.frame(id=c("A","A","B","B"),
first=c("BX",NA,NA,"LF"),
second=c(NA,"TD","BZ",NA),
third=c(NA,NA,"RB","BT"),
fourth=c("LG","QR",NA,NA))
new_df <- data.frame(do.call(rbind, by(df, df$id, functi
Hello all,
I would like to take a data frame such as the following one:
> df <-
data.frame(id=c("A","A","B","B"),first=c("BX",NA,NA,"LF"),second=c(NA,"TD","BZ",NA),third=c(NA,NA,"RB","BT"),fourth=c("LG","QR",NA,NA))
> df
id first second third fourth
1 ABX LG
2 A TD
Ragia
> Ibrahim
> Sent: Monday, August 10, 2015 6:42 AM
> To: r-help@r-project.org
> Subject: [R] Data frame Q
>
> Dear Group,
> Kindly,
> I have the following
>
> Common_Friends <-
> intersect(node_neighbours_i_out,node_neighbours_j_out)
> class(Co
Dear Group,
Kindly,
I have the following
Common_Friends <- intersect(node_neighbours_i_out,node_neighbours_j_out)
class(Common_Friends)
print(Common_Friends)
#4 = Common_Friends
newline<-c(i, Common_Friends )
df<- rbind(df,newline)
I created a data fra
On 08/12/14 21:18, Ragia Ibrahim wrote:
Hi,
Kindly I had a data frame looks like this
x y
1 3
2 2
3 1
4 3
and I want to add column z that sum cumulativly like this
x y z
1 3 3
2 2 5
3 1 6
4 3 9
how to do this?
(1) Learn to use R. This is very basic; read some introductory
material. Start wi
my.data$z <- cumsum(my.data$y)
Yes, the function you need is even in your message subject.
> On Dec 8, 2014, at 12:18 AM, Ragia Ibrahim wrote:
>
> Hi,
> Kindly I had a data frame looks like this
> x y
> 1 3
> 2 2
> 3 1
> 4 3
> and I want to add column z that sum cumulativly like this
Hello,
If your dataset is named 'dat', try
dat$z <- cumsum(dat$y)
Hope this helps,
Rui Barradas
Em 08-12-2014 08:18, Ragia Ibrahim escreveu:
Hi,
Kindly I had a data frame looks like this
x y
1 3
2 2
3 1
4 3
and I want to add column z that sum cumulativly like this
x y z
1 3 3
2 2 5
3 1 6
4
Hi,
Kindly I had a data frame looks like this
x y
1 3
2 2
3 1
4 3
and I want to add column z that sum cumulativly like this
x y z
1 3 3
2 2 5
3 1 6
4 3 9
how to do this?
Regards
Ragia
[[alternative HTML version deleted]]
___
Thanks Richard!
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-gu
Frank,
Dates are extremely difficult. I recommend you do not attempt to do
your own data computations with paste().
Use the lubridate package.
> install.packages(lubridate)
> library(lubridate)
Read the end section of
> vignette("lubridate")
>From that you will most likely be wanting one of thes
Hi to all members of the list,
I have a data frame with subjects who can get into a certain study from
2010-01-01 onwards. Small example:
DF <- data.frame(id=as.factor(1:3), born=as.Date(c("1939/10/28", "1946/02/23",
"1948/02/29")))
id born
1 1 1939-10-28
2 2 1946-02-23
3 3 1948
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Pat Jackson
> Sent: Thursday, July 03, 2014 7:46 AM
> To: r-help@r-project.org
> Subject: [R] Data frame with unequal lines per case
>
> Dear R Help list,
>
Dear R Help list,
I have data in a comma delimited format with an unequal number of lines
per case, ranging from 1 to 5. Each line contains that individual's rating of
a televised conference they observed. I'm interested in the influence of group
size on ratings.
My questions: how
On Jun 27, 2014, at 5:53 AM, Robert Sherry wrote:
Suppose that a data frame has been created by the user. Perhaps it
has been
created using the library quantmod. Is there any command to find out
what
the members of the data frame is?
Most of the objects created by quantmod functions are n
I'm not sure what you mean by members.
Some options:
colnames(yourdf)
str(yourdf)
summary(yourdf)
You would probably benefit from reading the Intro to R that came with
your R installation.
Sarah
On Fri, Jun 27, 2014 at 8:53 AM, Robert Sherry wrote:
> Suppose that a data frame has been created
Suppose that a data frame has been created by the user. Perhaps it has been
created using the library quantmod. Is there any command to find out what
the members of the data frame is?
Thanks
Bob
__
R-help@r-project.org mailing list
https://stat.ethz.ch
Hi,
May be this helps:
dat1 <- as.data.frame(matrix(1:(640*5), ncol=5,byrow=TRUE))
set.seed(41)
indx <-sample(nrow(dat1),nrow(dat1),replace=FALSE)
lst1 <- lapply(split(indx,as.numeric(gl(640,64,640))),function(x) dat1[x,])
A.K.
Dear all,
I have a data frame (d) composed of 640 observations fo
m all to a common type (often character), so it may give
you the wrong result in addition to being unnecessarily slow.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf
Of Duncan Murdoch
Sent: Sunda
On 2014-03-17 01:31, Jeff Newmiller wrote:
Did you really intend to make all of the x values the same?
Not at all; the code in the loop was in fact just nonsense. The point
was to illustrate the huge difference in execution time. And that the
relative difference seems to increase fast with th
On 2014-03-16 23:56, Duncan Murdoch wrote:
On 14-03-16 2:57 PM, Göran Broström wrote:
I have always known that "matrices are faster than data frames", for
instance this function:
dumkoll <- function(n = 1000, df = TRUE){
dfr <- data.frame(x = rnorm(n), y = rnorm(n))
if (df){
Did you really intend to make all of the x values the same? If so, try one line
instead of the for loop:
dfr$x[ 2:n ] <- dfr$x[ 1 ]
If that was merely an error in your example, then you could use a different
one-liner:
dfr$x[ 2:n ] <- dfr$x[ seq.int( n-1 ) ]
In either case, the speedup is con
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Duncan Murdoch
> Sent: Sunday, March 16, 2014 3:56 PM
> To: Göran Broström; r-help@r-project.org
> Subject: Re: [R] data frame v
On 14-03-16 2:57 PM, Göran Broström wrote:
I have always known that "matrices are faster than data frames", for
instance this function:
dumkoll <- function(n = 1000, df = TRUE){
dfr <- data.frame(x = rnorm(n), y = rnorm(n))
if (df){
for (i in 2:NROW(dfr)){
if
Hello,
This is to be expected. Matrices can hold only one type of data so the
problem is solved once and for all, data frames can have many types of
data so the code to handle them must determine which type to handle on
every access.
Hope this helps,
Rui Barradas
Em 16-03-2014 18:57, Göran
I have always known that "matrices are faster than data frames", for
instance this function:
dumkoll <- function(n = 1000, df = TRUE){
dfr <- data.frame(x = rnorm(n), y = rnorm(n))
if (df){
for (i in 2:NROW(dfr)){
if (!(i %% 100)) cat("i = ", i, "\n")
dfr
On 3/7/2014 7:41 PM, Keith S Weintraub wrote:
Folks,
I have a data frame as follows:
foo<-structure(list(name = c("A", "B", "C"), num = c(3L, 2L, 1L)), .Names =
c("name",
"num"), row.names = c(NA, -3L), class = "data.frame")
str(foo)
'data.frame': 3 obs. of 2 variables:
$ name: chr
Arun et al.
Thanks,
This is exactly what I need.
All the best,
KW
--
On Mar 7, 2014, at 10:59 PM, arun wrote:
> Try:
> oof1 <- list()
> oof1[foo$name] <- foo$num
> A.K.
>
>
>
>
> On Friday, March 7, 2014 10:43 PM, Keith S Weintraub wrote:
> Folks,
>
> I have a data frame as follows:
>
Try:
oof1 <- list()
oof1[foo$name] <- foo$num
A.K.
On Friday, March 7, 2014 10:43 PM, Keith S Weintraub wrote:
Folks,
I have a data frame as follows:
> foo<-structure(list(name = c("A", "B", "C"), num = c(3L, 2L, 1L)), .Names =
> c("name",
"num"), row.names = c(NA, -3L), class = "data.fra
> oof <- as.list(foo$num)
> names(oof) <- foo$name
> oof
On Fri, Mar 7, 2014 at 10:41 PM, Keith S Weintraub wrote:
> Folks,
>
> I have a data frame as follows:
>
>> foo<-structure(list(name = c("A", "B", "C"), num = c(3L, 2L, 1L)), .Names =
>> c("name",
> "num"), row.names = c(NA, -3L), class =
Folks,
I have a data frame as follows:
> foo<-structure(list(name = c("A", "B", "C"), num = c(3L, 2L, 1L)), .Names =
> c("name",
"num"), row.names = c(NA, -3L), class = "data.frame")
> str(foo)
'data.frame': 3 obs. of 2 variables:
$ name: chr "A" "B" "C"
$ num : int 3 2 1
> foo
name
Depending what you really want to achieve, the following may be useful or
educational:
dat$ID2x <- with( dat, ave( rep( 1, nrow( dat ) ), ID, USE, FUN=cumsum ) )
dat$ID2y <- dat$ID2x
dat$ID2y[ dat$USE != "001" ] <- NA
On Thu, 20 Feb 2014, arun wrote:
Hi,
Try:
dat$ID2 <- with(dat,ave(seq_along
Hi,
Try:
dat$ID2 <- with(dat,ave(seq_along(USE),ID,FUN=function(x){x1 <- USE[x] =='001';
ifelse(!x1,'',cumsum(x1))}))
A.K.
On Thursday, February 20, 2014 3:31 PM, Pedro Mardones
wrote:
Dear R community;
I'm kind of stuck with the following situation and would appreciate any
hint. Let's assu
Dear R community;
I'm kind of stuck with the following situation and would appreciate any
hint. Let's assume I have the following data frame:
dat <- data.frame(ID = c(rep("01",18), rep("02",16)), USE = c(c("001","004",
"005","007","001","004","005","007","012","001","004","005","007","001","004",
Hi Andras,
here is an other solution which also works if b contains missing values:
a <-seq(0,10,by=1)
b <-c(NA, 11:20)
f <-16
#
a[which.max(b[b If it's not homework, then I'm happy to provide more help:
>
>
> a <-seq(0,10,by=1)
> b <-c(10:20)
> d <-data.frame(a=a,b=b)
> f <-16
>
> subset(d, b <
If it's not homework, then I'm happy to provide more help:
a <-seq(0,10,by=1)
b <-c(10:20)
d <-data.frame(a=a,b=b)
f <-16
subset(d, b < f & b == max(b[b < f]))$a
# I'd turn it into a function
getVal <- function(d, f) {
subset(d, b < f & b == max(b[b < f]))$a
}
Sarah
On Mon, Dec 9, 2013
Thank you for providing a reproducible example. I tweaked it a little
bit to make it actually a data frame problem.
There are lots of ways to do this; here's one approach.
On second thought, this looks a lot like homework, so perhaps instead
I'll just suggest using subset() with more than one con
Dear All
please help with the following:
I have:
a <-seq(0,10,by=1)
b <-c(10:20)
d <-cbind(a,b)
f <-16
I would like to select the value in column a based on a value in column b,
where the value in column b is the 1st value that is smaller then f. Thus I
should end up with the number 5 because
Hi Jonathan,If you look at the str()
str(res)
'data.frame': 2 obs. of 4 variables:
$ gene : chr "gene1" "gene2"
$ case_1:List of 2
..$ : chr "nsyn" "amp"
..$ : chr
$ case_2:List of 2
..$ : chr "del"
..$ : chr
$ case_3:List of 2
..$ : chr
..$ : chr "UTR"
In this case,
c
Hi Arun,
That seemed to do the trick - thanks!!
Jonathan
On Wed, Oct 23, 2013 at 11:12 PM, arun wrote:
> HI,
>
> Better would be:
> res1 <- dcast(df,gene~case,value.var="issue",paste,collapse=",",fill="0")
>
> str(res1)
> #'data.frame':2 obs. of 4 variables:
> # $ gene : chr "gene1"
HI,
Better would be:
res1 <- dcast(df,gene~case,value.var="issue",paste,collapse=",",fill="0")
str(res1)
#'data.frame': 2 obs. of 4 variables:
# $ gene : chr "gene1" "gene2"
# $ case_1: chr "nsyn,amp" "0"
# $ case_2: chr "del" "0"
# $ case_3: chr "0" "UTR"
write.table(res1,"test.txt",
Hi Arun,
Your suggestion using dcast is simple and worked splendidly!
Unfortunately, the resulting data frame does not play nicely with
write.table.
Any idea how to could print this out to a tab-delimited text file, perhaps
substituting zeros in for the empty cells?
See the error below:
> wri
HI,
You may try:
library(reshape2)
df <-
data.frame(case=c("case_1","case_1","case_2","case_3"),
gene=c("gene1","gene1","gene1","gene2"), issue=c("nsyn","amp","del","UTR"),
stringsAsFactors=FALSE)
res <- dcast(df,gene~case,value.var="issue",list)
res
# gene case_1 case_2 case_3
#1 gene1 ns
On Oct 23, 2013, at 5:24 PM, David Winsemius wrote:
>
> On Oct 23, 2013, at 4:36 PM, Jon BR wrote:
>
>> Hello,
>> I've been running several programs in the unix shell, and it's time to
>> combine results from several different pipelines. I've been writing shell
>> scripts with heavy use of a
On Oct 23, 2013, at 4:36 PM, Jon BR wrote:
> Hello,
>I've been running several programs in the unix shell, and it's time to
> combine results from several different pipelines. I've been writing shell
> scripts with heavy use of awk and grep to make big text files, but I'm
> thinking it would
Hello,
I've been running several programs in the unix shell, and it's time to
combine results from several different pipelines. I've been writing shell
scripts with heavy use of awk and grep to make big text files, but I'm
thinking it would be better to have all my data in one big structure in
Hi,
I just got started with R. I am trying to load some data into PostgreSQL
using RPostgreSQL. Everything went quite smoothly except for that the table
created by using dbWriteTable does not have a primary key.
The ideal solution is to ask PostgreSQL to do a auto-increment with the
rows I am goin
Hello,
I am trying to write the default "OrchardSprays" R data frame into HDFS
using the "rhdfs" package. I want to write this data frame directly into
HDFS without first storing it into any file in local file system.
Which rhdfs command i should use? Can some one help me? I
Hi,
Try:
datNew <- read.table(text=as.character(mydata$NATIONALITY),sep="_")
mydata2 <- within(mydata,{NATIONALITY <- as.character(datNew[,1]);YEAR <-
datNew[,2]})
head(mydata2)
# PROVINCE AGE5 ZONA91OK NATIONALITY FREQUENCY YEAR
#1 1 10-14 101 SPAIN 600 1998
#
Hi,
Try:
datNew <- read.table(text=as.character(mydata$NATIONALITY),sep="_")
mydata2 <- within(mydata,{NATIONALITY <- as.character(datNew[,1]);YEAR <-
datNew[,2]})
head(mydata2)
# PROVINCE AGE5 ZONA91OK NATIONALITY FREQUENCY YEAR
#1 1 10-14 101 SPAIN 600 1998
#501
Thank you mate!
--
View this message in context:
http://r.789695.n4.nabble.com/Data-frame-to-Matrix-by-category-tp4669669p4669768.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/
Hello,
Maybe something like the following.
dat <- read.table(text = "
isin dt
1 FR0109970386 2010-01-12
2 FR0109970386 2011-01-12
3 FR0109970386 2012-01-12
4 FR0116114978 2010-01-12
5 FR0116114978 2011-01-12
6 FR0116114978 2012-01-12
", header = TRUE, stringsAsFactors = FALSE)
Hello Folks,
I try to use plyr and reshape 2 to take a data frame of the form:
> head(cf_dt)
isin dt
1 FR0109970386 2010-01-12
2 FR0109970386 2011-01-12
3 FR0109970386 2012-01-12
4 FR0116114978 2010-01-12
5 FR0116114978 2011-01-12
6 FR0116114978 2012-01-12
to create a matrix o
Hi,
ab<- cbind(a,b)
indx<-duplicated(names(ab))|duplicated(names(ab),fromLast=TRUE)
res1<-cbind(ab[!indx],v2=rowSums(ab[indx]))
res1[,order(as.numeric(gsub("[A-Za-z]","",names(res1,]
#v1 v2 v3
#1 3 4 5
#Another example:
a2<- data.frame(v1=c(3,6,7),v2=c(2,4,8))
b2<- data.frame(v2=c(2,6,7
oss
To: r-help@r-project.org
Cc:
Sent: Monday, April 1, 2013 11:54 AM
Subject: [R] Data frame question
Hello,
I have 2 data frames: activity and dates. Activity contains a l variable
listing all activities: activityA, activityB etc.
The dates contain all the valid business dates. I
That sounds like a job for merge().
If you provide an actual reproducible example using dput(), then you
will likely get some actual runnable code.
Sarah
On Mon, Apr 1, 2013 at 11:54 AM, ramoss wrote:
> Hello,
>
> I have 2 data frames: activity and dates. Activity contains a l variable
> list
Hello,
I have 2 data frames: activity and dates. Activity contains a l variable
listing all activities: activityA, activityB etc.
The dates contain all the valid business dates. I need to combine the 2 so
that I get a single data frame activitydat that contains the activity name
along w/ evevr
Yes, it works.
Thank very much you Rui.
Franck Berthuit
France
De :Rui Barradas
A : franck.berth...@maif.fr,
Cc :r-help@r-project.org
Date : 25/02/2013 15:10
Objet : Re: [R] Data frame as table
Hello,
If your data.frame is named 'dat', the following might be wha
Hello,
If your data.frame is named 'dat', the following might be what you want.
as.table(data.matrix(dat))
Hope this helps,
Rui Barradas
Em 25-02-2013 11:35, franck.berth...@maif.fr escreveu:
Hello R user's,
I've read a txt file with the read.table syntax. This file is already in a
form of
Hello R user's,
I've read a txt file with the read.table syntax. This file is already in a
form of a contingency table (130 rows, 90 columns) with wich i would like
to do a simple correspondance analysis with the ca() syntax.
Are there a way to do an as.table(my data.frame) transformation ? Or a
lit(gsub("^\\D+(\\d+)\\D+(\\d+).*","\\1
> \\2",fileN)," ")))[2]
> dat1
> A.K.
>
>
>
> - Original Message -
> From: jgui001
> To: r-help@r-project.org
> Cc:
> Sent: Wednesday, November 28, 2012 4:33 AM
> Subje
c(unlist(strsplit(gsub("^\\D+(\\d+)\\D+(\\d+).*","\\1
\\2",fileN)," ")))[2]
dat1
A.K.
- Original Message -
From: jgui001
To: r-help@r-project.org
Cc:
Sent: Wednesday, November 28, 2012 4:33 AM
Subject: [R] data frame: adding columns from data and file title
Data
Hello,
First of all, the best way of posting data examples is ?dput. Anyway,
try the following.
dat <- read.table(text="
Date_ Time_ Speed Course Type_ Distance
30/03/2012 11:15:05 108 121 -2 0
30/03/2012 11:15:060 79 0 0
30/03/2012 11:15:070 76 0 1
30/03/2012 11:15
Data processing”
I have a large number of csv files from animal tracks that look like this:
Date_ Time_
Speed
Course Type_ Distance
30/03/2
1 - 100 of 430 matches
Mail list logo