On Jun 10, 2015, at 5:39 AM, Liz Hare wrote:
> Hi R-Experts,
>
> I have a data.frame like this:
>
>> head(map)
> chr snp poscm posbpdist
> 1 1 M1 2.99043 3249189 NA
> 2 1 M2 3.06457 3273096 0.07414
> 3 1 M3 3.17018 3307151 0.10561
> 4 1 M4 3.20892 3319643 0.03874
> 5
On Jun 10, 2015, at 12:18 PM, David Winsemius wrote:
>
> On Jun 10, 2015, at 5:39 AM, Liz Hare wrote:
>
>> Hi R-Experts,
>>
>> I have a data.frame like this:
>>
>>> head(map)
>> chr snp poscm posbpdist
>> 1 1 M1 2.99043 3249189 NA
>> 2 1 M2 3.06457 3273096 0.07414
>> 3 1
> On Jun 10, 2015, at 2:21 PM, Marc Schwartz wrote:
>
>
>> On Jun 10, 2015, at 7:39 AM, Liz Hare wrote:
>>
>> Hi R-Experts,
>>
>> I have a data.frame like this:
>>
>>> head(map)
>> chr snp poscm posbpdist
>> 1 1 M1 2.99043 3249189 NA
>> 2 1 M2 3.06457 3273096 0.07414
>> 3
> On Jun 10, 2015, at 7:39 AM, Liz Hare wrote:
>
> Hi R-Experts,
>
> I have a data.frame like this:
>
>> head(map)
> chr snp poscm posbpdist
> 1 1 M1 2.99043 3249189 NA
> 2 1 M2 3.06457 3273096 0.07414
> 3 1 M3 3.17018 3307151 0.10561
> 4 1 M4 3.20892 3319643 0.03874
Hi R-Experts,
I have a data.frame like this:
> head(map)
chr snp poscm posbpdist
1 1 M1 2.99043 3249189 NA
2 1 M2 3.06457 3273096 0.07414
3 1 M3 3.17018 3307151 0.10561
4 1 M4 3.20892 3319643 0.03874
5 1 M5 3.28120 3342947 0.07228
6 1 M6 3.29624 3347798 0.01504
I
Hello,
Like Ivan said, use read.table to read in the data and then, to select
only some of the columns you can use several ways.
data_30min <- read.table(text = "
1 19710629 08(PARTIAL) 39.3 at interval beginning 19701126 010326
2 19720629 08(PARTIAL) 33.8 at interval be
What about read.table()?
--
Ivan CALANDRA
Université de Bourgogne
UMR CNRS/uB 6282 Biogéosciences
6 Boulevard Gabriel
21000 Dijon, FRANCE
+33(0)3.80.39.63.06
ivan.calan...@u-bourgogne.fr
http://biogeosciences.u-bourgogne.fr/calandra
Le 12/03/13 10:03, Roslina Zakaria a écrit :
Dear r-users,
Dear r-users,
Originally my data is in notepad. I use data.frame(...) to convert the data
into columns but it has no header. The data below is what I got in R. I would
like to extract these data:
19710629 39.3 19701126
19720629 33.8 19720517
...
when I use data2_30min[1,
P
#3 o3 2 G
#4 nox 0 P
#5 pm25 01 S
#6 co 03 S
#7 nox 04 P
A.K.
- Original Message -
From: Rui Barradas
To: Zlatan
Cc: r-help@r-project.org
Sent: Saturday, November 17, 2012 10:22 AM
Subject: Re: [R] Split data frame and create a new column
H
Hello,
I don't know if this is general purpose but try
x <- scan(what = "character", text="
L1o3maxG10
L1o3P10
L2o3G10
noxP10
pm25S_01
comeanS_03
noxP_04")
fun <- function(x){
r1 <- unlist(strsplit(x, "L[[:digit:]]+|G|P|S"))
r1 <- r1[nchar(r1) != 0]
r1 <- r1[rep(c(TRUE, FALSE), len
I need to split a data frame into 3 columns. The column I want to split
contains indices of lag (prefix L1 or L2 and suffix 01, 03, 04), station
name (shown in the sample data as capitalized G, P and S) and pollutant
name. Names with no “L” prefix or 01/04 suffix are lag 0. Lag 01 is average
of lag
I suspect, but have not tested, that your src$date element has class
"POSIXlt", which is internally a list, in which case splitting by it might
not work properly, and might be the cause of your out of bounds error
message.
One of these might do the job:
src$date <- format(strptime(tickdata$da
You could try using the numeric representation of date, and split the data
frame using that variable. For example:
src$date.num <- as.numeric(src$date)
Jean
Franc Lucas wrote on 08/24/2011 02:42:58 PM:
>
>Hello everyone,
>I want to split a data.frame by the column date . The data fram
Hello everyone,
I want to split a data.frame by the column date . The data frame looks like
this
date time openclose
02.01.201109:00:00 1000 1200
02.01.201109:05:02 1200 1203
...
01.02.2011
My recommendation would be to not "subset out" the data, because you are
introducing a potential source of error when binding the new data back
together with the old data. Preferably, I would work on selecting subsets of
the dataset using indices (as suggested in the previous post) and just do
the
On 2011-07-24 10:07, ivo welch wrote:
dear R wizards: I have a large data frame, a million rows, 40
columns. In this data frame, there are some (about 100,000) rows
which I want to recompute (update), while I want to leave others just
as is. this is based on a condition that I need to compute,
dear R wizards: I have a large data frame, a million rows, 40
columns. In this data frame, there are some (about 100,000) rows
which I want to recompute (update), while I want to leave others just
as is. this is based on a condition that I need to compute, based on
what is in a few of the column
On 26.05.2011 12:01, Mathew Brown wrote:
Hello,
I would like to split the attached data frame based on the DATE
variable. I'm having a real problem doing this. I am able to split
iso<-read.table(datuh.dat, header=TRUE, sep="", dec=".") #load
mylist=split(iso,iso$DATE) #split
str(mylist) #resu
Hello,
I would like to split the attached data frame based on the DATE
variable. I'm having a real problem doing this. I am able to split
iso<-read.table(datuh.dat, header=TRUE, sep="", dec=".") #load
mylist=split(iso,iso$DATE) #split
str(mylist) #result seems a bit odd
However, after splitt
sorry, the problem has been solved.
On Mon, Apr 25, 2011 at 11:28 PM, ivan wrote:
> Dear Community,
>
> I have a dataframe like this one:
>
> A B
> 5 1
> 6 1
> 7 1
> 8 1
> 9 2
> 10 2
> 11 2
> 12 2
>
> I have a problem splitting up the above data
Dear Community,
I have a dataframe like this one:
A B
5 1
6 1
7 1
8 1
9 2
10 2
11 2
12 2
I have a problem splitting up the above data frame in respect to the
factor represented by B, whereas the resulting vector should contain
the numeric values
Try this:
split(as.data.frame(DF), is.na(DF$x))
On Fri, Oct 15, 2010 at 9:45 AM, Jumlong Vongprasert wrote:
> Dear all
> I have data like this:
> x y
> [1,] 59.74889 3.1317081
> [2,] 38.77629 1.7102589
> [3,] NA 2.2312962
> [4,] 32.35268 1.3889621
> [5,] 74
Hi
r-help-boun...@r-project.org napsal dne 15.10.2010 15:00:46:
> you can do the following:
>
> mat <- cbind(x = runif(15, 50, 70), y = rnorm(15, 2))
> mat[sample(15, 2), "x"] <- NA
>
> na.x <- is.na(mat[, 1])
> mat[na.x, ]
> mat[!na.x, ]
Or if you have missing data in several columns and you
Try this:
> a <- read.table(textConnection(" x y
+ 59.74889 3.1317081
+ 38.77629 1.7102589
+NA 2.2312962
+ 32.35268 1.3889621
+ 74.01394 1.5361227
+ 34.82584 1.1665412
+ 42.72262 2.7870875
+ 70.54999 3.3917257
+ 59.37573 2.6763249
+ 68.87422 1.96977
you can do the following:
mat <- cbind(x = runif(15, 50, 70), y = rnorm(15, 2))
mat[sample(15, 2), "x"] <- NA
na.x <- is.na(mat[, 1])
mat[na.x, ]
mat[!na.x, ]
I hope it helps.
Best,
Dimitris
On 10/15/2010 2:45 PM, Jumlong Vongprasert wrote:
Dear all
I have data like this:
x
Dear all
I have data like this:
x y
[1,] 59.74889 3.1317081
[2,] 38.77629 1.7102589
[3,] NA 2.2312962
[4,] 32.35268 1.3889621
[5,] 74.01394 1.5361227
[6,] 34.82584 1.1665412
[7,] 42.72262 2.7870875
[8,] 70.54999 3.3917257
[9,] 59.37573 2.67632
Ali -
A reproducible example would be very helpful, but I'll
try to guess what you mean.
mydat = data.frame(year=rep(2008:2010,each=5),var=1:15)
sdat = split(mydat$var,mydat$year)
do.call(cbind,sdat)
2008 2009 2010
[1,]16 11
[2,]27 12
[3,]38 13
[4,]4
I used split() to split a variable by 3 years, but am wondering how to call up
that split data and use it in further analyses. Can I make separate columns for
the 3 resulting year groups?
[[alternative HTML version deleted]]
__
R-help
Does anything speak against selecting only x where x$B<20 and then splitting
it by x$C?
split(x[!x$B<20,],x$C)
HTH,
Daniel
--
View this message in context:
http://r.789695.n4.nabble.com/Split-data-frame-by-conditional-and-column-at-the-same-time-tp2197908p2216072.html
Sent from the R help ma
2
9 c95
13c23
14c54
Cheers!
Kushantha
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Chris Arthur
Sent: Monday, May 18, 2009 4:54 PM
To: r-help@r-project.org
Subject: [R] Split data frame based on
?split
new.df <- split(old.df, old.df$Class)
will create a list of dataframes split by Class
On Mon, May 18, 2009 at 7:23 AM, Chris Arthur wrote:
> Each row of my data frame is assigned to a class (eg country). Can you
> suggest how I break apart the data frame so that I create new data frames
Each row of my data frame is assigned to a class (eg country). Can you
suggest how I break apart the data frame so that I create new data
frames for each class
eg
If Class = "US" put in new dataframe dataUS
Thanks in advance for your help
Chris
__
Try this:
split(iris, factor(a, levels = 1:3))
On Mon, Oct 13, 2008 at 1:06 PM, Jay <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'll use part of the iris dataset for an example of what I want to
> do.
>
>> data(iris)
>> iris<-iris[1:10,1:4]
>> iris
> Sepal.Length Sepal.Width Petal.Length Petal.Widt
Thanks so much.
On Oct 13, 1:14 pm, "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote:
> Try this:
>
> a<-factor(c(3, 3, 3, 2, 3, 2, 2, 3, 2, 3), levels = 1:3)
> split(iris, a)
>
> lapply(split(iris, a), dim)
>
>
>
> On Mon, Oct 13, 2008 at 2:06 PM, Jay <[EMAIL PROTECTED]> wrote:
> > Hello,
>
> > I
Try this:
a<-factor(c(3, 3, 3, 2, 3, 2, 2, 3, 2, 3), levels = 1:3)
split(iris, a)
lapply(split(iris, a), dim)
On Mon, Oct 13, 2008 at 2:06 PM, Jay <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'll use part of the iris dataset for an example of what I want to
> do.
>
> > data(iris)
> > iris<-iris[1:
Hello,
I'll use part of the iris dataset for an example of what I want to
do.
> data(iris)
> iris<-iris[1:10,1:4]
> iris
Sepal.Length Sepal.Width Petal.Length Petal.Width
1 5.1 3.5 1.4 0.2
2 4.9 3.0 1.4 0.2
3 4.7
36 matches
Mail list logo