[R] Problems with Mann-Kendall trend test

2016-06-17 Thread lily li
Dear R users, Can anyone help me with mann-kendall trend test? I tried to use the newest packages 'trend', and the function mk.test, but had problems in applying the input data. For example, res <- mk.test(Nile), Nile is a time-series data. But when I use my dataset, with one column which is a

[R] about change columns for specific rows

2016-01-30 Thread lily li
Hi R users, I have a data frame, and I generate a date column like this: df$date = seq(as.Date('2012-01-01'), as.Date('2014-12-31')) df A B C 1 2 1 2 2 3 3 2 4 So the data frame has 4 columns now. But when I want to change the values of column A for specific dates, such as 2012-01-01

Re: [R] about interpolating data in r

2016-07-22 Thread lily li
helpful. with(df, approx(x=time, y=C, xout=seq(min(time), max(time), by="days"))) On Thu, Jul 21, 2016 at 5:14 PM, Ismail SEZEN <sezenism...@gmail.com> wrote: > > > On 22 Jul 2016, at 01:34, lily li <chocol...@gmail.com> wrote: > > > > I have a

[R] about netcdf files

2016-07-25 Thread lily li
Hi all, I have a problem in opening netcdf files. If one netcdf file contains longitude, latitude, and daily precipitation. How to relate each precipitation record to its associated location, and export them as csv files? Thanks. I just use nc_open(), ncvar_get(), but it is not very helpful.

Re: [R] about netcdf files

2016-07-26 Thread lily li
u haven't worked much with netcdf files. I will try to > find a tutorial also to help you along. > > Thanks, > > -Roy > > > On Jul 26, 2016, at 12:07 PM, lily li <chocol...@gmail.com> wrote: > > > > Thanks for your reply. But it says "Error in (func

Re: [R] about netcdf files

2016-07-26 Thread lily li
.. ..$ hasAddOffset : logi FALSE .. ..$ hasScaleFact : logi FALSE .. ..- attr(*, "class")= chr "ncvar4" - attr(*, "class")= chr "ncdf4" On Tue, Jul 26, 2016 at 2:52 PM, Roy Mendelssohn - NOAA Federal < roy.mendelss...@noaa.gov>

Re: [R] about netcdf files

2016-07-26 Thread lily li
day: > > p1 = rasterToPoints(bvar[[1]]) > and write p1 to csv. > > Best, > Jon > > > > On 7/26/2016 6:54 AM, lily li wrote: > >> Hi all, >> >> I have a problem in opening netcdf files. If one netcdf file contains >> longitude, latitude, and

[R] how to create column names for the matrix

2016-07-27 Thread lily li
Hi all, I want to ask that how to create column names for a matrix. For example, the matrix below, the column names should be: 1-A, 1-B, 1-C, 1-D, 2-A, 2-B, 2-C, 2-D, 3-A, etc. Thanks for your help. chars = c('A','B','C','D') matrix1 = matrix(nrow = length(1:100), ncol =

Re: [R] about netcdf files

2016-07-27 Thread lily li
to read the > crs-variable was not wrapped in a try-call in earlier versions. Upgrading > might help. > > Best, > Jon > > > > On 7/27/2016 5:13 PM, lily li wrote: > > Hi Jon, > > I still have problems. The brick function does not work well and I don't > kn

Re: [R] how to create column names for the matrix

2016-07-27 Thread lily li
: > >> Hi, >> >> On 07/27/2016 11:17 AM, lily li wrote: >> >>> Hi all, >>> >>> I want to ask that how to create column names for a matrix. For example, >>> the matrix below, the column names should be: 1-A, 1-B, 1-C, 1-D, 2-A, >>> 2-

Re: [R] how to create column names for the matrix

2016-07-27 Thread lily li
[2]], tmp[[1]], sep = "-") > rm(tmp) > colnames(matrix1) <- nms > > head(matrix1) > > > Hope this helps, > > Rui Barradas > > > Citando lily li <chocol...@gmail.com>: > > Hi all, > > I want to ask that how to create column names for a matrix

Re: [R] how to create column names for the matrix

