Re: [R] Fill NA values in columns with values of another column

2024-08-28 Thread Petr Pikal
Hallo Francesca If you had an object with correct setting, something like template > dput(res) structure(list(V1 = c("1", "2", "3", "4", "5", "6", "7", "8"), V2 = c(2, 7, 10, 4, 9, 5, 2, 6)), class = "data.frame", row.names = c("1", "2", "3", "4", "5", "6", "7", "8")) you could merge it with

Re: [R] Force conversion of (POSIXct) time zone with base R

2024-08-22 Thread Petr Pikal
Hi what about now <- Sys.time() now [1] "2024-08-22 11:24:23 CEST" now.utc <- as.POSIXct(now, tz = "UTC")+2*3600 now.utc [1] "2024-08-22 11:24:23 UTC" Cheers. Petr čt 22. 8. 2024 v 11:00 odesílatel Iago Giné Vázquez napsal: > Hi, > > How should POSIXct time zone be changed without modifying

Re: [R] Synthetic Control Method

2024-04-16 Thread Petr Pikal
Hallo Nadja Similar as Bert I do not know how the function works. From the help page - synth.data - is used in example. Check if your data structure is consistent with synth.data by comparing str(synth.data) and str( INVESTMENTVOLUME). Names of columns should be in both cases match the names in da

Re: [R] Network issue

2024-02-21 Thread Petr Pikal
Hallo James Just a wild guess, are your problems connected with change of default download method from wininet to libcurl? Cheers Petr út 20. 2. 2024 v 18:24 odesílatel James Powell napsal: > [[alternative HTML version deleted]] __ R-help@r

Re: [R] help, please! matrix operations inside 3 nested loops

2012-08-09 Thread Petr PIKAL
Hi > all problems solved. thank you for your help! > for the sake of completeness, here my solution: > #1) read in data: > daten<-read.table('K:/Analysen/STRUCTURE/test.txt', header=TRUE, sep="\t") > daten<-as.data.frame(daten) not needed, daten is already data frame

Re: [R] help, please! matrix operations inside 3 nested loops

2012-08-09 Thread Petr PIKAL
indxind[z2,z1]<-topf > } > #print(c(s,z1,z2,indxind[1,2])) ##counts s, z1 and z2 properly, but > gives always 8 for indxind[1,2] > } > #indxind[1:5,1:5] #empty matrix > } > #indxind[1:5,1:5] #empty matrix > } > > #4) check:

Re: [R] NADA Package: Referencing Data Frame Columns

2012-08-09 Thread Petr PIKAL
Hi > > > Specifically, since it has only a single detection indicator column > > (ceneq1), it implies that within any single sample either all the analytes > > were detected, or all were not. Not what I would expect. > > Don, > >I have been thinking about this and wondered whether the cast

Re: [R] help to program my function

2012-08-09 Thread Petr PIKAL
I am not allowed to connect to Nabble from work, sorry. Petr > > hi peter the pdf folder is in > http://r.789695.n4.nabble.com/file/n4639434/aj.pdf > > > > -- > View this message in context: http://r.789695.n4.nabble.com/help-to- > program-my-function-tp4639434p4639629.html > Sent from the R

Re: [R] help to program my function

2012-08-08 Thread Petr PIKAL
Hi please cc your post also to Rhelp list, others may give you better/quicker answer. > > > HI peter > there is the function that i want to programm (joint in pdf folder). No pdf allowed. > my data is > dataexpv Ti1 265.792 26 1579.523 26 2323.704 > 28 68.855 28 426.07

[R] Odp: help, please! matrix operations inside 3 nested loops

2012-08-08 Thread Petr PIKAL
Hi > > hello, this is my script: > > #1) read in data: > daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt', > header=TRUE, sep="\t") > daten<-as.matrix(daten) If there is any column with nonnumeric values it will transfer all numeric values from daten data.frame

Re: [R] help to program my function

2012-08-08 Thread Petr PIKAL
Hi Maybe it is time for you to read some basic stuff like R intro. It seems to me that you expect R to behave like some other language you know but probably your expectation is wrong. See inline > > HI > > >i have a problem please help me to solve it: > http://r.789695.n4.nabble.com/file/n4

Re: [R] process evaluation packages (slightly off topic)

2012-08-08 Thread Petr PIKAL
> > http://cran.r-project.org/web/packages/plan/plan.pdf > > > > -- Bert > > > > On Tue, Aug 7, 2012 at 1:28 AM, Petr PIKAL wrote: > >> Dear all > >> > >> I need to perform some process evaluation. Sorry for not posting data and > >&g

Re: [R] Decimal number

