Re: [R] How to aggregate values in corresponding dataframes

2019-03-25 Thread lily li
. You would have to with read.csv. > > > > > > old_dir <- setwd("~/directory") > > f1990 <- list.files(pattern = "^199.*\\.txt$") > > r1990 <- lapply(f1990, read.table) > > setwd(old_dir) > > > > > > Hope thi

[R] How to aggregate values in corresponding dataframes

2019-03-25 Thread lily li
Hi R users, I have multiple dataframes in a directory, and with the same postfix ".txt". Each dataframe is a gridded file with just values, but each value represents one grid cell. There are many years, and each year has 12 months, so there are many such files. For each year, I want to read the

Re: [R] How to create gridded data

2019-03-25 Thread lily li
- data.frame(as.table(as.matrix(DF2))) > > colnames(DF3) <- c("latitude", "longitude", "Precip") > > DF3$latitude <- as.numeric(as.character(DF3$latitude)) > > DF3$longitude <- as.numeric(as.character(DF3$longitude)) > > ----

Re: [R] How to create gridded data

2018-11-13 Thread lily li
0 > > > David L Carlson > Department of Anthropology > Texas A University > College Station, TX 77843-4352 > > > -Original Message- > From: R-help On Behalf Of Sarah Goslee > Sent: Tuesday, November 13, 2018 8:16 AM &

[R] How to create gridded data

2018-11-12 Thread lily li
Hi R users, I have a question about manipulating data. For example, I have DF1 as the following, how to transform it to a gridded dataset DF2? In DF2, each value Precip is an attribute of the corresponding grid cell. So DF2 is like a spatial surface, and can be imported to ArcGIS. Thanks for your

Re: [R] how to exclude certain keywords in strings

2018-10-11 Thread lily li
I just figured this out, which seems to be a simple question. I just used gsub("_temp.csv","","StationName1_temp.csv"). > Hi R users, > > I don't know how to extract certain words in strings. For example, if I > have strings like the formats "StationName1_temp.csv", > "StationName2_temp.csv",

[R] how to exclude certain keywords in strings

2018-10-11 Thread lily li
Hi R users, I don't know how to extract certain words in strings. For example, if I have strings like the formats "StationName1_temp.csv", "StationName2_temp.csv", etc. How to get strings like these "StationName1", "StationName2", etc? That is to say, I want to exclude the keywords "_temp.csv",

Re: [R] Open netcdf file in linux

2018-09-18 Thread lily li
e that file in your current directory via your operating system? > > On September 17, 2018 11:53:22 PM PDT, lily li > wrote: > >Thanks, you are right that the file path is not correct. I just typed: > >nc_open("file.nc"), and it gave the error above. > > > >

[R] Problem in installing rgdal package in linux

2018-09-18 Thread lily li
Hi all, I am installing rgdal package in linux for R, and got the error below. I typed: $ install.packages("rgdal", repos= "http://cran.us.r-project.org;) What is the problem and how to correct it? Thanks for your kind help. == print the error message here

Re: [R] Open netcdf file in linux

2018-09-18 Thread lily li
xample of a file that yields this error. My best > blind guess is that you have not given the name of an ncdf file to the > function. > > On September 17, 2018 9:44:45 PM PDT, lily li wrote: > >Hi R users, > > > >I have installed ncdf4 package in R from the linux termin

[R] Open netcdf file in linux

2018-09-17 Thread lily li
Hi R users, I have installed ncdf4 package in R from the linux terminal, but have met this problem when using nc_open to open a .nc file. What is the problem? Any help would be appreciated. Error in R_nc4_open: Is a directory [[alternative HTML version deleted]]

Re: [R] how to plot gridded data

2018-09-13 Thread lily li
I think it may be feasible to transform the dataset DF, so that the column names lat_lon can be a surface, where the values locate at each surface. But I don't know how to transform DF. On Fri, Sep 14, 2018 at 10:02 AM, lily li wrote: > Hi Petr, > > I have merged the data us

Re: [R] how to plot gridded data

2018-09-13 Thread lily li
ues by suitable command(s) ?plot, ?ggplot > 4. If you want more specific answer, please post more specific question, > preferably with concise and clear example. > 5. Avoid posting in HTML > > Cheers > Petr > > > -Original Message----- > > From: R-help On Behalf Of

[R] how to plot gridded data

2018-09-12 Thread lily li
Hi R users, I have a question about plotting gridded data. I have the files separately, but do not know how to combine them. For example, each txt file has daily precipitation data at a specific grid cell, named pr_lat_lon.txt. How to plot all txt files for one surface (which is rectangular in

Re: [R] How to average values from grid cells with coordinates

2018-05-21 Thread lily li
Hi Jim, Thanks. It works. I now have more complex problems. If at each blackcell, there are two variables such as pop and mood. For each variable, there are daily records in one year, so 365 records for pop and 365 records for mood. The averaged values for the redcells should be daily records

Re: [R] How to average values from grid cells with coordinates

2018-05-18 Thread lily li
1]]]$pop + > blackcells[[close4[2]]]$pop + blackcells[[close4[3]]]$pop + > blackcells[[close4[4]]]$pop)/4 > print(blackcells[[close4[1]]]) > print(blackcells[[close4[2]]]) > print(blackcells[[close4[3]]]) > print(blackcells[[close4[4]]]) > print(redcell) > > As you can see