2016-07-27 Thread lily li
If replace 1:5 to char2 = c('east','west','south','north','central'), how to put on column names with the original structure? Thanks again. On Wed, Jul 27, 2016 at 12:40 PM, Hervé Pagès <hpa...@fredhutch.org> wrote: > Hi, > > > On 07/27/2016 11:17 AM, lily li wrote: > &g

[R] about interpolating data in r

2016-07-21 Thread lily li
I have a question about interpolating missing values in a dataframe. The dataframe is in the following, Column C has no data before 2009-01-05 and after 2009-12-31, how to interpolate data for the blanks? That is to say, interpolate linearly between these two gaps using 5.4 and 6.1? Thanks. df

Re: [R] about interpolating data in r

2016-07-21 Thread lily li
otice how one can copy and paste that example out of the > mail an into R to see how it works? It would help if your questions > had that same property - show how the example data could be created. > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Thu, Jul 21, 2016

[R] installing the lubricate package

2016-07-21 Thread lily li
Hi R users, I'm trying to download lubricate from this website, and then install it on my mac. https://github.com/hadley/lubridate but it says windows version does not apply to mac. How to install the package for mac? Thanks. [[alternative HTML version deleted]]

Re: [R] how to expand the dataframe

2016-07-21 Thread lily li
I use this code, and it works. So has to set 'all=TRUE'. merge(df, data.frame(time=seq(as.Date("1990-01-01"), to=as.Date("1990-12-31"), by="days")), all=TRUE) On Thu, Jul 21, 2016 at 9:22 AM, Daniel Nordlund <djnordl...@gmail.com> wrote: > On 7/20/2016 8:

Re: [R] about file name

2016-07-28 Thread lily li
; > a.new <- sub("^.", '', a) > > a.new > [1] "35.84375_.100.71875" > > > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > On Thu,

Re: [R] plot many dfs in ggplot

2016-08-02 Thread lily li
Another question is, if I want to shade the range between the maximum and minimum values for daily or annual values, how to do it? Thanks again. On Tue, Aug 2, 2016 at 12:50 PM, lily li <chocol...@gmail.com> wrote: > Hi all, > > I have another question. There are several dataf

Re: [R] about netcdf files