2012-08-08 Thread Petr PIKAL
Probably a problem in your setting or envirenment or print function Here is what I get > x1<-64.90 > x2<-17.7025 > c(x1,x2) [1] 64.9000 17.7025 > x<-c(x1,x2) > x [1] 64.9000 17.7025 > Regards Petr > > HI > > >i have a little problem please help me to solve it > > >this is the code in R: > >

Re: [R] process evaluation packages (slightly off topic)

2012-08-08 Thread Petr PIKAL
p://cran.r-project.org/web/packages/plan/plan.pdf > > -- Bert > > On Tue, Aug 7, 2012 at 1:28 AM, Petr PIKAL wrote: > > Dear all > > > > I need to perform some process evaluation. Sorry for not posting data and > > code - I do not have any, I ask only for

[R] process evaluation packages (slightly off topic)

2012-08-07 Thread Petr PIKAL
Dear all I need to perform some process evaluation. Sorry for not posting data and code - I do not have any, I ask only for pointing me to correct direction. Suppose I have several connected processes P1, P2, ..., Pn. Each process takes some time and have some capacity (let say like preparing a

Re: [R] How to convert data to 'normal' if they are in the form of standard scientific notations?

2012-08-07 Thread Petr PIKAL
Hi > > Dear Jean > > Thanks a lot for your help. > > The reason I did not provide producible code is that my work started with > reading in some large csv files, e.g. the data is not created by myself. > But the data is from the same data provider so I would expect to receive > data in exact

Re: [R] how to identify values from a column of a dataframe, and insert them in other data.frame with the corresponding id?

2012-08-06 Thread Petr PIKAL
Hi It is better to use dput for presenting data for others. You probably want ?merge. Something like merge(datuak, datuak2, by = "calee_id", all.x=TRUE) However calee_id seems to be a floating point number and it may be rounded so you shall beware of it. Regards Petr > Thank you very muc

[R] Odp: Problem with segmented function

2012-08-06 Thread Petr PIKAL
Hi > > Hi, > > I appreciate your help with the segmented function. I am relatively new to > R. I followed the introduction of the 'segmented'-package by Vito Muggeo, > but still it does not work. > Here are the lines I wrote: > > data_test<-data.frame(x=c(1:10),y=c(1,1,1,1,1,2,3,4,5,6)) > lr_t

Re: [R] Sum two Vectors of different length

2012-08-03 Thread Petr PIKAL
Hi Your description is quite long but almost uninformative about what you really want. You do not say which values you want to sum but you say it is completely equal which value you want to add to what and what shall be the final vector length Based on this I would just use simple "+" x<-1:

Re: [R] Help on merging without a common variable

2012-08-02 Thread Petr PIKAL
Hi OTOH I wonder why cbind gives error as OP told us x <- data.frame(x = 1:5) y <- data.frame(y = 6:15) merge(x,y) cbind(x,y) Gives different results but without any error. Regards Petr > > On Thu, Aug 2, 2012 at 4:52 PM, Ayyappa Chaturvedula > wrote: > > Michael, > > Thank you for this ,

Re: [R] Chopping a vector up into smaller vectors

2012-08-02 Thread Petr PIKAL
Hi one of possible options f<- function(x, parts) split(x,rep(1:length(parts),parts)) f(9:1, c(3,2,4)) $`1` [1] 9 8 7 $`2` [1] 6 5 $`3` [1] 4 3 2 1 You can also check if your parts vector agrees with x vector, if you want. Regards Petr > > Anyone got a neat way to chop a vector up into sma

Re: [R] repeating a function across a data frame

2012-08-01 Thread Petr PIKAL
Hi did you find function dist? It seems that it can do directly what you want. Regards Petr > > Hello everyone. Like others on this list, I'm new to R, and really not much > of a programmer, so please excuse any obtuse questions! I'm trying to > repeat a function across all possible combina

Re: [R] how to calculate seasonal mean for temperatures

2012-08-01 Thread Petr PIKAL
Hi Something like aggregate(DF$data, list(quarters(DF$date), format(DF$date, "%Y")), mean) Regards Petr > > Hello everybody, > > I need to calculate seasonal means with temperature data for my work. > I have 70 files coming from weather stations, which looks like this for > example: > > sta

Re: [R] A challenging question: merging excel files under a specific pattern

2012-07-04 Thread Petr PIKAL
Hi Well, this is help list for R not for Excel, maybe you shall contact Microsoft guys. I believe that probably easiest would be to make a simple macro in Excel. If you want to do merging in R you shall go through help pages for read.xls, merge, cbind, rbind and R data import/export manual. R

Re: [R] ggplot2: legend

2012-07-04 Thread Petr PIKAL
Hi I do not have direct answer. You shall probably search ggplot2 web. Searching "legend" gave me about sixty results from which you probably could learn how to modify legend(s) according to your wish. e.g. http://had.co.nz/ggplot2/docs/opts.html Regards Petr > > Dear all, > > I produced th

Re: [R] problem loading siar

2012-07-04 Thread Petr PIKAL
Hi > Hello, > > It is not what happens. > > Function "convexhull" exists in both "siar" and "spatstat" packages. As > you already load "spatstat", when you are loading "siar", the > "convexhull" in "spatstat" is masked by the one in "siar". > > Thus, when you will run "convexhull" function,

Re: [R] Is it possible to remove this loop? [SEC=UNCLASSIFIED]

2012-07-03 Thread Petr PIKAL
Hi > Hi all, > > I would like create a new column in a data.frame (a1) to store 0, 1 data > converted from a factor as below. > > a1$h2<-NULL > for (i in 1:dim(a1)[1]) { > if (a1$h1[i]=="H") a1$h2[i]<-1 else a1$h2[i]<-0 > } > > My question: is it possible to remove the loop from a

Re: [R] subset data based on values in multiple columns

2012-07-03 Thread Petr PIKAL
Hi > > Dear list members, > > I am trying to create a subset of a data frame based on conditions in two > columns, and after spending much time trying (and search R-help) have not > had any luck. Essentially, I have a data frame that is something like this: > > date<-as.POSIXct(as.characte

Re: [R] R sub query

2012-07-02 Thread Petr PIKAL
Hi I am not at all an expert in regular expressions but gsub("^[[:punct:]]+[[:digit:]]+:", "",m) does the output you want. Maybe by chance :-) Regards Petr > > Hello, > I would like to substitute a substring of characters defined by a specific > start and end sequence. > i.e. in the example

Re: [R] geom_boxplot

2012-07-02 Thread Petr PIKAL
Hi In new ggplot2 version following works too p + geom_boxplot(aes(fill = factor(cyl))) + labs(fill = "Cylinders") + ylab("Miles per Gallon")+xlab("Number of Cylinders") Regards Petr > > Yes you can do all of the things you want. > > Below is a start, to give you an idea of how to ap

Re: [R] About Error message

2012-07-02 Thread Petr PIKAL
> > Hi again! > I have a question about R. > I have done gam in previous version of R with "mgcv" package and saved the > workspace. This workspace contains different models and I will do prediction > by these GAMs. > > However, I install new version of R. and use the same workspace. when I ty

Re: [R] how to add the sample number in the hist figure

2012-06-29 Thread Petr PIKAL
Hi > > hi,R-users: > Now I plot some data with the name(aveobsdata) in column , How can I add > the > some number(e,g. the sample number) in each of the column? > plot > (aveobsdata,type='h',lwd=line_width,col=line_col,main=titleinfo,xlab=xxlab,ylab=yylab,xaxt > = "n") We do not have aveobsdata

[R] Odp: Reading a new dataset using R

2012-06-29 Thread Petr PIKAL
Hi > > Dear Sir, > > We are able to read dataset in the syn.data (species:yeast) using R.But we > want to read a new dataset using R. > We are not able to do that please tell us the procedure of reading a new > dataset of a new species. Did you try it by similar way as you read the first datas

Re: [R] Help

2012-06-29 Thread Petr PIKAL
Hi It seems to me that it can be done by ggplot2 package. However I do not understand what is three boxplots one on top of another? How could you see the bottom boxplot when it is twice overplotted? library(ggplot2) p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(

Re: [R] Adjusting length of series

2012-06-28 Thread Petr PIKAL
Hi I use R for quite a long time and as I remember I did not use such assign paste i loop yet. Insted of such construct with polluting environment with plenty of objects named something(i)somethingelse it is always advisable to use lists. When you want to shorten variables to some common lengt

Re: [R] Printing a variable in a loop

2012-06-28 Thread Petr PIKAL
Hi > > Thanks for your reply Jon. > > I need to actually do more than print the name of the variable (I just made > the example simpler). I need to manipulate var_1, var_2 etc. but setting > values of NA to 0. Why? R has pretty strong system for handling NAs. The only exception AFAIK is cums

Re: [R] selecting rows by maximum value of one variables in dataframe nested by another Variable

2012-06-27 Thread Petr PIKAL
Hi > > How could I select the rows of a dataset that have the maximum value in > one variable and to do this nested in another variable. It is a dataframe > in long format with repeated measures per subject. > I was not successful using aggregate, because one of the columns has You could do

Re: [R] Apply() on columns

2012-06-25 Thread Petr PIKAL
> > I do now know how to navigate through the table. > But my question is, what kind of graphical and numerical summaries can I > make with keeping in mind that I am interested in the average working hour > per employee? Rather vague question without data or code, so rather vague answer. For nu

Re: [R] axis in r plot

2012-06-25 Thread Petr PIKAL
Hi > > I have the graph plotted with x axis(-50 to 250) and y axis (-50 to 500).I > need the x axis values(-50 to 250) with spacing between two tick marks as > 1or 0.1.The graph should be wider to get enough resolution. For the first case you shall have some special display as you will need a

Re: [R] removing NA from a data frame

2012-06-22 Thread Petr PIKAL
Hi both na.omit and complete cases works for me smoothly when NA is not a valid level in factor. If this is the case, as it seems to be, you need reset your factor levels so that NA is not a valid level. ex10s$dg <- factor( ex10s$dg ) both commands shall work than. Regards Petr > > Removi

Re: [R] Novice question about getting data into R

2012-06-22 Thread Petr PIKAL
hmaltz 修安琪 Departamento de Português / Department of > Portuguese Faculdade de Ciências Sociais e Humanas / Faculty of Social > Science and Humanities - UM 澳门大学社会科学及人文学院葡语系 > http://www.umac.mo/fsh/ciela/staff/Marcia_Schmaltz.html (+853) 6231-2114

Re: [R] Novice question about getting data into R

2012-06-21 Thread Petr PIKAL
Hi I can read the example you provided without much problem. dput(head(test)) structure(list(n = 0:5, X = c(NA, NA, NA, NA, NA, NA), start = c(11185L, 39530L, 40544L, 109684L, 114629L, 118841L), X.1 = c(NA, NA, NA, NA, NA, NA), dur = c(1L, 2L, 1L, 1L, 0L, 1L), X.2 = c(NA, NA, NA, NA, NA, NA),

Re: [R] convert 'character' vector containing mixed formats to 'Date'

2012-06-21 Thread Petr PIKAL
Hi > > Dear all > I have a 'character' vector containing mixed formats (thanks Excel!) > and I'd like to translate it into a default "%Y-%m-%d" Date vector. > x <- c("1/3/2005", "13/04/2004", "2/5/2005", "2/5/2005", "7/5/2007", >"22/04/2004", "21/04/2005", "20080430", "13/05/2003", "20080

Re: [R] can not read a table

2012-06-20 Thread Petr PIKAL
Hi > > I have a table like the following: > > TABLE NO. 1 > ID TIME > 1325 0 > 1325 0 > . . > . . > . . > TABLE NO. 1 > ID TIME > 1325 0 > 1325 0 > . . > . . > . . > TABLE NO. 1 > ID TIME > 1325 0 > 1325 0 > . . > . . > . . > TABLE NO. 1 > ID TIME >

Re: [R] Apply() on columns

2012-06-20 Thread Petr PIKAL
Hi > Hi, > > Yes, the columns are related: V1 is related to V6, V2 is related to V7 and > so on. The columns V1,V2,V3,V4,V5 contains the number of employees (in a > filling team). The columns V6,V7,V8,V9,V10 contains the number of worked > hours of the filling team. You shall rather include y

Re: [R] Problem with predict?

2012-06-20 Thread Petr PIKAL
Hi > > Hello, > > I am trying to fit a model to some "death over time" data that does not > fit the criteria for the usual LD50 type models (the counts are too > large). I am using a simple linear model in an attempt to plot a nice line > on a scatter plot and calculate some LD values to use

Re: [R] storing output of a loop in a matrix

2012-05-23 Thread Petr PIKAL
Hi What is your intention? basically one output column can be made by cumsum(bd) Then you can shuffle bd by let say bd <- sample(bd, 64) and repeat cumsum for new bd. bd<-scan("blap.txt") output<-matrix(0,64,10) for (i in 1:10) { bd<-sample(bd, 64) cs<-cumsum(bd) output[,i]<-cs } If you in

Re: [R] “For” calculation is so slow

2012-05-23 Thread Petr PIKAL
> > I'm not sure what you are trying to prove with that example - the loopless > versions are massively faster, no? In some languages loops are integral part of programming habits. In R you can many things do with whole objects without looping - vectorisation approach. See R-Inferno from Patri

Re: [R] ReName

2012-05-22 Thread Petr PIKAL
Hi > > On May 22, 2012, at 4:08 AM, HAOLONG HOU wrote: > > > Dear list, > > > > The name of R-language is too short and is not friendly to search > > engines. Did you try it? Even with plain Google something R will usually lead to quite good hit. Try e.g. linear model R Regards Petr > > Do

Re: [R] “For” calculation is so slow

2012-05-22 Thread Petr PIKAL
And as followup > system.time(d<-1000*1001/2) user system elapsed 0.020.000.02 > identical(a,b,d) [1] TRUE > Regards Petr > > Hi > > > > > For loops are really, really slow in R. In general, you want to avoid > them > > I strongly disagree. ***Proper*** use of loopi

Re: [R] “For” calculation is so slow

2012-05-22 Thread Petr PIKAL
Hi > > For loops are really, really slow in R. In general, you want to avoid them I strongly disagree. ***Proper*** use of looping is quite convenient and reasonably fast. Consider > system.time( { + a=0 + for (i in 1:1000) { + a <-a+i + } + a + }) user system elapsed 10.220.0

Re: [R] “For” calculation is so slow

2012-05-22 Thread Petr PIKAL
Hi > > Dear All, > > The function I wrote can run well with the small data, but with the large > data, the function runs very very slowly. How can I correct it? Thank you Your function does not run slowly, it does not run at all. > l(10,20) Error in l(10, 20) : object 's' not found No s obj

Re: [R] removing only rows/columns with "na" value from square ( symmetrical ) matrix.

2012-05-21 Thread Petr PIKAL
Hi You can do it by hand and remove row/col with max number of NA values. rem<-which.max(colSums(is.na(M))) M1<-M[-rem, -rem] rem<-which.max(colSums(is.na(M1))) M2<-M1[-rem, -rem] M2 1 2 3 4 5 7 8 10 11 12 10 143 92 134 42 123 40 107 49 93 2 143 0 77 6 99 46 47 114

Re: [R] Replace a variable by its value

2012-05-21 Thread Petr PIKAL
Hi > > I have a dataset called "raw-data" . I am trying to use the following code - > > > col_name<-names(raw_data) > for (i in 1:(length(names(raw_data))-2)) > { > tbl=table(raw_data$Pay.Late.Dummy, raw_data$col_name[i]) > > chisqtest<-chisq.test(tbl) > } > > > Say the 1st column of my

Re: [R] for loop, error in model frame.default ... variable lengths differ

2012-05-21 Thread Petr PIKAL
Hi You did not provide data but I can see some problems in your code. See inline. > > I'm failing to get a for loop working. I'm sure it's something simple, and I > have found some posts relating to it, but I'm just not understanding why > this isn't working. > > I have a data frame and woul

Re: [R] how to find outliers from the list of values

2012-05-17 Thread Petr PIKAL
Hi I had not see any answer yet but maybe there is nobody who wants to touch the elusive object of "outlier". Neither me, but here are some ideas how one can proceed. First of all its always up to you what is considered an outlier and how will you deal with them. I usually call an outlier an

Re: [R] error code trying to extract second column from coeftest output

2012-05-17 Thread Petr PIKAL
Hi > > I want to use the standard error values in the summary that is produced using > coeftest, but I am getting an error code- any ideas? See what is structure of coeftest object by str(coeftest(lmodT_WBHO)) and from this you shall deduct how to select second column. Regards Petr > > >

Re: [R] replacing with NA

2012-05-17 Thread Petr PIKAL
> > x[is.na(z)] <- NA > > This might send you a nasty bug if x and z are different lengths > though -- just a head's up. Another option x*!is.na(z)*z Regards Petr > > Michael > > On Wed, May 16, 2012 at 12:55 PM, Mintewab Bezabih > wrote: > > Dear R users, > > > > I was wondering how I ca

Re: [R] max value

2012-05-17 Thread Petr PIKAL
Hi > > On 2012-05-15 08:36, Melissa Rosenkranz wrote: > > Here is an R problem I am struggling with: > > My dataset is organized like this... > > > > subject sessionvariable_x variable_y > > 01 11 > > 01 1

Re: [R] Add column from other columns data.

2012-05-17 Thread Petr PIKAL
> Something along the lines of > > dat2 <- ifelse( dat1==1 , "yes", "no") Another option is in this case dat2 <- c("no", "yes")[dat1+1] Regards Petr > > should do it. > > John Kane > Kingston ON Canada > > > > -Original Message- > > From: s1010...@student.hsleiden.nl > > Sent:

[R] Odp: arguments must have same length

2012-05-11 Thread Petr PIKAL
Hi > > > score<-read.csv("http://users.stat.umn.edu/~chen2285/hw/ACT.csv";) > score<-read.csv("http://users.stat.umn.edu/~chen2285/hw/ACT.csv";) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : unable to connect to 'users.stat.umn.edu'

Re: [R] Matrix heatmap

2012-05-10 Thread Petr PIKAL
Hi > > how do I plot only the data below 10? everything is white for the 0-10 and > 10-90 is black .. What data below 10? I do not see any. You posted some mails before but I do not keep all mails from R. Only those which helped me somehow. Basically x <- sample(1:100, 100, raplace=TRUE) x[x

Re: [R] Matrix heatmap

2012-05-10 Thread Petr PIKAL
Hi what is wrong with heatmap(as.matrix(test), col=my.colors(25)) with test from your dput Regards Petr > The heat map generated the correct result: > > library(gplots) > arq <-read.table("l") > matrix_l <-data.matrix(arq) > my.colors <- > colorRampPalette(c > ("gray0","gray10","gray20","gr

Re: [R] averaging two tables (rows with columns)

2012-05-10 Thread Petr PIKAL
Hi as already mentioned your data can not be deciphered. Use dput(table1) for sending usable data. >From what you describe probably ?aggregate can be used. But without suitable data you hardly get any advice. Regards Petr > > > Hi R user,I am struggling to figure out on how I can calculate

Re: [R] Matrix heatmap

2012-05-09 Thread Petr PIKAL
Hi > > >arq <-read.table("file") > > arq_matrix <-data.matrix(arq) Are you sure that arg_matrix is numeric? Did you check it somehow? > >dput(arq) You forgot to include dput(arg) result. Without that only you know what arg is. > > arq_heatmap <- heatmap(arq_matrix, Rowv = NA, Colv = NA,col

Re: [R] Problem with Median

2012-05-08 Thread Petr PIKAL
Hi > > > I might be silly but if I was going to type in dput() then how should I > send the data over here? > dput(zdrz20) outputs tou your console structure(list(sklon = c(95, 95, 40, 40, 40, 40, 20, 20, 20, 20, 20, 20, 20), ot = c(15, 4, 10, 15, 4, 1.5, 1.5, 4, 10, 15, 4, 10, 15), doba

[R] Odp: how to deduplicate records, e.g. using melt() and cast()

2012-05-07 Thread Petr PIKAL
Hi I wold vote aggregate > aggregate(my.df[,-1], list(pathway=my.df$pathway), mean, na.rm=T) pathway cond.one cond.two cond.three 1pw.A 0.5 0.6NaN 2pw.B 0.4 0.90.1 3pw.C NaN 0.2NaN > Regards Petr > > Esteemed UseRs, > > Thi

Re: [R] Problems Exporting R Output to an xls file need help

2012-05-07 Thread Petr PIKAL
.OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > Petr PIKAL wrote: > > >Hi > > > >Or you can use base function > > > >write.table(varxls, file="some output file.xls", sep = "\t", row.na

Re: [R] how to do the concentration-time profiles in R?

2012-05-07 Thread Petr PIKAL
> > Hi, Dear all, > > Could you please tell me how to select specified column in dataset and how > to do my.data[, x] my.data[, "aa"] my.data$aa > the concentration-time profiles in R? What is that? Besides you could help youself a lot reading an intro to R which I believe is in doc direct

Re: [R] Problems Exporting R Output to an xls file need help

2012-05-06 Thread Petr PIKAL
Hi Or you can use base function write.table(varxls, file="some output file.xls", sep = "\t", row.names = F) Regards Petr > > As it says, you need to supply a file name to be outputted to. > > write.xls(, file = "abc.xls") > > Michael > > On Fri, May 4, 2012 at 11:31 AM, PaulJr wrote:

Re: [R] colours in a pdf

2012-05-04 Thread Petr PIKAL
Hi One option for substantial distinguishable range of colours is jet.colors from matlab package. Regards Petr > Hi, > > Thanks for the help. Extending the palette to 16 or 20 would be a big > help. The largest number of files I've had to handle in a single group is > 42 and I wouldn't ex

Re: [R] R help!

2012-05-03 Thread Petr PIKAL
Hi I would convert it to propper date format and then you can extract anything. dat<-strptime("12/31/11 23:45", format="%m/%d/%y %H:%M") as.Date(dat) [1] "2011-12-31" format(dat, "%H:%M") [1] "23:45" Regards Petr > > Hello there, I was wondering if you could help me with a quick R issue. >

Re: [R] list objects calculation

2012-05-02 Thread Petr PIKAL
Hi you maybe can use mapply If you have 2 lists xl<-list(x, x+5) xl [[1]] [1] 1 2 3 4 5 [[2]] [1] 6 7 8 9 10 > yl<-list(9,10) > yl [[1]] [1] 9 [[2]] [1] 10 and this function fff<- function(xl,yl) (xl-yl)/yl mapply(fff, xl, yl) [,1] [,2] [1,] -0.889 -0.4 [2,] -0.778

Re: [R] Different varable lengths

2012-04-30 Thread Petr PIKAL
> Hi! > > I'm trying to do a lm() test on three objects. My problem is that R protests > and says that the variable lengths differ for one of the objects > (Sweden.GDP.gap). But I have double checked that the number of observations You shall check it again. BTW How did you checked it? > are th

Re: [R] Merge function - Return NON matches

2012-04-27 Thread Petr PIKAL
Hi If you used shorter names for your objects you will get probably more readable advice Is this what you wanted? truncated_dataframe[truncated_dataframe$CLAIM_NO %in% setdiff(truncated_dataframe$CLAIM_NO, truncated_list$CLAIM_NO),] Regards Petr > Hi there, > I've tried the noted solutions

Re: [R] Rconsole file fails to remember GUI settings, and script

2012-04-27 Thread Petr PIKAL
Hi Isn't possible just to change values in etc/Rconsole file? ## Colours for console and pager(s) # (see rw/etc/rgb.txt for the known colours). background = White normaltext = NavyBlue usertext = Red highlight = DarkRed You can customise it and keep your setting somewhere. With each new ins

Re: [R] Subsetting dataframe with missing values

2012-04-27 Thread Petr PIKAL
Hi > > Dear R-community, > > I am using R (V 2.14.1) on Windows 7. I have a dataset which consists of 19 > variables for 91 individuals or rows. Two of my variables are Age > (adult/chick, with no NA values) and Sex (0 for females/1 for females, with > quite a few NA values). The sex of many

Re: [R] repeat matrix rows as a whole

2012-04-26 Thread Petr PIKAL
Hi what about rbind(a,a) [,1] [,2] [,3] [,4] [1,]1234 [2,]5678 [3,]1234 [4,]5678 Regards Petr > > > a <- matrix(1:8, 2, 4, byrow=TRUE) > > a > [,1] [,2] [,3] [,4] > [1,]1234 > [2,]5678 >

Re: [R] Re : Sort out number on value

2012-04-20 Thread Petr PIKAL
Hi Without data it is only a guess. > > I found out something strange when I used the same thing on another data > file. > > In a excel file I have same data too and there I asked in a certain column > what values where above the 7.5. Result: 206. > Now I have done the same thing in R and I g

Re: [R] Trouble with [sv]apply

2012-04-20 Thread Petr PIKAL
Hi > On Fri, Apr 20, 2012 at 4:42 PM, Jeff Newmiller > wrote: > > If you read the help, it talks about compiling vectors into matrices, or > scalars into vectors. It does not say anything about combining matrices. > > > > For the error about 14 elements, you should keep in mind that matrices

Re: [R] Help in using unique count by match function

2012-04-18 Thread Petr PIKAL
Hi Your question is rather cryptic. Why the output shall be 3? What has unique count to do with match function? Maybe you want something what is described in switch help. See ?switch Regards Petr > > Hi > > My code looks like this > > I have two parameters x and par1. X contains values an

Re: [R] How to keep spacing in column name while reading data from data frame?

2012-04-17 Thread Petr PIKAL
Hi > > Hi, > > I am working on dataframe and column names are multiwords but when i read > it it become one word with space relplaced by "." How can i keep normall > spacing reading file. > > for e.g. > > input file > > Data Test Data Out > 35 > 5

Re: [R] How to change color of bar based on y value of y axis?

2012-04-17 Thread Petr PIKAL
Hi > > Hi, > > > I m working on bar chart. > > *Input file:* > index -5 1 > index -4 3 > index -3 2 > index -2 10 > index -1 7 > index 0 2 > index 1 1 > > barplot(t(as.matrix(i[3])), ylab= "value", main = "testdata", beside=TRUE, > col=c("burlywood1"),horiz=TRU

Re: [R] loss of information in pdf plots

2012-04-17 Thread Petr PIKAL
Hi > > Hi there > > is it possible that pdfs generated using the pdf() function with default > settings leads to loss of information? I was plotting copy number changes > from Agilent 180k data in form of rectangles (rect()) while each rectangle > represents one region of copy number change

Re: [R] selective labels display on histogram

2012-04-12 Thread Petr PIKAL
dify for instance this h.lab <- h$counts h.lab[seq(2,16,2)]<-NA hist(x, labels=as.character(h.lab)) prints every second label Regards Petr > > thanks > > From: Petr PIKAL > To: carol white > Cc: "r-h...@stat.math.ethz.ch" > Sent: Thursday, April 12, 20

Re: [R] selective labels display on histogram

2012-04-12 Thread Petr PIKAL
Hi > > Hello, > Is it possible to selectively display labels on a histogram? What labels? Like that? x<-rnorm(1) hist(x) hist(x, axes=F, xlab="bla", ylab="ble", main="bleble") axis(1, at=c(-4, -1, 1, 4)) Regards Petr > > Thanks > > Carol > >[[alternative HTML version deleted]] >

Re: [R] number of warnings

2012-04-12 Thread Petr PIKAL
Hi > > Any help ? Call 999 Regards Petr > > -- > View this message in context: http://r.789695.n4.nabble.com/number-of- > warnings-tp4550325p4551760.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailin

Re: [R] row.names in dunes and dunes.env?

2012-04-12 Thread Petr PIKAL
Hi see inline > > Hello, > > I've got a small dataset on box turtle shell measurements that I would > like to perform a detrended correspondence analysis on. I thought that it > would be interesting to examine the morphometrics for each species in the > area of overlap and in areas where n

Re: [R] how to save multiple work space

2012-04-10 Thread Petr PIKAL
Hi > > You'll need to save them manually to avoid name conflicts -- save.image() > is the function to do so but you need to give a file name. Or it is necessary have separate folder for each R session. Regards Petr > > Michael > > On Apr 10, 2012, at 7:41 AM, ya wrote: > > > Hi guys, >

[R] Odp: how to plot 2d matrix as coloured squares?

2012-04-10 Thread Petr PIKAL
Hi > > i have a matrix like > > x1 x2 x3 > y1 2 34 5656 > y2 34 434 342 > y3 234 43 34 > > i want to plot these values like here > http://www.almob.org/content/2/1/12/figure/F5?highres=y > > The rainbow function could calculate a colour for each value. > But how van i generate t

Re: [R] Help Using Spreadsheets

2012-04-10 Thread Petr PIKAL
y is rather undeveloped so if you PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. e.g. **how** did you read your file to R. Regards Petr > > > > Regards, > > > > Lämarao > >

Re: [R] R generated means are different from the boxplot!

2012-04-06 Thread Petr PIKAL
Hi > > Hi R-listers, > > 1) I am having trouble understanding why the means I have calculated from > Aeventexhumed (A, B, and C) are different from the means showing on the > boxplot I generated (see attached). I have added the script as to how my > data is organized. Maybe the difference i

Re: [R] Legend based on levels of a variable

2012-04-06 Thread Petr PIKAL
Thanks, anyway, using build-in R features is preferable for colours with(data, plot(axis1, axis2, col= c("red", "blue", "green")[as.numeric(data$Region)])) legend("topright", legend=levels(data$Region), fill= c("red", "blue", "green")) although sometimes can be preferable to get advantage of

Re: [R] how to do piecewise linear regression in R?

2012-04-06 Thread Petr PIKAL
Hi Your post is rather screwed. > > [R] how to do piecewise linear regression in R? Maybe segmented? Regards Petr > > > Dear all, > I want to do piecewise CAPM linear regression in R: > RRiskArb−Rf = (1−δ)[αMktLow+βMktLow(RMkt−Rf)] + δ[αMkt High > +βMkt High(RMkt −Rf )] >

[R] Hi: Help Using Spreadsheets

2012-04-06 Thread Petr PIKAL
Hi > Hello, > > I am a new user of R and I am trying to use the data I am reading from a > spreadsheet. > I installed the xlsReadWrite package and I am able to read data from this > files, but how can I assign the colums into values? > E.g: > as I read a spreadsheet like this one: Maybe with

Re: [R] Legend based on levels of a variable

2012-04-06 Thread Petr PIKAL
Hi > > I have a bivariate plot of axis2 against axis1 (data below). I would like > to use different size, type and color for points in the plot for the point > coming from different region. For some reasons, I cannot get it done. Below > is my code. > > col <- rep(c("blue", "red", "darkgreen"

[R] Odp: identify with mfcol=c(1,2)

2012-04-05 Thread Petr PIKAL
Hi It seems to me that probably split.screen or layout is preferable if you want specify graph for identification. But I am not an expert in this and after some testing identification does not work well with splitted screen. So you are probably out of luck. Regards Petr > > Please forgive m

Re: [R] identify time span in date vector

2012-04-04 Thread Petr PIKAL
(dates)) dates[ which( c(distance<365, F) > c(distance<91,F) & apply(within_one_year,2,sum) >=3)[1]] } You shall get some improvement, however I am still struggling to evaluate how many consecutive dates are within one year. > > Best, > Felix > > >

[R] Odp: identify time span in date vector

2012-04-04 Thread Petr PIKAL
Hi Can you please be more specific? Based on this input, what do you want as a result? > set.seed(111) > dates = as.Date(sort(rnorm(10,3000,100)), origin = "2000-1-1") > dates [1] "2007-08-01" "2007-10-21" "2007-12-08" "2007-12-15" "2008-01-29" "2008-02-14" "2008-02-16" "2008-03-01" [9] "2008

Re: [R] filling small gaps of N/A

2012-04-04 Thread Petr PIKAL
> > Michael, > > First of all, thank you very much for your answer. > I've read your 2 answers, but I'm not really sure that they corresponds to > my problem of NAs. You shall read answers more carefully x<-rnorm(20) x[3:4]<-NA x[12:19]<-NA x [1] -0.30754528 0.07597988 NA N

  1   2   3   4   5   6   7   8   9   10   >