[R] Assign value to a row in dataframe

2015-01-20 Thread zuzana zajkova
Hi, I have probably basic question, but I would be happy if somebody could help me with this: I have a dataframe where I want to assign a value to other column copying the value in previous row under some condition. Here is an example (dput on the end of message): > test[278:290,]

Re: [R] Assign value to a row in dataframe

2015-01-21 Thread zuzana zajkova
; and then set it equal to "state_new" at the end of each step. > > It may be possible to do this as you were attempting above using > something like "rle", but I think it will be difficult. > > Jim > > > On Wed, Jan 21, 2015 at 9:14 AM, zuzana zajkova wro

Re: [R] Assign value to a row in dataframe

2015-01-21 Thread zuzana zajkova
b > 12 290 2011-11-19 08:56:54 a b a > 13 291 2011-11-19 09:19:39 b a b > > > > which results in desired solution. > > Cheers > Petr > > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-proj

[R] Heatmap - strange horizontal lines

2014-10-23 Thread zuzana zajkova
Dear list, I would like to make heatmaps from my data. Acctualy, I have already done it, but the issue it that is doesn't work well for all files. All files have the same structure, after importing them I do few calculations using the same script, to obtain variables for plotting. You can find t

[R] Max value of each 2 rows in dataframe

2013-02-12 Thread zuzana zajkova
Hello, I would like to ask you for help. I have quite a big dataframe (119 313 rows), this is a part of it: "jul" "ind" "time" "secs" "geo" "act" "lig" "date.x" "clock" "h" "m" "s" "d" "mo" "y" "dtime" "land" "date.y" "sriseIC" "ssetIC" "dssetIC" "dsriseIC" "1207" 14628 5500519 2010-01-19 15:14:5

Re: [R] Max value of each 2 rows in dataframe

2013-02-12 Thread zuzana zajkova
"20:13", "20:14", "20:15", "20:16", "20:23", "20:29", "20:30", "20:34", "20:35", "20:36", "20:38", "20:40", "20:42", "20:43", "20:44", "20:45&quo

Re: [R] Max value of each 2 rows in dataframe

2013-02-13 Thread zuzana zajkova
16001 5500519 > #20 ok 2010-01-15 06:19:59 40193.51 64 17016001 5500519 > > #If you need a rolling max, > library(zoo) > rollapply(A$lig,2,max,align="right",fill=NA) > #[1] NA 64 64 44 32 22 13 4 8 8 0 45 64 64 64 64 64 64 51 64 > > > A.K. > > >

[R] Double condition

2013-03-22 Thread zuzana zajkova
Hi, I would appreciate if somebody could help me with this small issue... I have a dataframe like this (originaly has more than 100 000 rows): > subz jultimedtime fixddawnddusk day 101608 15006 2011-02-01 19:14:49 19.24694 noon 7.916667 19.88333 1 1

Re: [R] Double condition

2013-03-25 Thread zuzana zajkova
:06", "20:07", "20:08", "20:09", "20:10", "20:11", "20:13", "20:15", "20:20", "20:25", "20:26", "20:29", "20:30", "20:31", "20:35", "20:36&qu

[R] Double condition

2013-03-25 Thread zuzana zajkova
(idx[length(idx)] == nrow(subz)) idx <- idx[-length(idx)] > subz$day[idx + 1] <- subz$day[idx] > > > Hope this helps, > > Rui Barradas > > Em 22-03-2013 18:18, zuzana zajkova escreveu: > >> Hi, >> >> I would appreciate if somebody could help me with

Re: [R] Double condition

2013-03-25 Thread zuzana zajkova
== "midnight") > x$day[i2] <- x$day[i1] > x}) > names(tmp) <- NULL > result <- do.call(rbind, tmp) > > > > Hope this helps, > > Rui Barradas > > Em 25-03-2013 14:15, zuzana zajkova escreveu: > >> Hi Rui, >> &g

[R] Dotchart per groups

2013-04-11 Thread zuzana zajkova
Hi all, I would like to ask you for help. I did a dotplot - using dotchart function. There are two localites (loc) with values 75 or 56 in my data ZZ. The f column has 4 levels: P1, S1, S8, R6. The dataframe is ordered by N value, pchloc value is assign to use "pch" in plot. > head(ZZ) loc f

[R] Fwd: Dotchart per groups

2013-04-15 Thread zuzana zajkova
Hi all, I would like to ask you for advice. I did a dotplot - using dotchart function. There are two localites (loc) with values 75 or 56 in my data ZZ. The f column has 4 levels: P1, S1, S8, R6. The dataframe is ordered by N value, pchloc value is assign to use "pch" in plot. > head(ZZ) loc

[R] Counting number of consecutive occurrences per rows

2013-04-29 Thread zuzana zajkova
Hi, I would appreciate if somebody could help me with following calculation. I have a dataframe, by 10 minutes time, for mostly one year data. This is small example: > dput(test) structure(list(jul = structure(c(14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 1

Re: [R] Counting number of consecutive occurrences per rows

2013-05-03 Thread zuzana zajkova
pril 2013 14:35, PIKAL Petr wrote: > Hi > > rrr<-rle(as.numeric(cut(test$act, c(0,1,199,200), include.lowest=T))) > test$res <- rep(rrr$lengths, rrr$lengths) > > If you put it in function > > fff<- function(x, limits=c(0,1,199,200)) { > rrr<-rle(as.numeric(cut(x,

[R] Fwd: problem importing apparently common txt files

2014-05-22 Thread zuzana zajkova
Dear list, I would like to import into R studio txt files coming from Adobe photoshop. These files contain different measures. The files are apparently common txt files with columns separate by tab. However with common function read.table the import process doesn't work and weird symbols appear o

Re: [R] Fwd: problem importing apparently common txt files

2014-05-22 Thread zuzana zajkova
Ángulo : num -90 90.3 NA -89.7 -90 ... > $ Área : num NA NA 551 NA NA ... > $ Altura : num NA NA 16.7 NA NA ... > $ Anchura : num NA NA 52.5 NA NA ... > > > > A.K. > > > On Thursday, May 22, 2014 9:11 AM, zuzana zajkova > wrote: > Dear list, > > I