2016-08-01 Thread lily li
('sample_precip_daily.nc') pre.3d = ncvar_get(pre1, 'precipitation') require(raster) rplot = t(pre.3d[, , 1]) r = raster(rplot[nrow(rplot):1, ] plot(r) On Tue, Jul 26, 2016 at 1:07 PM, lily li <chocol...@gmail.com> wrote: > Thanks for your reply. But it says "Error in (function (classes, fdef, > m

Re: [R] how to plot annual values directly

2016-08-03 Thread lily li
dd it to your plot, but I am not sure if it is > enough direct. > > Cheers > Petr > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li > > Sent: Tuesday, August 2, 2016 8:10 PM > > To: R mailing list <r-he

Re: [R] plot many dfs in ggplot

2016-08-03 Thread lily li
l data > frames. > > Something like > > df1$fr <- 1 > df2$fr <- 2 > > dfkompl <- rbind(df1, df2) > > ggplot(dfkompl, aes(x=time, y=varA, colour=factor(fr)) > > Cheers > Petr > > > > -Original Message----- > > From: R-help [mailto:r-hel

Re: [R] plot many dfs in ggplot

2016-08-03 Thread lily li
all: > > df.lst <- list(df1, df2, df3, df1, df2, df3) > do.call(rbind, df.lst) > > You might take a look at the facet functionality in ggplot once you are > ready to build your plots. > > Best, > Ulrik > > On Wed, 3 Aug 2016 at 17:42 lily li <chocol...@gmail.

[R] how to expand the dataframe

2016-07-20 Thread lily li
Hi R users, I have a dataframe, where there is a column 'time' represents time series but is not complete. How to expand the dataframe so this column will become complete, where other columns with the newly added rows have NA values? Thanks. df A B C time 105 3.3 1990-01-01

Re: [R] how to expand the dataframe

2016-07-20 Thread lily li
20, 2016, at 1:31 PM, lily li <chocol...@gmail.com> wrote: > > > > Hi R users, > > > > I have a dataframe, where there is a column 'time' represents time series > > but is not complete. How to expand the dataframe so this column will > become > > com

Re: [R] about smwrgraphs package

2016-07-11 Thread lily li
I still haven't heard back from anyone. Please let me know as I think it is better to discuss here. On Sun, Jul 10, 2016 at 1:25 PM, lily li <chocol...@gmail.com> wrote: > Has anyone used smwrGraphs package? I have some problems and think it may > be better to discuss if you hav

[R] about smwrgraphs package

2016-07-10 Thread lily li
Has anyone used smwrGraphs package? I have some problems and think it may be better to discuss if you have been using it. Thanks very much. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

[R] plot many dfs in ggplot

2016-08-02 Thread lily li
Hi all, I have another question. There are several dataframes, each has the same columns: time, varA, varB, varC, etc. If I want to plot time ~ varA of each dataframe, where different dataframe names use different colors. How to do this in ggplot? Thanks for your help. Right now, I tried to use

[R] how to plot annual values directly

2016-08-02 Thread lily li
Hi R users, I have a dataframe, with daily precipitation data, is it possible to plot annual mean or annual sum values directly? Thanks for your help. df year month day precip time 2010 1 10.5 2010-01-01 2010 1 20.8 2010-01-02 2010

Re: [R] about netcdf files

2016-08-01 Thread lily li
ckage ( > http://coastwatch.pfeg.noaa.gov/xtracto/index.html) there are any number > of examples using ggplot2 to make maps from netcdf data, > > HTH, > > -Roy > > > On Aug 1, 2016, at 10:35 AM, lily li <chocol...@gmail.com> wrote: > > > > Hi all,

[R] about file name

2016-07-28 Thread lily li
Hi R users, I have a string for example 'X35.84375_.100.71875', and I have another dataframe df that I want to export with the transformed string name '35.84375_-100.71875' with no extension. How to do this in R? Thanks for your help. a = 'X35.84375_.100.71875' write.table(df, file='',

[R] Merge several datasets into one

2016-06-30 Thread lily li
Hi R users, I'd like to ask that how to merge several datasets into one in R? I put these csv files in one folder, and use the lapply function, but it says that cannot open file 'xx.csv'. These files have different names, but end with .csv extension, and the files have the same header. Thanks for

[R] regroup row names

2016-07-03 Thread lily li
I have a problem in changing row names in a dataframe in R. The first column is ID, such as aClim_st02, aClim_st03, aClim_st 05, bClim_st01, bClim_st02, etc. How to rename the names, so that aClim_ all grouped to aClim, while bClim_ all grouped to bClim? Thanks for your help. df ID

Re: [R] regroup row names

2016-07-03 Thread lily li
", "", df$ID) > > HTH > Ulrik > > On Sun, 3 Jul 2016 at 20:16 lily li <chocol...@gmail.com> wrote: > >> I have a problem in changing row names in a dataframe in R. The first >> column is ID, such as aClim_st02, aClim_st03, aClim_st 05, bClim_st01, >

Re: [R] converting time format

2017-02-22 Thread lily li
s.Date(paste(df.count.mon$year, df.count.mon$mon,1), > '%Y %m %d') > df.count.mon >count year mon time > 1 22 2014 1 2014-01-01 > 2 12 2014 2 2014-02-01 > ... > You will get values, but I don't think they are the ones you want. > > Jim > > On Th

[R] converting time format

2017-02-22 Thread lily li
Hi R users, I have a dataframe, with year, month, day, and other variables. I wanted to calculated monthly values of the variables. For example, there is one variable called 'count'. I use the code below to convert daily data to monthly data. df.count.mon = aggregate(count ~ year+month, data=

[R] reading data

2017-01-19 Thread lily li
Hi R users, I'm trying to open netcdf files in R. Each nc file has daily climate measurements for a whole year, covering the whole US. How to limit the file to a specific rectangle? Thanks. [[alternative HTML version deleted]] __

Re: [R] about data problem

2016-09-20 Thread lily li
sAsFactors = F" when you read the data, and then > convert them to numeric. > > On 20 September 2016 at 16:00, lily li <chocol...@gmail.com> wrote: > > Yes, it is stored as factor. I can't check out any problem in the > original > > data. Reread data doesn't help eit

[R] about data problem

2016-09-20 Thread lily li
Hi R users, I have a problem in reading data. For example, part of my dataframe is like this: df month day year Discharge 31 20106.4 32 2010 7.58 33 2010 6.82 34 2010 8.63 3

Re: [R] about data problem

2016-09-20 Thread lily li
na.strings argument documented under read.table)... so you probably DO have > unexpected garbage still in your data which could be obscuring valuable > information that could affect your conclusions. > -- > Sent from my phone. Please excuse my brevity. > > On September 20, 2016 3:1

Re: [R] about data problem

2016-09-20 Thread lily li
ric using the colClasses argument to read.table or other > function. > > > > On Tue, Sep 20, 2016 at 3:46 PM, lily li <chocol...@gmail.com> wrote: > > Hi R users, > > > > I have a problem in reading data. > > For example, part of my dataframe is like t

Re: [R] about data problem

2016-09-20 Thread lily li
Is there a function in read.csv that I can use to avoid converting numeric to factor? Thanks a lot. On Tue, Sep 20, 2016 at 4:42 PM, lily li <chocol...@gmail.com> wrote: > Thanks. Then what should I do to solve the problem? > > On Tue, Sep 20, 2016 at 4:30 PM, Jeff N

Re: [R] about data problem

2016-09-20 Thread lily li
=FALSE) > (I'm just reiterating Jianling said...) > > Joe > > On Tue, Sep 20, 2016 at 4:56 PM, lily li <chocol...@gmail.com> wrote: > >> Is there a function in read.csv that I can use to avoid converting numeric >> to factor? Thanks a lot. >> >> >>

Re: [R] about data problem

2016-09-20 Thread lily li
e. Please excuse my brevity. > > On September 20, 2016 4:09:02 PM PDT, lily li <chocol...@gmail.com> wrote: > >Yes, I tried to add this statement when reading the dataset. > >But when I use summary(df), it shows: > >Discharge > >Length: > >Class :character

[R] About converting files in R

2016-10-25 Thread lily li
Hi R users, Do any of you have any experience about converting binary files to ascii or txt files in R? Thanks a lot for your help. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] How to calculate row means while ignore NAs

2016-10-28 Thread lily li
My apologize, it has been solved. Just include w inside of select, such as: select = c(w, x, y) On Fri, Oct 28, 2016 at 12:06 PM, lily li <chocol...@gmail.com> wrote: > Hi R users, > > I have the dataframe as below: > > w=c(5,6,7,8) > x=c(1,2,3,4) > y=c(1,2,3) > le

[R] How to calculate row means while ignore NAs

2016-10-28 Thread lily li
Hi R users, I have the dataframe as below: w=c(5,6,7,8) x=c(1,2,3,4) y=c(1,2,3) length(y)=4 z=data.frame(w,x,y) z$mean1 <- rowMeans(subset(z, select = c(x, y)), na.rm = T) z$mean2 <- rowMeans(subset(z, select = c(x, y)), na.rm=F) w x y mean1 mean2 1 5 1 1 1 1 2 6 2 2 2 2 3

[R] Read in files in r

2016-11-08 Thread lily li
Hi R users, In the current directory, there are several folders (such as fold1, fold2, fold3, etc.), while each folder includes the same named files, such as file1.txt, file2.txt, file3.txt, etc. The structures of each folder and each file are the same, but with different values. I want to read

[R] about data structure

2016-11-07 Thread lily li
Hi R users, I'm wondering why the values changed when I try to transform factors into numerics. For example, for a data frame DF, there is one column called precipitation, which is usually lower than 100mm. But this column is factor when I read in the data. When transform to numeric values, some

Re: [R] About reshape dataset

2016-10-22 Thread lily li
The code I'm using is: require(reshape) DF2 = melt(DF, id.vars = c('year', 'month', 'day'), measure.vars = c('site1_elev', 'site2_elev', 'site1_temp', 'site2_temp')) But it didn't work. On Sat, Oct 22, 2016 at 11:50 AM, lily li <chocol...@gmail.com> wrote: > Hi R users, > >

[R] About reshape dataset

2016-10-22 Thread lily li
Hi R users, I want to melt a dataframe, but it mixed up the variables. DF is the original dataset: year month day site1_elev site2_elev site1_temp site2_temp 2000 561300 150020 21 2000 571300 1500

[R] About data manipulation

2016-11-26 Thread lily li
Hi R users, I'm trying to manipulate a dataframe and have some difficulties. The original dataset is like this: DF year month total id note 2000 1 98GA 1 2001 1100 GA 1 2002 2 99GA 1 2002 2 80GB 1 ... 2012 1

Re: [R] About data manipulation

2016-11-26 Thread lily li
do, not how you want to do it. > > On Sat, Nov 26, 2016 at 11:11 AM, lily li <chocol...@gmail.com> wrote: > >> Hi R users, >> >> I'm trying to manipulate a dataframe and have some difficulties. >> >> The original dataset is like this: >> >>

[R] about data manipulation

2016-11-30 Thread lily li
Hi R users, I'm trying to manipulate dataset, but met some difficulties. df year month flow 2006 33.5 2006 43.8 2006 521 2006 632 2007 34.1 2007 44.4 ... I want to calculate total flow for each year, and use the code

[R] About populating a dataframe in a loop

2017-01-06 Thread lily li
Hi R users, I have a question about filling a dataframe in R using a for loop. I created an empty dataframe first and then filled it, using the code: pre.mat = data.frame() for(i in 1:10){ mat.temp = data.frame(some values filled in) pre.mat = rbind(pre.mat, mat.temp) } However, the

Re: [R] About populating a dataframe in a loop

2017-01-06 Thread lily li
gt; } > > nrow(pre.mat) # should be 50 > > > Can you give us an example that doesn't work? > > Rui Barradas > > > Em 06-01-2017 18:00, lily li escreveu: > >> Hi R users, >> >> I have a question about filling a dataframe in R using a for loo

[R] about data format in R

2016-12-30 Thread lily li
Hi R users, I'm trying to read in data, and then plot time series data. However, I have some problems. In my dataset, the first column represents time, and in the format: mm/dd/-hr:min:sec; For example, 10/01/1995-00:00:00, 10/01/1995-06:00:00, etc. df: date

Re: [R] about data format in R

2016-12-30 Thread lily li
t 11:23 AM, Rui Barradas <ruipbarra...@sapo.pt> wrote: > Hello, > > Have you tried > > df$date <- as.POSIXct(dat$date, format = "%m/%d/%Y-%H:%M:%S") > > ? > > Hope this helps, > > Rui Barradas > > > > Em 30-12-2016 17:40, lily li escre

Re: [R] about data format in R

2016-12-31 Thread lily li
ds > > Duncan > > Duncan Mackay > Department of Agronomy and Soil Science > University of New England > Armidale NSW 2351 > Email: home: mac...@northnet.com.au > > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li >

Re: [R] about data format in R

2016-12-31 Thread lily li
I tried it, but it doesn't work. The time column is blank then. DF$time = substring(DF$time, first=as.Date('1999-01-01), last=as.Date('2005-12-30')) On Sat, Dec 31, 2016 at 10:52 AM, David Winsemius <dwinsem...@comcast.net> wrote: > > > On Dec 31, 2016, at 9:26 AM, lily li <c

Re: [R] about data format in R

2016-12-31 Thread lily li
Sorry, the problem has been solved. I found that strptime is a good function for this. DF$time2 = strptime(DF$time, format='%Y-%m-%d) On Sat, Dec 31, 2016 at 11:02 AM, lily li <chocol...@gmail.com> wrote: > I tried it, but it doesn't work. The time column is blank then. > DF$time =

Re: [R] about data format in R

2016-12-31 Thread lily li
unty" comic strip ) > > > On Sat, Dec 31, 2016 at 9:26 AM, lily li <chocol...@gmail.com> wrote: > > Hi all, > > > > Thanks for your help. Now I can convert data to the format "-mm-dd > > hh:mm:ss", but how to convert it to "-mm-dd&q

Re: [R] About populating a dataframe in a loop

2017-01-06 Thread lily li
01, 5); for (i in 1:1001) tmp[i,] <- > 1:5}) >user system elapsed > 0.001 0.000 0.001 > > dim(tmp) > [1] 10015 > > On Fri, Jan 6, 2017 at 11:46 PM, lily li <chocol...@gmail.com> wrote: > > Hi Rui, > > > > Thanks for your reply. Ye