Re: [R] add single points to a level plot

2018-03-08 Thread lily li
rasterVis' > > > library(rasterVis) > > HTH, > Eric > > > On Thu, Mar 8, 2018 at 5:11 PM, lily li <chocol...@gmail.com> wrote: > >> Hi all, >> >> I ran the code: >> > s <- stack(replicate(2, raster(matrix(runif(100), 10 >> >

Re: [R] add single points to a level plot

2018-03-08 Thread lily li
r', 'RasterStackBrick', 'BasicRaster')" what is the problem? Thanks. On Thu, Mar 8, 2018 at 12:07 AM, lily li <chocol...@gmail.com> wrote: > Hi all, > > I'm trying to add single points with known coordinates to a level plot, > but could not find the proper answer. I got to know

[R] add single points to a level plot

2018-03-07 Thread lily li
Hi all, I'm trying to add single points with known coordinates to a level plot, but could not find the proper answer. I got to know that layer() function is good for this, but I don't know which package is related to this function. The source is here:

Re: [R] error in loading rgdal package

2018-02-16 Thread lily li
Hi Loris, Thanks. I tried to update the R software and reinstalled the GDAL library. It works now. On Thu, Feb 15, 2018 at 11:49 PM, Loris Bennett <loris.benn...@fu-berlin.de> wrote: > Hi Lily, > > lily li <chocol...@gmail.com> writes: > > > Hi R users, &g

[R] error in loading rgdal package

2018-02-15 Thread lily li
Hi R users, Could you help me to see this problem? I could now load "rgdal" even though I downloaded the compressed folder. Thanks for your help. Loading required package: sp Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object

Re: [R] Steps to create spatial plots

2018-01-16 Thread lily li
;ericjber...@gmail.com> wrote: > If layer$z is a matrix and you want to reverse the order of the rows, you > can do: > > n <- nrow(layer$z) > layer$z <- layer$z[ n:1, ] > > HTH, > Eric > > > On Tue, Jan 16, 2018 at 8:43 AM, lily li <chocol...@gmail.com>

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
15, 2018 at 10:58 PM, lily li <chocol...@gmail.com> wrote: > Hi Bert, > > I think you are correct that I can use levelplot, but I have a question > about converting data. For example, the statement: > levelplot(Z~X*Y), Z is row-wise from the lower left corner to the upper

Re: [R] Steps to create spatial plots

2018-01-15 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 Mon, Jan 15, 2018 at 4:54 PM, lily li <chocol...@gmail.com> wrote: > >> Hi Roman, >> >> T

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
uot; > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Mon, Jan 15, 2018 at 4:54 PM, lily li <chocol...@gmail.com> wrote: > >> Hi Roman, >> >> Thanks for your reply. For the spatial coordinates layer, I just have >>

Re: [R] Steps to create spatial plots

2018-01-15 Thread lily li
p://www.datacarpentry.org/R-spatial-raster-vector- > lesson/10-vector-csv-to-shapefile-in-r/ > > > Cheers, > Roman > > On Mon, Jan 15, 2018 at 11:22 PM, lily li <chocol...@gmail.com> wrote: > >> Hi users, >> >> I have no clear clue about plotting spatial dat

[R] Steps to create spatial plots

2018-01-15 Thread lily li
Hi users, I have no clear clue about plotting spatial data. For example, I just have a table with attribute values of each grid cell, such as elevation. Then I have coordinates of the upper left corner in UTM, the number of rows and columns, and grid cell size. How to create spatial plot of

Re: [R] Errors in reading in txt files

2017-12-15 Thread lily li
project.org on behalf of istaz...@gmail.com> wrote: > > On Thu, Dec 14, 2017 at 1:58 PM, Berend Hasselman <b...@xs4all.nl> > wrote: > > > >> On 14 Dec 2017, at 19:36, lily li <chocol...@gmail.com> wrote: > >> > >&

Re: [R] Errors in reading in txt files

