Re: [R] Sum every n (4) observations by group

2021-12-19 Thread Miluji Sb
but if I do, assuming your data > frame is assigned to a variable named df, I would do something like > > sumNs = function(x, n) > { >if (length(x) %%n !=0) stop("Length of 'x' must be a multiple of 'n'.") >n1 = length(x)/n >ind = rep(1:n1, each = n

[R] Sum every n (4) observations by group

2021-12-19 Thread Miluji Sb
Dear all, I have a dataset (below) by ID and time sequence. I would like to sum every four observations by ID. I am confused how to combine the two conditions. Any help will be highly appreciated. Thank you! Best. Milu ## Dataset structure(list(ID = c("A", "A", "A", "A", "A", "A", "A", "A", "B

Re: [R] rbind common header to file list

2021-01-21 Thread Miluji Sb
Thank you, that was it. Best, Milu On Wed, Jan 20, 2021 at 1:33 PM Eric Berger wrote: > for ( file in filelist ) > > > > On Wed, Jan 20, 2021 at 2:21 PM Miluji Sb wrote: > >> Thank you for your reply and the solution. Yes, I would like the date to >> be >>

Re: [R] rbind common header to file list

2021-01-20 Thread Miluji Sb
I think you want. > I would actually write to a new filename (sub folder?) To avoid disaster! > > > > > > On 19 Jan 2021 23:45, Miluji Sb wrote: > > Dear all, > > I have more than 200 text files in a folder without header - example > below. > I would like to

[R] rbind common header to file list

2021-01-19 Thread Miluji Sb
Dear all, I have more than 200 text files in a folder without header - example below. I would like to read, add a common date header to all the files, and write (replace) the files. ## Read files filelist = list.files(pattern = ".*.txt") datalist = lapply(filelist, function(x)read.table(x, header

Re: [R] Year and month from a sequence

2020-07-16 Thread Miluji Sb
vector of integers. > > > start + months(1:(4139 - 2400)) > > > > Then extract the months. > > month(start) > month(end) > month(start + months()) > month(start + months(4139 - 2400)) > > > Hope this helps, > > Rui Barradas > > Às 23:26 de 1

[R] Year and month from a sequence

2020-07-14 Thread Miluji Sb
Dear all, I have a panel dataset with a large number of groups (200K+) with a sequence representing the month of the observations (2400 - 4139). The data is from January 1861 to December 2005. My goal is to extract the corresponding month and year for each observation. I tried the following; x$dt

[R] Extract NASA VIIRS data in R

2020-03-18 Thread Miluji Sb
Dear all, Hope everyone is keeping safe. I am trying to extract/read VIIRS nighttime lights data but the output seems rather strange. I have uploaded the file here so as not exceed the size limit of the email. ## Code ## libra

[R] Match coordinates to regional polygon

2020-03-09 Thread Miluji Sb
Dear all, I am trying to match a large number of coordinates (attached) sub-national regions using GADM shapefile. Coordinates: https://drive.google.com/file/d/1PUsi4d0wP7hB6Aps6UmpXsnIPSD3I1sT/view?usp=sharing Shapefile: https://drive.google.com/drive/folders/1DxyygjQNeg2GIS9doaFM8yM2LvBYZi8E?u

Re: [R] Sequential date by group

2019-09-03 Thread Miluji Sb
id ) > > ## dplyr > library(dplyr) > x2 <- ( x >%>% mutate( Y = as.integer( format( startdate, format = "%Y" ) ) ) >%>% group_by( id ) >%>% mutate( Year = Y + 12L * ( ( month - 1L ) %/% 12L ) > , Month = ( mo

[R] Sequential date by group

2019-09-02 Thread Miluji Sb
Dear all, I have a panel data with a large number of groups and the cumulative number of months (1 - 372) for January 1995 to December 2005. My goal is to extract the corresponding month and year for each observation. I tried the following; ### x %>% group_by(id) %>% do( data.frame(., Date=

[R] Plot coordinates on world map with Robinson CRS - ggplot2

2019-02-18 Thread Miluji Sb
Dear all, I am trying to plot coordinates on a world map with Robinson CRS. While the world map is generated without any issues, when I try to plot the points - I only get a single point. The code I am using and the coordinates data is below. What am I doing wrong? Any help/suggestions will be hi

[R] Obtain coordinates for city names

2018-11-06 Thread Miluji Sb
I have a dataframe (more than 50,000 observations), of cities in the EU. My goal is to assign NUTS-2 code to each of these cities. However, I am not aware of any direct way of achieving this, so I wanted to first assign coordinates to the cities and then use the 'over' function to match with NUTS

[R] Smoothing by group - Panel data - exponential/loess

2018-10-07 Thread Miluji Sb
Dear all, I have panel data for a series (g) for three time periods. The variable is likely autocorrelated. I would like to generate a new variable using exponential/loess smoothing by group (gid). For time series, I could have done something like this; smoothdf <- data.frame( x = 1:n, y = a

Re: [R] Marginal effects with plm

2018-09-06 Thread Miluji Sb
es. > > --Ista > > On Wed, Sep 5, 2018 at 6:30 PM Miluji Sb wrote: > > > > Dear all, > > > > I am running the following panel regression; > > > > plm1 <- plm(formula = log(y) ~ x1 + I(x1^2) + heat*debt_dummy + tt, data > = > > df, index=c

Re: [R] Marginal effects with plm

2018-09-06 Thread Miluji Sb
Dear John, Apologies for not providing reproducible example. I just tried with a plm example but ran into the same issue; library(plm) data("Produc", package = "plm") zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = Produc, index = c("state","year")) Ef.hd <- Effect(c("pc", "e

Re: [R] Marginal effects with plm

2018-09-06 Thread Miluji Sb
I hope this helps, > John > > -- > John Fox, Professor Emeritus > McMaster University > Hamilton, Ontario, Canada > Web: socialsciences.mcmaster.ca/jfox/ > > > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-pro

[R] Marginal effects with plm

2018-09-05 Thread Miluji Sb
Dear all, I am running the following panel regression; plm1 <- plm(formula = log(y) ~ x1 + I(x1^2) + heat*debt_dummy + tt, data = df, index=c("region","year")) where 'df' is a pdata.frame. I would like to obtain marginal effects of 'y' for the variable 'x1'. I have tried the packages 'prediction

Re: [R] Subset Rasterbrick by time

2018-06-19 Thread Miluji Sb
18 Jun 2018, 22:09 David Winsemius, > wrote: > >> >> >> > On Jun 18, 2018, at 7:21 AM, Miluji Sb wrote: >> > >> > Dear all, >> > >> > I have a rasterbrick with the date/time information provided which I >> would >&

[R] Subset Rasterbrick by time

2018-06-18 Thread Miluji Sb
Dear all, I have a rasterbrick with the date/time information provided which I would like to subset by year. However, when I use the following code for sub-setting; new_brick <- subset(original, which(getZ( original ) >= as.Date("2000-01-01 10:30:00") & getZ(original ) <= as.Date("2014-12-31 10

Re: [R] Convert daily data to weekly data

2018-05-30 Thread Miluji Sb
86.1. 16.0 > 2 2 1986.1. 16.0 > 3 3 1986.1. 17.9 > 4 4 1986.1. 16.0 > 5 5 1986.1. 17.9 > 6 6 1986.1. 16.0 > > > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me wha

Re: [R] Convert daily data to weekly data

2018-05-29 Thread Miluji Sb
-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a > podléhají tomuto právně závaznému prohlášení o vyloučení odpovědnosti: > https://www.precheza.cz/01-dovetek/ | This email and any documents > attached to it may be confidential and are subject to the legally binding > disclaimer: https

[R] Convert daily data to weekly data

2018-05-29 Thread Miluji Sb
Dear all, I have daily data in wide-format from 01/01/1986 to 31/12/2016 by ID. I would like to convert this to weekly average data. The data has been generated by an algorithm. I know that I can use the lubridate package but that would require me to first convert the data to long-form (which is

Re: [R] Bilateral matrix

2018-05-17 Thread Miluji Sb
ls <- sort(union(x,y)) > > x <- factor(x, levels = lvls) > > y <- factor(y, levels = lvls) > > > xtabs( ~ x + y) >y > x a b c d e > a 0 0 1 0 0 > b 0 0 0 0 1 > c 0 0 1 0 0 > d 0 0 1 1 1 > e 0 0 1 1 0 > > Cheers, > Bert > &

Re: [R] Bilateral matrix

2018-05-16 Thread Miluji Sb
uot;, >> "New York"), class = "factor"), previous_location = structure(c(6L, >> 2L, 4L, 6L, 7L, 5L, 1L, 3L, 6L, 2L, 6L, 2L, 4L, 6L, 7L), .Label = >> c("Atlanta", >> "Austin", "Cleveland", "Houston", "New Orle

[R] Bilateral matrix

2018-05-08 Thread Miluji Sb
I have data on current and previous location of individuals. I would like to have a matrix with bilateral movement between locations. I would like the final output to look like the second table below. I have tried using crosstab() from the ecodist but I do not have another variable to measure the

Re: [R] Overlay line on a bar plot - multiple axis

2018-04-30 Thread Miluji Sb
Dear Jim and Ron, Thank you very much. Both the solutions are very neat and working. Appreciate all your help. Sincerely, Milu On Mon, Apr 30, 2018 at 12:28 PM, Ron Crump wrote: > Hi Miluji, > > Using Jim's interpretation of your desired graph, > you could do it in ggplot2 using your dat DF b

[R] Overlay line on a bar plot - multiple axis

2018-04-29 Thread Miluji Sb
Dear all, I am trying to make a similar plot - https://peltiertech.com/images/2013-09/BarLineSampleChart4.png. I have data for two variables; count and z by city and week. I would like to have a horizontal bar plot of *count* by city and a line plot of weekly average of the variable *z*. I have

Re: [R] Take average of previous weeks

2018-03-26 Thread Miluji Sb
t; > > > > > 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 Sun, Mar 25, 2018 at 7:48 AM, Milu

[R] Take average of previous weeks

2018-03-25 Thread Miluji Sb
Dear all, I have weekly data by city (variable citycode). I would like to take the average of the previous two, three, four weeks (without the current week) of the variable called value. This is what I have tried to compute the average of the two previous weeks; df = df %>% mutate(value.lag1 =

Re: [R] Take the maximum of every 12 columns

2018-02-21 Thread Miluji Sb
## user system elapsed > > ## 0.109 0.000 0.109 > > system.time(r2 <- apply(x,1,max)) > > ## user system elapsed > > ## 1.292 0.024 1.321 > > system.time(r3 <- rowMaxs(x)) > > ## user system elapsed > > ## 0.044 0.000 0.

Re: [R] Take the maximum of every 12 columns

2018-02-20 Thread Miluji Sb
age. > > Best, > Ista > > On Tue, Feb 20, 2018 at 9:55 AM, Miluji Sb wrote: > > Dear all, > > > > I have monthly data in wide format, I am only providing data (at the > bottom > > of the email) for the first 24 columns but I have 2880 columns in total. >

Re: [R] Take the maximum of every 12 columns

2018-02-20 Thread Miluji Sb
g him to perform a post-mortem examination: he may be >> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher >> The plural of anecdote is not data. ~ Roger Brinner >> The combination of some data and an aching desire for an answer does >> not ensure that a rea

[R] Take the maximum of every 12 columns

2018-02-20 Thread Miluji Sb
Dear all, I have monthly data in wide format, I am only providing data (at the bottom of the email) for the first 24 columns but I have 2880 columns in total. I would like to take max of every 12 columns. I have taken the mean of every 12 columns with the following code: byapply <- function(x,

[R] GAM Poisson

2017-12-14 Thread Miluji Sb
Dear all, I apologize as this may not be a strictly R question. I am running GAM models using the mgcv package. I was wondering if the interpretation of the smooth splines of the 'x' variable is the same in the following two cases: # Linear probability model m1 <- gam(count ~ factor(city) + fact

Re: [R] Error in Zero inflated model (ziP) with bam

2017-11-06 Thread Miluji Sb
. > > Other than that, sorry, no clue. > > Cheers, > 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&qu

[R] Error in Zero inflated model (ziP) with bam

2017-11-06 Thread Miluji Sb
Dear all, I am trying to use 'bam' to run the following generalized additive model: ### m <- bam(result ~ factor(city) + factor(year) + lnpopulation + s(lnincome_pc) + ,data=full_df,na.action=na.omit,family=ziP(theta = NULL, link = "identity",b=0)) But getting the following error: ### Error in

[R] Skip error in downloading file in loop

2017-10-21 Thread Miluji Sb
I am trying to download data from NASA web-service. I am using the following code; for( i in 1:8) { target1 <- paste0(" https://hydro1.gesdisc.eosdis.nasa.gov/daac-bin/access/timeseries.cgi?variable=NLDAS:NLDAS_FORA0125_H.002:TMP2m&location=GEOM:POINT( ", cities[i, "lon_nlda

Re: [R] Download data from NASA for multiple locations - RCurl

2017-10-16 Thread Miluji Sb
quot;state", "lon", "lat"), row.names = c(NA, 5L), class = "data.frame") ### Apologies if this seems trivial but I have been having a hard time. Thank you again. Sincerely, Milu On Mon, Oct 16, 2017 at 7:13 PM, David Winsemius wrote: > > > On Oct 15, 2017, at

Re: [R] Download data from NASA for multiple locations - RCurl

2017-10-15 Thread Miluji Sb
;Boston", class = "factor"), state = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = " MA ", class = "factor"), lon = c(-71.06, -71.06, -71.06, -71.06, -71.06, -71.06), lat = c(42.36, 42.36, 42.36, 42.36, 42.36, 42.36)), .Names = c("year", "mo

[R] Download data from NASA for multiple locations - RCurl

2017-10-15 Thread Miluji Sb
Dear all, i am trying to download time-series climatic data from GES DISC (NASA) Hydrology Data Rods web-service. Unfortunately, no wget method is available. Five parameters are needed for data retrieval: variable, location, startDate, endDate, and type. For example: ### https://hydro1.gesdisc.e

Re: [R] ISO3 code to 7 continents names

2017-09-07 Thread Miluji Sb
Thu, Sep 7, 2017 at 9:00 PM, David Winsemius wrote: > > > On Sep 7, 2017, at 11:36 AM, Miluji Sb wrote: > > > > Dear all. > > > > Is it possible to convert.identify iso3 country names to the seven > > continent names? > > > > # Asia, Africa

[R] ISO3 code to 7 continents names

2017-09-07 Thread Miluji Sb
Dear all. Is it possible to convert.identify iso3 country names to the seven continent names? # Asia, Africa, Antarctica, Australia, Europe, South America, and North America, I have tried the following: ### region <- merge(countryExData,df,by.x='ISO3V10',by.y='iso3') where df is the name of my

Re: [R] Prediction with two fixed-effects - large number of IDs

2017-06-17 Thread Miluji Sb
s. > > Also, your use of I() is broken and redundant. I think formulas > > lny ~ id + year + x1 + I(x1^2) + x2 + I(x2^2) > > or > > lny ~ id + year + x1^2 + x2^2 > > would obtain the intended prediction results. > > -- > Sent from my phone. Please excuse my bre

[R] Prediction with two fixed-effects - large number of IDs

2017-06-17 Thread Miluji Sb
Dear all, I am running a panel regression with time and location fixed effects: ### reg1 <- lm(lny ~ factor(id) + factor(year) + x1+ I(x1)^2 + x2+ I(x2)^2 , data=mydata, na.action="na.omit") ### My goal is to use the estimation for prediction. However, I have 8,500 IDs, which is resulting in v

[R] Problem with Zelig - gam.poisson

2016-12-23 Thread Miluji Sb
I am getting the following error when trying to run a gam.possion model with Zelig. Error in eval(expr, envir, enclos) : attempt to apply non-function Even the example won't run. library(mgcv) library(Zelig) n <- 400 sig <- 2 x0 <- runif(n, 0, 1); x1 <- runif(n, 0, 1) x2 <- runif(n, 0, 1); x3 <

Re: [R] Reshape to wide format

2016-12-22 Thread Miluji Sb
129 > 9 9 0.000 NA > 1010 0.000 NA > 1111 0.1215360 NA > 1212 0.3886606 NA > > - > David L Carlson > Department of Anthropology > Texas A&M U

[R] Reshape to wide format

2016-12-12 Thread Miluji Sb
Dear all, I have the following monthly data by coordinates: I would like to reshape this data to wide format so that each column is a coordinate and each row is a month, coordinate1 coordinate2 coordinate3... Month 1 Month 2 Is the best option to concatenate the iso3, lon, and lat variables to

[R] Convert arc-second to degree

2016-11-29 Thread Miluji Sb
Dear all, I am using the Gridded Population of the World (v4) for the year 2010. The data is in GeoTiFF format. Source: http://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-adjusted-to-2015-unwpp-country-totals/data-download I imported the data using: library(raster) library(maptoo

Re: [R] Melt and compute Max, Mean, Min

2016-11-18 Thread Miluji Sb
If I do: as.data.frame(apply(df[,-(1:3)],1, mean, na.rm=T)) is it possible to sequentially name the variables as "mean_1960", "max_1960". "min_1960", "mean_1961", "max_1961". "min_1961", ...? On Fri, Nov 18, 2016 at 3:10 PM, Miluji Sb

Re: [R] Melt and compute Max, Mean, Min

2016-11-18 Thread Miluji Sb
ocess all your files you can do it in cycle. The function > > list.files() > > can be handy for that task. > > Cheers > Petr > > > -Original Message- > > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Miluji > Sb > > Sent: Frida

[R] Melt and compute Max, Mean, Min

2016-11-18 Thread Miluji Sb
Dear all, I have 51 years of data (1960 - 2010) in csv format, where each file represents one year of data. Below is what each file looks like. These are temperature data by coordinates, my goal is to to compute max, min, and mean by year for each of the coordinates and construct a panel dataset.

Re: [R] Average every 4 columns

2016-11-09 Thread Miluji Sb
[2] is divisible > by 4): > > colMeans(x[,0:(dim(x)[2]/4-1)*4+1]) > > -Dan > > On Wed, Nov 9, 2016 at 8:29 AM, Miluji Sb wrote: > >> Dear all, >> >> I have a dataset with hundreds of columns, I am only providing only 12 >> columns. Is it possible to tak

[R] Average every 4 columns

2016-11-09 Thread Miluji Sb
Dear all, I have a dataset with hundreds of columns, I am only providing only 12 columns. Is it possible to take the mean of every four (or 12) columns (value601, value602, value603, value604 etc.in this case) and repeat for the hundreds of columns? Thank you. Sincerely, Milu structure(list(va

[R] Merge data by coordinates

2016-10-16 Thread Miluji Sb
Dear all, I have two dataframe 1 by latitude and longitude but they always do not match. Is it possible to merge them (e.g. nearest distance)? # Dataframe 1 structure(list(lat = c(54L, 55L, 51L, 54L, 53L, 50L, 47L, 51L, 49L, 54L), lon = c(14L, 8L, 15L, 7L, 6L, 5L, 13L, 5L, 13L, 11L ), PPP2000_40

[R] Climate data in R

2016-08-01 Thread Miluji Sb
Dear all, I have a set of coordinates. Is it possible to extract climate data (temperature and precipitation) by coordinates using the R packages such as rnoaa? For example; out <- ncdc(datasetid='ANNUAL', stationid='GHCND:USW00014895', datatypeid='TEMP') But instead of stationid can I pass a l

[R] Country names from latitude and longitude

2016-07-25 Thread Miluji Sb
I have the following data at 0.5 degree by 0.5 degree. temp <- dput(head(ptsDF,10)) structure(list(longitude = c(-68.25, -67.75, -67.25, -68.25, -67.75, -67.25, -71.25, -70.75, -69.25, -68.75), latitude = c(-54.75, -54.75, -54.75, -54.25, -54.25, -54.25, -53.75, -53.75, -53.75, -53.75), GDP = c(1.

Re: [R] Aggregate data to lower resolution

2016-07-22 Thread Miluji Sb
-68 -55 0.09831317 > 3 -72 -54 0.22379000 > 4 -71 -54 0.14067290 > 5 -70 -54 0.00300380 > 6 -69 -54 0.00574220 > > Jean > > On Thu, Jul 21, 2016 at 3:57 PM, Miluji Sb wrote: > >> Dear all, >> >> I have the following GDP data by latitud

[R] Aggregate data to lower resolution

2016-07-21 Thread Miluji Sb
Dear all, I have the following GDP data by latitude and longitude at 0.5 degree by 0.5 degree. temp <- dput(head(ptsDF,10)) structure(list(longitude = c(-68.25, -67.75, -67.25, -68.25, -67.75, -67.25, -71.25, -70.75, -69.25, -68.75), latitude = c(-54.75, -54.75, -54.75, -54.25, -54.25, -54.25, -5

[R] Convert ncdf data to dataframe

2016-06-02 Thread Miluji Sb
Dear all, I have used the following code to read in a ncdf file library(chron) library(lattice) library(ncdf4) library(data.table) ncname <- ("/file_path") ncfname <- paste(ncname, ".nc", sep = "") dname <- "ssl" # note: tmp means temperature (not temporary) ncin <- nc_open(ncfname) print(ncin

Re: [R] Match Coordinates to NUTS 2 ID

2016-05-27 Thread Miluji Sb
ght be a better place to ask). > > -Don > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > > > > On 5/26/16, 2:30 PM, "R-help on behalf of Miluji Sb" > w

[R] Match Coordinates to NUTS 2 ID

2016-05-26 Thread Miluji Sb
Dear all, I have downloaded the NUTS 2 level data from library(“rgdal”) library(“RColorBrewer”) library(“classInt”) #library(“SmarterPoland”) library(fields) # Download Administrative Level data from EuroStat temp <- tempfile(fileext = ".zip") download.file(" http://ec.europa.eu/eurostat/cache/G

[R] Convert Coordinates to Address - Wikimapia

2016-05-17 Thread Miluji Sb
Is it possible to convert latitude and longitude into addresses in R using Wikimapia mapping instead of Google? The reason being that Wikimapia addresses have more details. This is the code I have been using but this obtains the information from Google. library(data.table) library(ggmap) coords<

Re: [R] Aggregate FIPS data to State and Census divisions

2016-05-01 Thread Miluji Sb
st. Given the size of your data, it's likely > that the dplyr and data.table packages would be worth investigating. > Both are well documented. > > Dennis > > On Sun, May 1, 2016 at 8:30 AM, Miluji Sb wrote: > > Dear all, > > > > I have the following data

[R] Aggregate FIPS data to State and Census divisions

2016-05-01 Thread Miluji Sb
Dear all, I have the following data by US FIPS code. Is there a package to aggregate the data by State and Census divisions? temp <- dput(head(pop1,5)) structure(list(FIPS = c("01001", "01003", "01005", "01007", "01009" ), death_2050A1 = c(18.19158, 101.63088, 13.18896, 10.30068, 131.91798), deat

[R] Use multiple cores on Linux

2016-04-20 Thread Miluji Sb
I am trying to run the following code in R on a Linux cluster. I would like to use the full processing power (specifying cores/nodes/memory). The code essentially runs predictions based on a GAM regression and saves the results as a CSV file for multiple sets of data (here I only show two). Is it

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-14 Thread Miluji Sb
Hi Milu, > My fault here. As I don't have the data to make the map and try out my > suggestions I mixed up the x and y coordinates. Try this: > > par(xpd=TRUE) > arrows(-19.75966,53,33.6,53,code=3) > par(xpd=FALSE) > > Jim > > On Tue, Apr 12, 2016 at 10:11 PM,

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-11 Thread Miluji Sb
n, Apr 11, 2016 at 12:00 AM, David Winsemius wrote: > > > > On Apr 10, 2016, at 1:45 PM, Miluji Sb wrote: > > > > Dear David, > > > > The device was the issue. The quartz() device works fine but pdf() does > not. Now I just need to figure out the limits for m

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-10 Thread Miluji Sb
, at 4:12 AM, Miluji Sb wrote: > > > > Hello David, > > > > This is exactly what I want but I still can't get the arrows. R and R > studio is updated. Thanks again! > > I didn't try it in Rstudio until just now (and I don't remember that you > eve

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-10 Thread Miluji Sb
; >> On Apr 9, 2016, at 11:18 AM, David Winsemius > wrote: > >> > >> > >>> On Apr 9, 2016, at 10:46 AM, Miluji Sb wrote: > >>> > >>> Dear David, > >>> > >>> Thank you for your answer. Sorry for the embarras

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread Miluji Sb
ols_3.2.4 munsell_0.4.3maps_3.1.0 fields_8.3-6 colorspace_1.2-6 On Sat, Apr 9, 2016 at 7:34 PM, David Winsemius wrote: > > > On Apr 9, 2016, at 8:13 AM, Miluji Sb wrote: > > > > Forgot to copy the list > > > > Dear Jim, > > > > Thank you

Re: [R] Adding Two-Headed Arrow in map legend

2016-04-09 Thread Miluji Sb
140,100,-140,code=3))) Thank you again. I really appreciate it. Sincerely, Milu On Sat, Apr 9, 2016 at 12:20 PM, Jim Lemon wrote: > Hi Miluji, > Try this: > > arrows(-100,-140,100,-140,code=3) > > Jim > > > On Fri, Apr 8, 2016 at 10:24 PM, Miluji Sb wrote: > &g

[R] Adding Two-Headed Arrow in map legend

2016-04-08 Thread Miluji Sb
I am trying to draw maps for the world using: library(rworldmap) library(maptools) library(RColorBrewer) tmp2<- dput(head(pece,10)) structure(list(iso3 = c("AUS", "AUT", "BEL", "CAN", "CHE", "CHL", "CZE", "DEU", "DNK", "ESP"), eps_score = c(0.877343773841858, 2.68984365463257, 1.31406247615814,

[R] Map of Europe at NUTS 2 Level

2016-03-10 Thread Miluji Sb
Dear all. I would like to draw a map of France, Italy, Spain, and Portugal at NUTS 2 level. I used the following code: library(“rgdal”) library(“RColorBrewer”) library(“classInt”) #library(“SmarterPoland”) library(fields) # Download Administrative Level data from EuroStat temp <- tempfile(fileex

Re: [R] Split Strings

2016-01-18 Thread Miluji Sb
lit_string) > if(lenstring < max_length) > split_string<-c(rep(NA,max_length-lenstring),split_string) > return(split_string) > } > > sapply(split_strings,fill_strings,list(max_length,element_sets)) > > Jim > > On Mon, Jan 18, 2016 at 7:56 AM, Miluji Sb wrote

[R] Split Strings

2016-01-17 Thread Miluji Sb
I have a list of strings of different lengths and would like to split each string by underscore "_" pc_m2_45_ssp3_wheat pc_m2_45_ssp3_wheat ssp3_maize m2_wheat I would like to separate each part of the string into different columns such as pc m2 45 ssp3 wheat But because of the different length

Re: [R] Two Time Fixed Effects - LFE package

2015-11-15 Thread Miluji Sb
ot; operator. For example: > > 1> 1:10%%3 > [1] 1 2 0 1 2 0 1 2 0 1 > > > > > On 11/14/2015 05:18 PM, Miluji Sb wrote: > >> I have weekly panel data for more than a hundred cities. The independent >> variables are temperature and precipitation. The

[R] Two Time Fixed Effects - LFE package

2015-11-14 Thread Miluji Sb
I have weekly panel data for more than a hundred cities. The independent variables are temperature and precipitation. The time dimensions are year and week and likely have time invariant characteristics and are all important for proper estimation. Could I use the LFE (or plm) package to estimate s