[R] About concatenating strings

2017-01-05 Thread lily li
Hi R users, I'm trying to concatenate two strings, while each string has numbers. For example, strings1 = c(1.2, 1.31, 1.4, 1.51, etc), strings2= c(2.1, 2.22, 2.3, 2.44, etc). I want to have all decimals for the two strings, such as: strings1= c(1.20, 1.31, 1.40, 1.51, etc), string2 = c(2.10,

Re: [R] About concatenating strings

2017-01-05 Thread lily li
Sorry for the emails. I just checked and the problem is still there. Is there a proper way to reformat the decimal places, such as three or four decimal places? Thanks. If maintain four decimal places, the numbers are: 1.2000, 1.3100, 1.4000, etc. On Thu, Jan 5, 2017 at 10:46 PM, lily li <cho

Re: [R] About concatenating strings

2017-01-05 Thread lily li
I found that the last column is the digits 2.00, so the problem is solved. On Thu, Jan 5, 2017 at 10:42 PM, lily li <chocol...@gmail.com> wrote: > Hi R users, > > I'm trying to concatenate two strings, while each string has numbers. > For example, strings1 = c(1.2, 1.

Re: [R] About error in the panel

2017-03-11 Thread lily li
gt; > > 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 Sat, Mar 11, 2017 at 10:50 AM, lily li <cho