2017-12-14 Thread lily li
Thanks, Berend. I thought R can recognize the space automatically, such as na.strings="", or sep=' '. On Thu, Dec 14, 2017 at 11:58 AM, Berend Hasselman <b...@xs4all.nl> wrote: > > > On 14 Dec 2017, at 19:36, lily li <chocol...@gmail.com> wrote: > > >

[R] Errors in reading in txt files

2017-12-14 Thread lily li
Hi R users, I have a question about reading from text files. The file has the structure below: TimeColumn1 Column2 01.01.2001-12:00:00 01.01.2001-24:00:0012 11 01.02.2001-12:00:0013 10 01.02.2001-24:00:0011

[R] about taylor.diagram

2017-10-10 Thread lily li
Hi R users, I don't know if you have used taylor.diagram function. Why my diagram is not like 1/4th of a round shape, but more flat, like 1/4th of an oval? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To

Re: [R] About multiple panels with limited space in-between

2017-10-10 Thread lily li
n Tue, Oct 10, 2017 at 2:41 PM, lily li <chocol...@gmail.com> wrote: > Hi R users, > > I have a question about plotting. The following two datasets are an > example. What I have in mind is like the attached figure, but just have two > rows, top row is for DF1, bottom row is for

[R] About multiple panels with limited space in-between

2017-10-10 Thread lily li
Hi R users, I have a question about plotting. The following two datasets are an example. What I have in mind is like the attached figure, but just have two rows, top row is for DF1, bottom row is for DF2. The top and bottom rows, have x-axis as var1, var2, var3, etc, while the y-axis represents

Re: [R] about multi-optimal points

2017-08-26 Thread lily li
] > > ggplot(data=sub_test_df2, aes(x=v1,y=v2, colour = as.factor(ID))) + > geom_point()+ theme_bw()+ > xlab('Variable 1')+ ylab('Variable 2') > > HTH > Ulrik > > On Fri, 25 Aug 2017 at 21:38 lily li <chocol...@gmail.com> wrote: > >> Hi R users, >

[R] about multi-optimal points

2017-08-25 Thread lily li
Hi R users, I have some sets of variables and put them into one dataframe, like in the following. How to choose a specific set of pareto front, such as 10 from the current datasets (which contains more than 100 sets)? And how to show the 10 points on one figure with different colors? I can put

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...

[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.

[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 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 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 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

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 > >

[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

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 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 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

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 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,

[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] 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

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
: > > 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] [FORGED] About error bars on barplots

2017-06-17 Thread lily li
18/06/17 12:10, lily li wrote: > >> Hi R users, >> >> I have a question about adding uncertainty bars to stacked bar plots. >> >> DF: >>year A B C Amin Amax Bmin Bmax Cmin Cmax >> 2009 40 45 15 30 61 23 56 1

[R] About error bars on barplots

2017-06-17 Thread lily li
Hi R users, I have a question about adding uncertainty bars to stacked bar plots. DF: year A B C Amin Amax Bmin Bmax Cmin Cmax 2009 40 45 15 30 61 23 56 14 17 2010 36 41 23 26 54 22 51 22 24 I use the code below:

Re: [R] about fitting a regression line

2017-06-15 Thread lily li
e function like - sin, cos, log, exp... > > Cheers > Petr > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li > > Sent: Thursday, June 15, 2017 1:28 AM > > To: MacQueen, Don <macque...@llnl.gov> > >

Re: [R] about fitting a regression line

2017-06-14 Thread lily li
wrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > On 6/14/17, 3:40 PM, "R-help on behalf of lily li" < > r-help-boun...@r-project.org on behalf of chocol...@gmail.com> wrote: > > Hi R users, &g

[R] about fitting a regression line

2017-06-14 Thread lily li
Hi R users, I have some data points (Xi, Yi), and they may follow such a pattern Yi = cCOS(Xi) + d, how to find the c and d in R? which function to use? Also, how to get the R2 and p value for this correlation? Thanks for any kind of help. [[alternative HTML version deleted]]

Re: [R] about combining two dataframes

2017-05-24 Thread lily li
28 > # 4 1981 1 4 19 50 21 > # 5 1981 2 1 17 49 25 > # 6 1981 2 2 20 47 23 > # 7 1981 2 3 21 52 27 > > The attached .png image file shows you how to send plain text emails to >

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,

[R] about combining two dataframes

2017-05-24 Thread lily li
Hi all, I have a question about combining two data frames. For example, there are the two dataframes below, with the same structure but different column names and column lengths. How to add the values in DF2 to the end of DF1, though the column names do not match? How to add more than two?

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

[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 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] 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
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

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
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

[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 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 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 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:

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 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

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 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 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.

[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 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
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
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 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-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

[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

[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

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-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

[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] 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] 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

  1   2   >