Re: [R] About error in the panel

2017-03-11 Thread lily li
(0)) 1: `$<-`(`*tmp*`, "Z", value = numeric(0)) I don't know what is the problem, as it works in the Console panel but not in the top left panel. Thanks for your help. On Sat, Mar 11, 2017 at 11:50 AM, lily li <chocol...@gmail.com> wrote: > Hi R users, > > I have a pr

[R] About error in the panel

2017-03-11 Thread lily li
Hi R users, I have a problem about using R studio. For example, there is a dataframe that has many columns. I want to aggregated column X and column Y into column Z. Column Z does not exist before the aggregation. I use the code below: df$Z = df$X + df$Y However, it does not work in the top left

Re: [R] About error in the panel

2017-03-11 Thread lily li
- Bert > > > 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 Sat, Mar 11, 2017 at 11:14 AM, lily li

Re: [R] About installing the lubridate package

2017-03-07 Thread lily li
ng 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 Tue, Mar 7, 2017 at 10:45 AM, lily li <chocol...@gmail.com> wrote: > > Hi R users, > >

Re: [R] About installing the lubridate package

2017-03-07 Thread lily li
Or if there is another way to get '', 'mm', and 'dd' from time variable 'dd-mm-'? Thanks very much. On Tue, Mar 7, 2017 at 11:45 AM, lily li <chocol...@gmail.com> wrote: > Hi R users, > > I'd like to ask that where to find the 'lubridate' package for Mac Sierra? >

[R] About installing the lubridate package

2017-03-07 Thread lily li
Hi R users, I'd like to ask that where to find the 'lubridate' package for Mac Sierra? I downloaded one version for OS X Mavericks binaries, but it does not work. The error message is as below: > install.packages("~/Downloads/lubridate_1.6.0.tar.gz", repos = NULL, type = "source") ERROR:

[R] error in installing igraph

2017-08-02 Thread lily li
Hi R users, I got warning messages when installing the package, and I pasted the messages below. I checked updates that my R-studio is already the newest version. I don't know how to solve the problem. Thanks for your help. > library(igraph) Error in dyn.load(file, DLLpath = DLLpath, ...) :

Re: [R] About doing figures

2017-07-16 Thread lily li
color<-factor(dfm$A) > plot(dfm$B,dfm$C,pch=ifelse(dfm$DF==1,1,19), > col=rainbow_colors[as.numeric(dfm$Acolor)]) > legend("bottom",legend=sort(unique(dfm$A)), > fill=rainbow_colors) > legend(25,35,c("DF=1","DF=2"),pch=c(1,19)) > > Jim > >

Re: [R] About doing figures

2017-07-16 Thread lily li
, 2017 at 9:28 AM, lily li <chocol...@gmail.com> wrote: > Hi Jim, > > For true color, I meant that the points in the figure do not correspond to > the values from the dataframe. Also, why to use rainbow(9) here? And the > legend is straight in the middle, is it possible to re

[R] about plotting a special case

2017-07-12 Thread lily li
Hi R users, I have a question about plotting. There is the dataframe below, while each row represents a record. If I want to plot on a A-B plot, i.e., x-axis represents A, while y-axis represents B values. However, I want to plot the mean value from records 1-10 as one point, while the 10th and

Re: [R] about plotting a special case

2017-07-12 Thread lily li
ls=FALSE,col="red") > > The same code will work for a second data frame, except that you would > use "points" instead of "plot" and change the color. You may also have > to specify xlim and ylim in the first call to "plot" so that all > values are

[R] About doing figures

2017-07-15 Thread lily li
Hi R users, I still have the problem about plotting. I wanted to put the datasets on one figure, x-axis represents values B, y-axis represents values C, while different colors label column A. Each record uses a circle on the figure, while hollow circles represent DF=1 and solid circles represent

[R] about installing smwrGraphs package

2017-07-22 Thread lily li
Hi R users, I'm trying to install the package, but got the error and don't know how to fix it. Can anyone help me? Thanks very much. install.packages("smwrGraphs", repos=c("http://owi.usgs.gov/R",; http://cran.us.r-project.org;), dependencies = TRUE) Error in install.packages : Line starting '

Re: [R] about installing smwrGraphs package

2017-07-24 Thread lily li
It is working now. I don't know where's the problem. thanks for your help. On Sun, Jul 23, 2017 at 12:33 PM, peter dalgaard <pda...@gmail.com> wrote: > > > On 23 Jul 2017, at 18:31 , Uwe Ligges <lig...@statistik.tu-dortmund.de> > wrote: > > > > > > >

[R] about reading files in order

2017-06-29 Thread lily li
Hi R users, I have a question about opening the txt files and putting them into a matrix. The txt files are in the folder01, while they have the name file.1.txt, file.2.txt, file.3.txt, etc. There are about 200 such text files. Each txt file contains one value inside. When I tried to use the code

Re: [R] about reading files in order

2017-06-29 Thread lily li
01", full.names = TRUE), >> you get the full paths rather name just the file names, i.e. you don't >> have to use file.path(). >> >> /Henrik >> >> On Thu, Jun 29, 2017 at 12:04 PM, lily li <chocol...@gmail.com> wrote: >> > Hi R users,

Re: [R] about reading files in order

2017-06-30 Thread lily li
; pathetic excuses of nothings that should eat a bullet for their next meal > instead of bull SHIT ( although I know they like the taste of shit) (its a > favorite of ]r[ist subscribers ) > > Show quoted text > > 15:04, "lily li" <chocol...@gmail.com> wrote: > > &

Re: [R] about adding a column for water year

2017-07-04 Thread lily li
of a C like > for() loop should be avoided when possible, as it could be here. > > If I have made an error in understanding what you are doing, please do > let us all know. I get it wrong from time to time. > > Cheers, > Bert > > Bert Gunter > > "The trouble wi

[R] about adding a column for water year

2017-07-04 Thread lily li
Hi R users, I have a question about adding a column for water year. The dataframe has the structure below. But the wyear column just shows one year. Could anyone help me with this problem? Thanks. DF year month day timeflow 1972 1 11972-01-01 5 1972

[R] about saving format

2017-08-05 Thread lily li
Hi R users, I am using the plot() function, but have a problem. When saving as pdf format, the ‰ sign in the x-axis label becomes (...) sign. I prefer to save in pdf, as this format has a higher resolution than jpeg or other picture formats. Could anyone tell me how to do then? Thanks.

Re: [R] about saving format

2017-08-05 Thread lily li
In the lower right panel of R-studio interface, there is the "Export" button. I saved as PDF from there directly, rather than using functions On Sat, Aug 5, 2017 at 6:18 PM, Ismail SEZEN <sezenism...@gmail.com> wrote: > > > On 6 Aug 2017, at 03:01, lily li <chocol...

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
un...@r-project.org] On Behalf Of lily li > Sent: Tuesday, May 09, 2017 10:39 AM > To: R mailing list <r-help@r-project.org> > Subject: [R] About calculating average values from several matrices > > Hi R users, > > I have a question about manipulating the data. > For ex

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
s, > Charles > > On Tue, May 9, 2017 at 9:52 AM, lily li <chocol...@gmail.com> wrote: > >> I meant for each cell, it takes the average from other dataframes at the >> same cell. I don't know how to deal with row names and col names though, >> so >> it has the

[R] About calculating average values from several matrices

2017-05-09 Thread lily li
Hi R users, I have a question about manipulating the data. For example, there are several such data frames or matrices, and I want to calculate the average value from all the data frames or matrices. How to do it? Also, should I convert them to data frame or matrix first? Right now, when I use

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
orm(100), 10, 10) > > } > > > > ### mean over all cells > > sapply(myData, function(x) mean(x)) > > > > ### mean over all columns > > sapply(myData, function(x) colMeans(x)) > > > > > > > > > > > > *From:*

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
Yes, that means to control decimal numbers. For example, use round(2.3122, digits=1), it gets 2.3 On Tue, May 9, 2017 at 9:11 AM, Doran, Harold <hdo...@air.org> wrote: > ?round > > > > > > *From:* lily li [mailto:chocol...@gmail.com] > *Sent:* Tuesday, May 09,

Re: [R] About calculating average values from several matrices

2017-05-09 Thread lily li
as expected > > > > *From:* lily li [mailto:chocol...@gmail.com] > *Sent:* Tuesday, May 09, 2017 11:13 AM > *To:* Doran, Harold <hdo...@air.org> > *Cc:* Charles Determan <cdeterma...@gmail.com>; R mailing list < > r-help@r-project.org> > > *Subject:* Re

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
: > > plot(y) > lines(supsmu(1:20,y)) > lines(0.6*cos((1:20)/3+0.6*pi)+17.2) > > Jim > > > On Wed, Jun 21, 2017 at 9:17 AM, lily li <chocol...@gmail.com> wrote: > > Hi R users, > > > > I have a question about fitting a cosine curve. I don't know

[R] fitting cosine curve

2017-06-20 Thread lily li
Hi R users, I have a question about fitting a cosine curve. I don't know how to set the approximate starting values. Besides, does the method work for sine curve as well? Thanks. Part of the dataset is in the following: y=c(16.82, 16.72, 16.63, 16.47, 16.84, 16.25, 16.15, 16.83, 17.41, 17.67,

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
Thanks. I will do a trial first. Also, is it okay to have the datasets that have only part of the cycle, or better to have equal or more than one cycle? That is to say, I cannot have the complete datasets sometimes. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen wrote:

Re: [R] fitting cosine curve

2017-06-20 Thread lily li
I'm trying the different parameters, but don't know what the error is: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Thanks for any suggestions. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen wrote: > > If you

[R] About change columns and specific rows in R

2017-05-22 Thread lily li
Hi R users, I have a question about manipulating the dataframe. I want to create a new dataframe, and to multiply rows with different seasons for different constants. DF year month day product1 product2 product3 1981 1 1 18 5620 1981 1

Re: [R] About change columns and specific rows in R

2017-05-23 Thread lily li
t; >> (filled with NA values), then specify the precise rows and columns on > >> both the left and right hand sides of the assignment operator that > >> will be altered. Luckily, this is pretty easy...just remember to use > >> which() on the right hand side of the a

Re: [R] about combining two dataframes

2017-05-24 Thread lily li
ve the > same number of rows. > > HTH > Ulrik > > > > On Wed, 24 May 2017 at 19:30 lily li <chocol...@gmail.com> wrote: > >> Hi all, >> >> I have a question about combining two data frames. For example, there are >> the two dataframes below,

  1   2   >